Skip to content

diag: register HYB-E4004/E4005 and gate the source -> registry join (fixes #4460) - #4461

Open
jorge123255 wants to merge 1 commit into
limitlessprojects:mainfrom
jorge123255:registry-guard-emitted-codes
Open

jorge123255 wants to merge 1 commit into
limitlessprojects:mainfrom
jorge123255:registry-guard-emitted-codes

Conversation

@jorge123255

Copy link
Copy Markdown

Fixes #4460.

The gap

hyb check prints HYB-E4004 / HYB-E4005 (the linear-capability terminal invariants in hy-check/src/channel_liveness.rs), and hyb explain answers unknown diagnostic code: HYB-E4004 (registry has 48 codes). The registry is append-only and is exactly what explain serves, so the code that fails the build is the code the user cannot look up.

Only one direction of the join was policed: check_guarantees.py fails when a GUARANTEES row names an unregistered code. Nothing failed when the compiler printed one, so both codes shipped disappearing — and neither could be cited by a row (the capability surface has no row).

What this does

  • Registers both codes in ascending order (send-capability-not-closed, recv-capability-not-drained) with title, summary, fix-its and an example, so explain serves them.
  • Adds tools/check_diagnostic_registry.py: every HYB-E#### any .rs under a crate's src/ can print must be registered, else exit 1 naming file:line. Comment mentions count too — a doc comment naming a nonexistent code is the same drift one step earlier, and the entire set is 50 codes, so the strictness costs nothing.
  • make registry, the check target and a CI step (make registry) run it, with six unit tests: drift is reported with its location, other crates are scanned, a missing registry refuses to pass, registered-but-unused stays legal.

Gates

  • gate on the pre-fix tree: 4 findings in channel_liveness.rs (7, 8, 103, 117), exit 1; clean after registering;
  • hyb explain HYB-E4004 and … E4005 serve full pages, E4004/4004 aliases included;
  • cargo test -p hy-diag green (the registry discipline tests: unique, ascending, every code has a reference page);
  • check_guarantees, check_test_registration, check_corpus_census green.

No rule and no verdict moves; this is registry and tooling only.

Co-authored-by: OpenBot openbot@openbot.dev

…ixes limitlessprojects#4460)

The capability terminal invariants print two codes the registry never got:

    error[HYB-E4004]: linear send capability 'tx' was not closed before scope exit
    $ hyb explain HYB-E4004
    unknown diagnostic code: HYB-E4004 (registry has 48 codes)

Only one direction of the join was enforced. `check_guarantees.py` fails when
a GUARANTEES row names an unregistered code; nothing failed when the compiler
printed one, so a code can be added to the checker and be unexplainable
forever — and un-citable from any row. The capability split (`hy.pipe[T]()`)
has no row at all, so nothing forced these two.

Register both in ascending order with title, summary, fix-its and an example
so `hyb explain` serves them.

`tools/check_diagnostic_registry.py` closes the direction: every `HYB-E####`
any `.rs` under a crate's `src/` can print must be in the registry, else exit
1 naming `file:line`. Comment mentions count too — a doc comment naming a
code that does not exist is the same drift one step earlier, and the whole
set is 50 codes. Wired into `make registry`, the `check` target and CI, with
six unit tests (drift detected with its location, unrelated crates scanned,
missing registry refuses to pass, registered-but-unused is fine).

The gate reproduces the bug on b1627e8: four findings in
`channel_liveness.rs` (lines 7, 8, 103, 117), exit 1.

Co-authored-by: OpenBot <openbot@openbot.dev>
@github-actions github-actions Bot added the bot:land-candidate Shepherd: fresh, gate-clean, verifiable (set from classify()) label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:land-candidate Shepherd: fresh, gate-clean, verifiable (set from classify())

Projects

None yet

1 participant