Skip to content

Add worker group filters - #139

Closed
reneklacan wants to merge 1 commit into
mainfrom
worker-group-filters
Closed

Add worker group filters#139
reneklacan wants to merge 1 commit into
mainfrom
worker-group-filters

Conversation

@reneklacan

@reneklacan reneklacan commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

  • add typed WorkerGroup unit-struct derives and repeatable worker group annotations
  • add accumulating runtime include/exclude group filters
  • reject startup when filtering leaves no enabled workers
  • document filtering semantics and add macro/configuration coverage

Testing

  • cargo fmt --all -- --check
  • cargo clippy --all-features --workspace (passes with the existing removed-lint warning for clippy::from_iter_instead_of_collect)
  • targeted worker-group and compile-fail tests

Note

Medium Risk
Changes which workers a process registers and runs at startup; misconfigured filters can leave jobs unprocessed or fail startup, though the empty-worker guard limits silent no-op runtimes.

Overview
Adds typed worker groups so different Oxana processes can run subsets of the same component registry. Groups are unit structs via #[derive(oxana::WorkerGroup)]; workers declare membership with repeatable #[oxana(group = MyGroup)], and the Worker derive emits groups() from those attributes.

Runtime filtering is configured on RuntimeBuilder with accumulating only_groups and exclude_groups (single groups or tuples). Filters are applied at run(): only_groups keeps workers in at least one listed group and drops ungrouped workers; exclude_groups drops workers in any listed group and leaves ungrouped workers on. Combined filters apply both rules. Disabled workers are hidden from the registry (including legacy aliases, cron schedules, and on-demand entries), and startup fails with a config error if nothing remains enabled.

Docs, macro compile-fail validation (non–unit struct groups), and unit/macro tests cover the semantics.

Reviewed by Cursor Bugbot for commit 27524d7. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 27524d7. Configure here.

None
} else {
self.jobs.get(canonical_name)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filtered workers still lose jobs

High Severity

Group filters mark workers disabled, and factories_for then treats those job names as unregistered. The runtime still polls every registered queue, and coordinators permanently kill jobs they cannot build. A process that registers a shared registry and calls only_groups will destroy jobs meant for other processes.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 27524d7. Configure here.

Comment thread oxana/src/runtime.rs
return Err(OxanaError::ConfigError(
"no workers are enabled for this runtime".to_string(),
));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drain ignores group filters

Medium Severity

only_groups and exclude_groups accumulate on the builder, but drain never applies them. Draining therefore processes every registered worker, including ones the same runtime would disable in run.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 27524d7. Configure here.

@reneklacan

Copy link
Copy Markdown
Member Author

meh, i actually dont like it

@reneklacan reneklacan closed this Aug 28, 2026
@reneklacan
reneklacan deleted the worker-group-filters branch August 28, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant