test(7728): the pre-tool hook and route agree that session_id is sent and bound
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s

The hook now names its session for the delivery record, and the plugin
blueprint binds it before every handler. The contract test pins both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 18:18:52 -05:00
co-authored by Claude Opus 5.5
parent 61873b184b
commit 7df478550f
+8 -1
View File
@@ -721,7 +721,8 @@ def test_the_hook_and_the_route_agree_on_every_parameter_name():
sent = set(re.findall(r"[?&]([a-z_]+)=", hook))
# `root` and `cwd`: 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
# `session_id`: which session the lines go to, for the delivery record.
assert sent == {"tool", "command", "exclude_rule_ids", "root", "cwd", "session_id"}, sent
# The project-scope key is the shared helper's to choose: the hook
# splices in `grimoire_scope_query`'s output, which is `repo=` inside a git
@@ -763,6 +764,12 @@ def test_the_hook_and_the_route_agree_on_every_parameter_name():
assert f'request.args.get("{arg}")' in handler, (
f"the hook sends {arg!r} and the route never reads it"
)
# The session is bound for every plugin route at once, before the handler.
binder = route.split("async def _bind_delivery_session")[1].split("\n@plugin_bp")[0]
assert "@plugin_bp.before_request" in route.split("async def _bind_delivery_session")[0][-80:]
assert 'request.args.get("session_id")' in binder, (
"the hook sends session_id and no route reads it"
)
# ── The CALL log is unconditional; the SURFACING log is not ───────────