Repository navigation
fix(cli): disclose cache misses, cache-aware warm promise, CLI exit grep guard (#12505) - #13108
EffortlessSteven wants to merge 1 commit into
Conversation
… pin exit set (#12505) Child A of the #12418 split. Emit a stderr disclosure exactly on CacheLoad::Miss in both the classified and compact seam-facts cache families, probe the walk's own cache family before claiming warm reruns in the invocation disclosure, and add the check-cli-exit-contract grep guard pinning ripr process exits to the documented closed set {0, 2, 3, 130} with an allowlisted pinned boundary. Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 58 minutes. View limit details
|
|
|
|
Closing as superseded: the claim this PR implements landed on main via #12553 — merge commit 245e544 ("Disclose cache misses, cache-aware warm promise, CLI exit grep guard (#12505) (#12553)", merged 2026-11-03) — and the governing issue #12505 auto-closed as COMPLETED at 2026-11-03T13:28:01Z. All three child-A items are present on current main at that commit: the seam-facts cache miss stderr disclosure in both families (crates/ripr/src/analysis/seam_inventory.rs seam_facts_cache_miss_message / disclose_seam_facts_cache_miss at the authoritative load), the cache-presence-aware repo_audit_path_disclosure(&self, workspace_root) with repo_audit_path_disclosure_is_cache_presence_aware (crates/ripr/src/output/format.rs), and the check-cli-exit-contract guard pinning the closed exit set (xtask/src/cli_exit_contract.rs + policy/cli_exit_literal_allowlist.toml), each with its discriminating tests. This lane's independent implementation was built and fully proven locally (fmt, clippy, 9 discriminating tests, policy cascade, goldens 124=124-vs-base) on base 3f07cf4, but the rival PR merged mid-flight before this PR could converge, and main's history rewrite made the branch a conflicting duplicate. No work from this PR is needed; closing without merge. |
Governing issue or accepted claim: child of #12418 per #11770-adjacent research
Acceptance delta (one sentence): repo-wide runs disclose seam-facts cache misses on stderr in both cache families, only promise warm reruns when the walk's own cache family holds an entry, and can never add an undocumented exit code without failing
cargo xtask check-cli-exit-contract.Witness (gap state at base
3f07cf476b)Plan of record: #12505 body + research comment 6571024651 on #12418. Anchors re-resolved by symbol at current main before implementation; line numbers below are at this branch's base.
CacheLoad::Missarms (crates/ripr/src/analysis/seam_inventory.rsclassified fingerprint path 425, classified post-collect 492, compact fingerprint path 917, compact post-collect 955) called onlytrace_latency_phase;grep -rn seam_facts_cache_miss crates/ripr/srcreturned 0 hits. A failed cold run (external-termination class, ripr review-guidance pass dies by SIGTERM (oomd-class) on ~1700-file closures: peak memory scales with closure size #3768) publishes nothing — the end-of-run all-or-nothing store — and the next run silently pays full price again.repo_audit_path_disclosure(&self)(crates/ripr/src/output/format.rs:398) was a pure function of format flags: anyis_seam_fact_cache_backedformat printed "warm reruns reuse the seam-facts cache and are much faster." before any cache check (crates/ripr/src/cli/commands/check.rs:1619), even where no cache entry exists.cargo xtask check-cli-exit-contractat base:xtask: unknown xtask command 'check-cli-exit-contract'(exit 1). The contract was typed-pinned (CommandError::exit_code,cli/exit_kani.rs) but nothing greppable prevented a future literal site from reintroducing an undocumented code.Rival-work check: PR #12553 covers this same claim but was stalled >12h (head commit 2026-11-02T09:34:28Z, CI red, no human review) when this lane started; the <4h race condition was not met, so the lane proceeded independently on a fresh base.
Implementation (exactly the posted plan; no expansion)
seam_facts_cache_miss_disclosure(&CacheLoad, compact) -> Option<&'static str>incrates/ripr/src/analysis/seam_inventory.rsreturns the disclosure exactly onMiss— never onHit(no walk) orCorruptIgnored(which already discloses its own reason line) — wired at all four production miss arms. Classified: "no usable seam-facts cache entry for this workspace state; running the full classified walk"; compact names its own compact walk.seam_facts_cache_entry_present(root, family)incrates/ripr/src/analysis/seam_cache.rs— a cheap directory listing over the family's own entry layers, resolvingRIPR_CACHE_DIRthe same way the run's loads do.OutputFormatSpecgainsseam_fact_cache_family: Option<ClassifiedCacheFamily>(classified family for repo-exposure-json/md, repo-sarif, agent-seam-packets-json, repo-badge-*; compact family only for repo-exposure-summary-json, matching each renderer's actual inventory acquisition).repo_audit_path_disclosure(&self, workspace_root)claims "warm reruns reuse the seam-facts cache" only when the walk's own family holds an entry; otherwise "no seam-facts cache entry is present yet, so this workspace's first run pays the full walk." Raw formats keep their every-run clause; no wall-clock promise added.cargo xtask check-cli-exit-contract(xtask/src/policy/cli_exit.rs, joined intocheck-policy-all) scanscrates/ripr/srcfor realprocess::exit(call sites after a Rust scanner blanks string/char literals, raw strings and comments — so analyzed-source fixture strings never need allowlist churn. Decimal literals must be inside the closed set {0, 2, 3, 130} (docs/EXIT_CODES.md); anything else (undocumented literal or non-literal argument) fails unless allowlisted inpolicy/cli-exit-contract-allowlist.txtwith count, owner, reason, plus stale/orphan bound detection (gate(xtask): count-based gates (process/network/local-context) check one direction only — stale max_count entries never flagged #2413 pattern). Pinned rows: theatomic_file.rstest child'sexit(86)(fix(cache): recover aged interrupted-write temps during warm Rust checks #8474) and themain.rsstartup boundary's two non-literal exits (the kani-pinned typed mapping).Discriminating tests
seam_facts_cache_miss_disclosure_fires_only_on_miss_in_both_families— Some onMiss, None onHit/CorruptIgnored, per family, distinct wording per family.seam_facts_cache_entry_present_is_family_scoped/…_treats_empty_layers_as_absent— the probe flips only on its own family's entry; empty layer directories stay absent (a failed cold run published nothing).repo_audit_path_disclosure_is_cache_presence_aware— cache absent → first-run full-price clause for both families; classified entry present → classified formats flip to the warm clause whilerepo-exposure-summary-jsonstays cold (family separation, research sub-item 3); compact entry present → compact flips. Same workspace, different stderr per cache state.repo_format_audit_path_disclosure_covers_exactly_the_full_repo_analysis_group(updated) — against an empty workspace cache-backed formats must NOT claim warm reruns; family-column parity withis_seam_fact_cache_backedpinned.check_fails_on_undocumented_exit_literal_and_passes_the_closed_set,check_requires_allowlist_for_non_literal_exits_and_rejects_stale_bounds,findings_classify_documented_and_undocumented_literals,literal_scanner_blanks_strings_chars_and_comments_but_keeps_code— the guard fails any new out-of-set literal (exit(1)), ignores string-literal fixtures, requires allowlist rows for non-literal boundaries, rejects stale bounds.Deferred (recorded, not implemented)
Incremental sharded cache publication (partial-generation resume) — L, explicitly deferred by the plan: needs per-file coverage tracking plus loader changes across both families; the miss disclosure removes the surprise without it. Separate future claim.
Local proof (Windows host, Rust 1.95.0, worktree
impl-child-12505at base3f07cf476b)cargo fmt --check— pass.cargo check -p ripr --lib— pass (4m52s).cargo clippy -p ripr --all-targets -- -D warnings— pass.cargo clippy -p xtask --all-targets— zero errors and zero warnings from the newcli_exitmodule;-D warningsfails on this Windows host at the exact base with the change stashed (git stash push -u, clean tree,cargo clippy -p xtask --all-targets -- -D warnings: 22 errors bin + 24 errors test — pre-existing Windows-only dead-code/unused-import items inexact_candidate_harness,termination_qualification,run.rs; change popped back after).cargo test -p ripr --lib seam_facts_cache— 3 passed, 0 failed.cargo test -p ripr --lib audit_path_disclosure— 2 passed, 0 failed.cargo test -p xtask cli_exit— 4 passed, 0 failed (exit 0).cargo xtask check-cli-exit-contract— pass (2 pinned rows, no violations).cargo xtask check-command-catalog,check-no-panic-family,check-process-policy,check-allow-attributes,check-static-language,check-executable-files,check-network-policy,check-lint-policy.cargo xtask goldens check— 124 drift entries, every one a Windows-host path-separator formatting artifact (src/shared.rsvssrc\shared.rs); re-run at the exact base with this change stashed (git stash push -u→cargo xtask goldens check→git stash pop) shows the identical 124 entries, so this diff adds zero golden drift. The drift report contains zero occurrences of "seam-facts", "no usable", or "warm rerun". No golden re-bless performed (and none sanctioned from Windows).Non-goals
No exit-code remapping (the typed contract already maps 2/3/130 and stays kani-pinned); no wall-clock promises; no golden re-bless; no classification-semantics change; no CI workflow edits (the guard is enforced via
check-policy-alland available as a named command).