Skip to content

harden(kanban): single-source the creator-stamp shape rule + contract tests - #589

Merged
Kyzcreig merged 1 commit into
mainfrom
harden/session-stamp-shape
Aug 13, 2026
Merged

Kyzcreig merged 1 commit into
mainfrom
harden/session-stamp-shape

Conversation

@Kyzcreig

Copy link
Copy Markdown
Collaborator

Follow-up hardening to #588. Extracts the stamp-shape discrimination into one canonical helper (creator_stamp_is_session_key), converts both call sites, and adds a contract test suite: behavioral shapes from both writers, an AST sweep that fails on any re-inlined shape test (the drift path that caused #568 to break #562), and a reference check. Mutation-proven.

… tests

Follow-up to #588 (the 2026-08-12 phantom-session regression). #588 fixed
the bug but left the discrimination ('":" in stamp') inlined in TWO files
— gateway/kanban_watchers.py and hermes_cli/kanban.py — which is the exact
duplicated-normalizer-drift class that caused the original break (#568
hardened one assumption about tasks.session_id's format without the other
call sites' knowledge).

* creator_stamp_is_session_key() in gateway/routing_identity.py is now the
  single source of truth, with the mixed-format column documented on the
  helper itself (session KEY for gateway-created tasks; RAW session id for
  worker/CLI-created ones).
* Both consumers call it; notify-repair keeps a guarded ImportError shadow
  matching its existing fail-closed import pattern.
* tests/test_creator_stamp_shape_contract.py locks it three ways:
  behavioral (real key + raw-id shapes from both writers), single-source
  (AST sweep for inlined ':' in <stamp> shape tests outside the canonical
  home), and reference (both consumers must name the helper).

Mutation-proven: re-inlining the shape test in a consumer turns the AST
sweep RED; 74 kanban-scoped tests pass; ruff clean.
@Kyzcreig
Kyzcreig enabled auto-merge August 13, 2026 03:14
@Kyzcreig
Kyzcreig added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 0190ac7 Aug 13, 2026
44 checks passed
@Kyzcreig
Kyzcreig deleted the harden/session-stamp-shape branch August 13, 2026 03:26
@Kyzcreig

Copy link
Copy Markdown
Collaborator Author

FleetReview

Confidence: 4/5

Findings

  • P2 tests/test_creator_stamp_shape_contract.py:64 — Incomplete Scanner
  • P2 tests/test_creator_stamp_shape_contract.py:102 — Sanctioned-fallback whitelist is a whole-file substring match, exempting real drift

FleetReview provenance · models: B=gpt-5.6-sol, C=claude-code-opus-4-8, D=grok-4.5, F=gpt-5.6-sol, G=grok-4.5 · cost: $3.20 · duration: 24m 26s · rounds: 3 · files examined: 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant