Skip to content

fix(cli): disclose cache misses, cache-aware warm promise, CLI exit grep guard (#12505) - #13108

Closed
EffortlessSteven wants to merge 1 commit into
mainfrom
impl-child-12505
Closed

EffortlessSteven wants to merge 1 commit into
mainfrom
impl-child-12505

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

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.

  1. No miss disclosure. The four production CacheLoad::Miss arms (crates/ripr/src/analysis/seam_inventory.rs classified fingerprint path 425, classified post-collect 492, compact fingerprint path 917, compact post-collect 955) called only trace_latency_phase; grep -rn seam_facts_cache_miss crates/ripr/src returned 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.
  2. Unconditional warm promise. repo_audit_path_disclosure(&self) (crates/ripr/src/output/format.rs:398) was a pure function of format flags: any is_seam_fact_cache_backed format 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.
  3. No exit-set guard. cargo xtask check-cli-exit-contract at 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)

  1. Miss-line stderr, both families: seam_facts_cache_miss_disclosure(&CacheLoad, compact) -> Option<&'static str> in crates/ripr/src/analysis/seam_inventory.rs returns the disclosure exactly on Miss — never on Hit (no walk) or CorruptIgnored (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.
  2. Cache-presence-aware disclosure: seam_facts_cache_entry_present(root, family) in crates/ripr/src/analysis/seam_cache.rs — a cheap directory listing over the family's own entry layers, resolving RIPR_CACHE_DIR the same way the run's loads do. OutputFormatSpec gains seam_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.
  3. Exit-set grep guard: new cargo xtask check-cli-exit-contract (xtask/src/policy/cli_exit.rs, joined into check-policy-all) scans crates/ripr/src for real process::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 in policy/cli-exit-contract-allowlist.txt with 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: the atomic_file.rs test child's exit(86) (fix(cache): recover aged interrupted-write temps during warm Rust checks #8474) and the main.rs startup 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 on Miss, None on Hit/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 while repo-exposure-summary-json stays 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 with is_seam_fact_cache_backed pinned.
  • 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-12505 at base 3f07cf476b)

  • 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 new cli_exit module; -D warnings fails 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 in exact_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).
  • Policy cascade — all exit 0: 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.rs vs src\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-all and available as a named command).

… 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>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 151 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: e0b72586-9954-4f3d-989e-e81be59d24fe
Commits

Reviewing files that changed from the base of the PR and between 3e82c1d and 779af97.

Files selected for processing: 11
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/seam_inventory.rs
  • crates/ripr/src/cli/commands/check.rs
  • crates/ripr/src/output/format.rs
  • policy/cli-exit-contract-allowlist.txt
  • xtask/src/command.rs
  • xtask/src/dispatch.rs
  • xtask/src/main.rs
  • xtask/src/policy/all.rs
  • xtask/src/policy/cli_exit.rs
  • xtask/src/policy/mod.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

merge-ready was requested, but this PR conflicts with main (head 779af97c), so GitHub creates no test-merge ref and no qualification run can start. Merge main into the branch and resolve the conflicts, then remove and re-apply merge-ready.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant