Rulings reach the work they govern — milestone 444 steps 3-4 #194

Merged
bvandeusen merged 3 commits from dev into main 2026-10-03 08:29:25 -04:00
2 changed files with 14 additions and 3 deletions
Showing only changes of commit 891f375715 - Show all commits
+10 -2
View File
@@ -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"
)
+4 -1
View File
@@ -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():