Skip to content

fix(tests): Update the origin-spec registry gate for hook-event carriers - #5384

Merged
Sinity merged 1 commit into
masterfrom
fix/carrier-artifact-rule
Sep 22, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/carrier-artifact-rule

Conversation

@Sinity

@Sinity Sinity commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

tests/unit/sources/test_origin_specs.py has been red on master since 2026-09-16 (#5225, the NDJSON carrier cutover). Two assertions were stale. Neither change touches production — the registry was right; the test was describing an older one.

Problem

  1. hook_event_carrier is a production artifact rule on both claude-code-session and codex-session, and neither expected set listed it. Verified against the live registry:

    • claude-code-session: [adopt_manifest, agent_memory_document, agent_sidecar_meta, agent_transcript, coordinator_session_stream, hook_event_carrier, prompt_history_log, session_index, todo_snapshot, tool_result_sidecar, workflow_journal, workflow_run_snapshot]
    • codex-session: [agent_memory_document, hook_event_carrier, prompt_history_log, session_index]

    That assertion is the registry's completeness gate, so a production rule it omits makes the gate red — which is how the omission surfaced.

  2. artifact_suffixes_for_provider(Provider.CLAUDE_CODE) was asserted as an ordered tuple. The projection dedups with dict.fromkeys over artifact_rules declaration order, and the carrier rule is declared first, so the tuple permuted to ('.ndjson', '.json', '.jsonl').

    I checked whether order is contractual before matching the test to the code: every consumer tests membership only — any(name.endswith(suffix) for suffix in self.suffixes) at sources/live/watcher.py:268,271. So this asserts the set, with the reason recorded inline rather than left for the next reader to re-derive.

Why it survived six days — the more important finding

devtools test tests/unit/sources/test_origin_specs.py
ERROR: not found: tests/unit/sources/test_origin_specs.py::test_origin_specs_cover_the_public_enum_and_admission_lifecycles

That reads as a selection mistake. The test existed and was failing. The harness rewrites long nodeids to <name>[param-<digest>]; the "rerun failed tests alone" step re-selects by the original id; that lookup error then replaces the assertion in console output. The real failure was only in the run's pytest-report.json: {'passed': 51, 'failed': 1, 'total': 52}.

8,123 of 17,054 test functions (47.6%) have nodeids over 100 characters, so nearly half the suite is eligible for the same masking. Filed as polylogue-5coki.

Verification

Exit codes read directly, not through a filter.

devtools test tests/unit/sources/test_origin_specs.py   -> PASSED exit=0
  receipt .cache/verify/runs/20260922T030425Z-focused-test-419040-0d9c1fbd/run.json
devtools verify --quick                                  -> exit 0

Before the fix, the same selection was FAILED exit=1 with pytest-report.json showing {'passed': 51, 'failed': 1} — the red→green pair is the two AssertionErrors quoted above, each fixed and then re-run.

Schema closure: tests/ is outside the derived-schema closure; the identity does not move and this carries no landing-order constraint relative to a rebuild.

Context

The 03:00 full-corpus run at 158d1363e exited 1 with 212 failing nodeids and 25/25 static gates green (storage 54, daemon 46, cli 44, sources 12, schemas/devtools 10 each, core 9, integration/property/visual 12). This PR removes one of the sources failures. The ~46 tests/unit/cli failures were separately proven inherited. The rest are recorded in the shared known-red baseline and not yet attributed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy

tests/unit/sources/test_origin_specs.py has been RED on master since
2026-09-16 (#5225, the NDJSON carrier cutover). Two assertions were stale:

- `hook_event_carrier` is a production artifact rule on BOTH
  claude-code-session and codex-session (origin_specs.py), and neither
  expected set listed it. That assertion is the registry's completeness
  gate, so a production rule it omits makes the gate red -- which is how
  the omission surfaced.
- `artifact_suffixes_for_provider(Provider.CLAUDE_CODE)` was asserted as an
  ORDERED tuple. The projection dedups with `dict.fromkeys` over
  `artifact_rules` declaration order, and the carrier rule is declared
  first, so the tuple permuted to ('.ndjson', '.json', '.jsonl'). Order is
  not contractual: every consumer tests membership only --
  `any(name.endswith(suffix) for suffix in self.suffixes)` in
  sources/live/watcher.py:268,271 -- so this asserts the set and records why.

Neither change touches production. The registry was right; the test was
describing an older one.

WHY IT SURVIVED SIX DAYS, which is the more important finding:
`devtools test tests/unit/sources/test_origin_specs.py` printed
`ERROR: not found: ...::test_origin_specs_cover_the_public_enum_and_admission_lifecycles`,
which reads as a selection mistake, not a failure. The test existed and was
failing. The harness rewrites long nodeids to `<name>[param-<digest>]`, the
"rerun failed tests alone" step re-selected by the ORIGINAL id, and that
lookup error replaced the assertion in console output. The real failure was
only in the run's pytest-report.json: {'passed': 51, 'failed': 1}. Filed as
polylogue-5coki; 8,123 of 17,054 test functions (47.6%) have nodeids over
100 characters and are eligible for the same masking.

Verification (exit codes read directly, not through a filter):
  devtools test tests/unit/sources/test_origin_specs.py -> PASSED exit=0
    receipt .cache/verify/runs/20260922T030425Z-focused-test-419040-0d9c1fbd/run.json
  Before: FAILED exit=1, pytest-report.json {'passed': 51, 'failed': 1, 'total': 52}

Schema closure: tests/ is outside the derived-schema closure; the identity
does not move and this carries no landing-order constraint.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
@Sinity
Sinity enabled auto-merge (squash) September 22, 2026 03:11
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 7745252e-1280-441b-a127-1ee969e02819

📥 Commits

Reviewing files that changed from the base of the PR and between 198f848 and 3da1ad3.

📒 Files selected for processing (1)
  • tests/unit/sources/test_origin_specs.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-22T03:13:55.850831Z 3da1ad3 PR opened
🔒 Security Review ✅ Completed 2026-09-22T03:16:29.008265Z 3da1ad3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity merged commit a2df1fc into master Sep 22, 2026
3 checks passed
@Sinity
Sinity deleted the fix/carrier-artifact-rule branch September 22, 2026 03:23
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