test(rulings): the hook/route parity guards pin the rulings params (#4757)
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / integration (push) Successful in 49s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / Python tests (push) Successful in 1m49s
CI & Build / Build & push image (push) Successful in 33s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / integration (push) Successful in 49s
CI & Build / TypeScript typecheck (push) Successful in 53s
CI & Build / Python tests (push) Successful in 1m49s
CI & Build / Build & push image (push) Successful in 33s
CI 7939 went red on test_the_hook_and_the_route_agree_on_every_parameter_name: the Bash hook now sends root and cwd, and the guard pins the exact set. Both guards (tool-rules and prior-art) now also pin seen_ruling_systems, spelled once in scribe_rulings_query, and check the routes read all three. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -744,7 +744,9 @@ def test_the_hook_and_the_route_agree_on_every_parameter_name():
|
||||
handler = route.split("async def pre_tool_rules")[1].split("\n@plugin_bp")[0]
|
||||
|
||||
sent = set(re.findall(r"[?&]([a-z_]+)=", hook))
|
||||
assert sent == {"tool", "command", "exclude_rule_ids"}, sent
|
||||
# `root` and `cwd` (milestone 444): where the command runs, so the paths it
|
||||
# names can be made repo-relative for the rulings arm.
|
||||
assert sent == {"tool", "command", "exclude_rule_ids", "root", "cwd"}, sent
|
||||
|
||||
# The project-scope key is the shared helper's to choose (#4085): the hook
|
||||
# splices in `scribe_scope_query`'s output, which is `repo=` inside a git
|
||||
@@ -763,6 +765,12 @@ def test_the_hook_and_the_route_agree_on_every_parameter_name():
|
||||
assert "printf '&held_rule_ids=" in defs, (
|
||||
"the opened ledger's query key is no longer spelled in the helper"
|
||||
)
|
||||
# The rulings ledger, shared with the write-path hook (milestone 444) —
|
||||
# spelled once in its helper for the same reason.
|
||||
assert "scribe_rulings_query" in hook, "hook no longer sends the rulings ledger"
|
||||
assert "printf '&seen_ruling_systems=" in defs, (
|
||||
"the rulings ledger's query key is no longer spelled in the helper"
|
||||
)
|
||||
|
||||
# Both scope keys are read by the shared _project_scope() helper, not inline.
|
||||
assert "_project_scope()" in handler
|
||||
@@ -776,7 +784,7 @@ def test_the_hook_and_the_route_agree_on_every_parameter_name():
|
||||
assert 'request.args.get("held_rule_ids")' in handler, (
|
||||
"the hook sends held_rule_ids and the route never reads it"
|
||||
)
|
||||
for arg in ("tool", "command", "exclude_rule_ids"):
|
||||
for arg in ("tool", "command", "exclude_rule_ids", "root", "cwd", "seen_ruling_systems"):
|
||||
assert f'request.args.get("{arg}")' in handler, (
|
||||
f"the hook sends {arg!r} and the route never reads it"
|
||||
)
|
||||
|
||||
@@ -970,7 +970,7 @@ def test_route_reads_every_arg_the_hook_sends():
|
||||
routes._project_scope
|
||||
)
|
||||
for arg in ("path", "code", "repo", "project_id", "exclude_ids",
|
||||
"exclude_sync_ids", "shapes"):
|
||||
"exclude_sync_ids", "shapes", "seen_ruling_systems"):
|
||||
assert f'request.args.get("{arg}"' in src, f"route ignores {arg}"
|
||||
|
||||
hook = HOOK.read_text()
|
||||
@@ -991,6 +991,9 @@ def test_route_reads_every_arg_the_hook_sends():
|
||||
assert "printf '&held_rule_ids=" in defs, (
|
||||
"the opened ledger's query key is no longer spelled in the helper"
|
||||
)
|
||||
# The rulings ledger (milestone 444), shared with the tool-rules hook.
|
||||
assert "scribe_rulings_query" in hook, "hook no longer sends the rulings ledger"
|
||||
assert "printf '&seen_ruling_systems=" in defs
|
||||
|
||||
|
||||
def test_route_resolves_repo_to_a_project_not_to_a_location_filter():
|
||||
|
||||
Reference in New Issue
Block a user