test(harness): drift gates for tool/hook/model contracts + honest #3/#4 scoping#18
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Harden the harness: convert prose contracts to drift gates (weakness #2), with honest scoping of #3/#4
Follow-up to the "no orphan tools" guard. This turns three more prose-level "MUST stay consistent" contracts into machine checks that
cargo testalready runs — so they can't silently rot.Drift gates added (all std-only, read-source tests, mutation-verified)
tools_cataloghas adispatch_toolarm and vice versa (27↔27). Catches "advertised a tool but forgot to route it" (errors when the agent calls it) and renamed/orphaned dispatch arms.install/hooks.rsregisters intosettings.jsonhas a("hook", …)arm inmain.rs(10 registered ⊆ 14 dispatched). Catches "registered a hook the CLI can't handle" = a broken install where the hook fires and errors.MODEL: {model}. Machine-enforces the model-routing contract whose absence once made workers silently inherit the wrong (expensive) model.Each gate was mutation-checked: renaming one dispatch arm / hook arm / the MODEL prefix makes the corresponding gate fail and name the drift; all pass again after revert. Not fake tests.
Honest scope — what this does and doesn't fix
This was raised as "fix all the weaknesses." Being straight about each:
#[allow(dead_code)]are justified (a pub API wrapper, a documentation const, a lib re-export), each with a reason comment. Earlier audit rounds already cut the real dead code. The remaining breadth is architectural (many crates/features) — a design choice, not a defect. No fabricated cuts.Lint & fmt
--check-clean. Deliberately scoped to the touched files only — this repo is not uniformly rustfmt'd and a blanket format would churn 100+ unrelated files.