refactor(rerank): split analysis_rerank.rs — it crossed the 1000-line error gate - #432
refactor(rerank): split analysis_rerank.rs — it crossed the 1000-line error gate#432runyourempire wants to merge 2 commits into
Conversation
… error gate My own #423 pushed `analysis_rerank.rs` from 739 to 1032 lines, past the 1000-line ERROR threshold in scripts/check-file-sizes.cjs. It reached main because the gate runs as a step in CI's **Frontend** job, and `Detect changes` skips that job on Rust-only PRs. So a Rust-only change can violate a Rust file-size rule and still go green — the next PR to touch any frontend file would have failed on MY file, with no obvious connection to the change that caused it. Extracted the outcome-reporting and budget-pacing concern into `analysis_rerank_outcome.rs` via the `#[path]` submodule pattern this file already uses for `analysis_dedup.rs`: - BUDGET_PACE_HEADROOM / budget_allowance_by_now / secs_into_utc_day - RerankSkip (+ reason/detail) and RerankOutcome (+ log) - the 9 pacing and skip-reporting tests that cover them These genuinely are a separate concern from "run the LLM rerank": deciding whether a pass may spend budget, and reporting honestly what a pass did. analysis_rerank.rs 1032 -> 760 (below error, and back near its pre-#423 739). Deliberately NOT added to the EXCEPTIONS allowlist: granting an exception to a file I had just bloated is exactly the quiet rule-erosion the doctrine warns about, and that list already carries a "candidates for splitting" backlog. Pure code motion — no behaviour change. Verified: check-file-sizes exit 0 (44 -> 43 warnings, zero errors); cargo fmt clean; clippy -D warnings clean on BOTH CI legs (default + experimental); full lib suite 4300 passed / 0 failed / 10 ignored. Follow-up worth considering (not done here): move the file-size gate out of the Frontend job so it runs on every PR. It is a repo-wide invariant, not a frontend one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01RmAB6P1r22WBwdM6eUyGgk
… or reopen) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
| Check | Result |
|---|---|
node scripts/check-file-sizes.cjs |
exit 0 — 44 → 43 warnings, zero errors (the bug this PR fixes) |
cargo fmt --check |
clean |
cargo clippy -- -D warnings |
clean (CI leg 1: default features) |
cargo clippy --features experimental -- -D warnings |
clean (CI leg 2) |
cargo test --lib |
4,300 passed / 0 failed / 10 ignored |
| full local pre-commit gate | green — doc locations, LLM-gate honesty, vanity metrics, release channel, no-window spawns, dead-code expiry, ghost commands, IPC contracts, boundary calls, ESLint, secret scan |
The change is pure code motion (one module extracted, zero behaviour change), so the local suite is a strong signal — but it is not a substitute for CI, and I am not claiming it is.
Needs a human call: either investigate the missing pull_request event delivery, or merge on the local evidence above.
|
Superseded by #430, which landed first and solved the same 1000-line gate failure with a different seam — extracting the This PR's seam ( |
Superseded — closingWhile this PR sat unverifiable, #430 landed the same fix from another lane: "URGENT unblock: split analysis_rerank tests to clear the 1000-line commit gate (fleet cannot commit)" ( Verified against current #430 moved the tests out; this PR moved the outcome types + budget pacing out (866 vs 760). Both clear the threshold. Theirs is merged, so this is duplicate work and re-litigating the split would be pure churn. Closing. The part that matters more than this PRMy #423 blocked the entire fleet from committing. Root cause of how it reached main is unchanged and still open:
Recommended follow-up (not filed by me): move Also worth recording: why this PR never got CINo |
The bug I shipped
My own #423 pushed
src-tauri/src/analysis_rerank.rsfrom 739 to 1032 lines, past the 1000-line ERROR threshold inscripts/check-file-sizes.cjs.Why CI didn't catch it
The size gate runs as a step inside CI's Frontend job:
Detect changesskips the Frontend job on Rust-only PRs. #423 touched only Rust +.gitignore, so Frontend was skipped and the gate never ran. The violation landed on green CI.The consequence: the next PR to touch any frontend file would have failed on my file, with nothing connecting the failure to the change that caused it.
The fix
Extracted the outcome-reporting and budget-pacing concern into
analysis_rerank_outcome.rs, using the#[path]submodule pattern this file already uses foranalysis_dedup.rs:BUDGET_PACE_HEADROOM,budget_allowance_by_now,secs_into_utc_dayRerankSkip(+reason/detail) andRerankOutcome(+log)These are genuinely a separate concern from "run the LLM rerank": deciding whether a pass may spend budget, and reporting honestly what a pass actually did.
analysis_rerank.rs: 1032 → 760 (below error, back near its pre-#423 739).Deliberately NOT added to the
EXCEPTIONSallowlist. Granting an exception to a file I had just bloated is precisely the quiet rule-erosion the doctrine warns against, and that list already carries a "candidates for splitting" backlog that this would have joined.Pure code motion — no behaviour change.
Verification
node scripts/check-file-sizes.cjs→ exit 0, 44 → 43 warnings, zero errorscargo fmt --checkcleancargo clippy -- -D warningsclean on both CI legs (default and--features experimental)Follow-up worth considering (not in this PR)
Move the file-size gate out of the Frontend job so it runs on every PR. It enforces a repo-wide invariant — Rust thresholds included — but currently only executes when frontend files change. That gap is what let this through, and it will let the next one through too.
🤖 Generated with Claude Code