test(8249): prompt filter, shared rule ledger and reply-shape guards run the hooks
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 32s
CI & Build / Python tests (push) Successful in 2m19s
CI & Build / integration (push) Successful in 2m33s
CI & Build / Build & push image (push) Successful in 18s

- test_prompt_boundary_filter: the prompt hook runs on a client-written turn
  and sends nothing, and on a typed one and asks; was "the filter call sits
  above the curl line" in the source.
- test_rule_usage_wiring: the write arm runs and is told it named rule 33,
  then the tool arm in the same session must send 33 as already named; was
  three string searches of each script for the ledger's path.
- test_reply_shape_turn: the hook half of the shape-ledger contract is the
  runtime test already there; the remaining test checks the route half from
  the route's AST.
- test_contract_around_the_change: its write-gate guard was a copy of
  test_hook_never_returns_a_permission_decision, which now checks the same
  two things.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 17:37:24 -05:00
co-authored by Claude Opus 5.5
parent 0681534257
commit ea30e0bd75
4 changed files with 54 additions and 40 deletions
+7 -7
View File
@@ -131,12 +131,12 @@ def test_the_core_goes_whole_once_then_as_a_reminder_then_whole_after_a_compacti
assert "Every reply" in json.loads(out)["hookSpecificOutput"]["additionalContext"]
def test_the_hook_and_the_route_agree_on_the_ledgers_names():
"""A contract across the seam: a renamed field fails silently."""
def test_the_route_reads_the_shape_ledger_the_hook_sends_and_returns_its_keys():
"""A contract across the seam: a renamed field fails silently. The hook
half (it sends `shapes_seen` and keeps the `shape_keys` it is given) is
the runtime test above; this is the route half."""
from grimoire.routes import plugin as routes
from tests.helpers import route_query_args
hook = HOOK.read_text()
assert "shapes_seen" in hook and "'.shape_keys'" in hook
assert "grimoire_shapes_file" in hook and "grimoire_shapes_append" in hook
route = inspect.getsource(routes.autoinject_retrieve)
assert 'request.args.get("shapes_seen")' in route and '"shape_keys"' in route
assert "shapes_seen" in route_query_args(routes.autoinject_retrieve)
assert '"shape_keys"' in inspect.getsource(routes.autoinject_retrieve)