fix(scheduler): resolve limit host and project scopes against their own groups (bug-1933)
The limit plugin called build_limit() with the host-group and project-group managers swapped, so a limit's hosts: members were looked up among the project groups (a host-group name became a literal host name and the limit never applied) and its projects: members among the host groups. Pass them in the order build_limit() declares. New test test_limit_scopes_resolve_against_own_group_kind; the test's main() now initializes the interned-string table that group names need. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
25cdbc79b4
commit
6ecd418d21
4 changed files with 229 additions and 2 deletions
|
|
@ -17722,6 +17722,32 @@
|
|||
"record": ".wolf/bugs/bug-1932.md",
|
||||
"gitea_issue": 357,
|
||||
"gitea_synced_status": "fixed"
|
||||
},
|
||||
{
|
||||
"id": "bug-1933",
|
||||
"status": "open",
|
||||
"status_updated": "2026-10-10",
|
||||
"status_note": "newly logged",
|
||||
"component": "scheduler",
|
||||
"severity": "wrong-result",
|
||||
"timestamp": "2026-10-10T03:36:53Z",
|
||||
"last_seen": "2026-10-10T03:36:53Z",
|
||||
"occurrences": 1,
|
||||
"error_message": "xce_scheduler limit plugin resolves hosts: scopes against project groups (host-group limits ignored)\n\n**Observed:**\nThe scheduler's limit plugin built every limit with the host-group and\nproject-group managers swapped. A limit scoped to a host group never\nmatched that group's hosts; a limit scoped to projects resolved its member\nnames against the host groups. The new regression test, before the fix:\n```\n../scheduler/testsuite/test_limit_plugin.c:491:test_limit_scopes_resolve_against_own_group_kind:FAIL: Expected 1 Was 0\n```\n(host group `hg1` = {`hostA`}; a limit with `hosts: [hg1]` did not match\nhost `hostA`.)\n\n**Expected:** a limit's `hosts:` members resolve against the host groups\n(`hosts: [hg1]` matches every host in `hg1`), and its `projects:` members\nresolve against the project groups (a project name never matches a host\ngroup).\n**Impact:** wrong result, silent. Every host limit that names a host group\napplies to no host (only to a host literally named like the group), so the\nlimit is never enforced. A project limit whose member name equals a host\ngroup's name matches the projects named like that group's hosts instead of\nthe project itself. Limits naming plain host or project names, and limits\nwithout host/project scopes, are unaffected. In addition, the groups a\nlimit builds for its own scopes were registered in the wrong manager\n(`<limit>-pg-group` in the host groups, `<limit>-hg-group` in the project\ngroups).\n**Found by:** review, during `/kiro-spec-requirements project-config`\n(2026-10-10, codebase survey of project-scoped limits).",
|
||||
"file": "src/scheduler/src/plugins/limit.c, src/lib/xcelimit.c",
|
||||
"root_cause": "`build_limit()` (`src/lib/xcelimit.c:292`) takes its group managers as\n`(ugmgr, qgmgr, hgmgr, pgmgr)`, but `limit_seed_config_impl()`\n(`src/scheduler/src/plugins/limit.c:77`) passed\n`(core->ugmgr, core->qgmgr, core->pgmgr, core->hgmgr)`. `build_consumer()`\ntherefore built the HOST consumer with the project-group manager and the\nPROJECT consumer with the host-group manager. `make_g_member()`\n(`src/lib/group.c`) treats a member name as a nested group only if the\nmanager it is given knows that group, so `hg1` became a literal host name\n(the project-group manager is empty) and a project member named like a host\ngroup became that host group. Since `ecf1916d` (2026-01-12, \"support\nlimit\"), the first version of the plugin call; carried through `7c229284`\nand `487e7b94`. Scope: `limit.c:77` is the only production caller of\n`build_limit()` (checked with `grep -rn \"build_limit(\"`); the lib tests\n(`src/lib/testsuite/test_limit.c`) pass the managers in the right order.",
|
||||
"fix": "`src/scheduler/src/plugins/limit.c`: pass `(core->hgmgr), (core->pgmgr)` in\nthe order `build_limit()` declares, so each scope resolves against its own\nkind of group. No wire, WAL, snapshot or config change. The project-group\nmanager is still never loaded from config (projects have no config yet);\nthat is `project-config` scope (Requirement 6.7).\n`src/scheduler/testsuite/test_limit_plugin.c`: new regression test; `main()`\nnow initializes the interned-string table (`xstring_table_init()`), which\ngroup names need and which no earlier test in this binary exercised.\n\nVerification:\n- Test: `test_limit_scopes_resolve_against_own_group_kind`\n (`src/scheduler/testsuite/test_limit_plugin.c`): RED before the fix\n (`Expected 1 Was 0` at line 491, `hosts: [hg1]` not matching `hostA`),\n GREEN after (6/6 in `sched_limit_plugin_test`).\n- Suites: scheduler suite 119/119 OK, libxce tests 2/2 OK, asan\n (`xce.build`), 2026-10-10.\n- Live: n/a: the change is one argument order in config-time limit\n construction, fully covered by the unit test; no live limit run.",
|
||||
"tags": [
|
||||
"scheduler",
|
||||
"limit",
|
||||
"project",
|
||||
"hostgroup"
|
||||
],
|
||||
"related_bugs": [
|
||||
"bug-1785"
|
||||
],
|
||||
"fix_commits": [],
|
||||
"record": ".wolf/bugs/bug-1933.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue