diff --git a/tests/test_rule_usage_wiring.py b/tests/test_rule_usage_wiring.py index 9a49d460..60167a40 100644 --- a/tests/test_rule_usage_wiring.py +++ b/tests/test_rule_usage_wiring.py @@ -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 ───────────