Skip to content

perf(review): skip Rust content reads and index build for warm no-impact diffs (#3859) - #4100

Merged
EffortlessSteven merged 6 commits into
mainfrom
perf/no-impact-diff-fast-path-3859
Sep 25, 2026
Merged

EffortlessSteven merged 6 commits into
mainfrom
perf/no-impact-diff-fast-path-3859

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

perf(review): skip Rust content reads and index build for warm no-impact diffs (#3859)

Production delta

inventory_diff_scoped_classified_seams_at_with_config (shared by the
review-comments route and the canonical-gap rerun) now probes a warm
no-impact fast path before the read-everything scoped inventory:

  • empty changed-owner set, no changed path that is a represented Rust
    analysis input (corpus member, *.rs incl. case variants, manifest /
    lock / toolchain, ripr.toml, test-intent, suppressions, registered
    harness, production-like opt-in, declared test/bench target), admitted
    corpus fingerprint mapping, byte-identical rebuilt workspace key,
    exact totals, post-assembly re-stat;
  • on success returns the empty scoped inventory with explicit zero-work
    FileFactCacheStats, without reading Rust source contents or building
    the Rust index;
  • every ineligible input declines with a typed NoImpactFallbackReason
    (changed_rust_source, changed_test_or_harness,
    changed_manifest_or_config, changed_source_role_authority,
    unsupported_or_unproven_change_identity, missing_fingerprint_mapping,
    incompatible_workspace_identity, corrupt_metadata,
    corpus_changed_during_resolution), traced as
    diff_scoped_inventory/no_impact_fallback_<reason> and served by the
    unchanged full conservative path;
  • RIPR_NO_IMPACT_FAST_PATH=0 restores the read-everything path
    (removal control).

Supporting changes: RepoCorpusFingerprintCache::lookup_detailed
(additive; lookup delegates with identical behavior),
FileFactCacheStats::zero_work, shared production_role_context
(full path refactored onto it, zero behavior change), SourceRole
re-export for reason mapping.

No output-schema change: no JSON/markdown field added, renamed, or
removed. Trace lines are stderr-only under the existing latency-trace
env gate.

Evidence delta

20 new tests, all green on Windows (cargo test filters unix-only):

  • reason vocabulary pin; eligibility matrix (docs-only eligible;
    production/test/manifest/config/harness/declared-authority/uppercase
    fallbacks with exact reasons); named-owner short-circuit before any
    filesystem probe; discovery-error propagation;
  • #[cfg(not(unix))] change-witness fallback;
  • lookup_detailed hit/missing/corrupt/incompatible + lookup
    delegation parity + zero-work label;
  • #[cfg(unix)] (CI): warm docs-only fast path with byte-identical key
    and exact totals; chmod-000 proof of zero Rust content reads; cold /
    corrupt / foreign-root fallbacks; disabled-route output identity
    modulo work counters; production edit keeps full computation active.

Gates: cargo fmt --check, cargo clippy -p ripr --lib --tests
(zero warnings), lib suites (seam_inventory 69, seam_cache 80,
review_comments 47, cli::rerun 41), goldens check, dogfood,
check-output-contracts, check-pr.

Acceptance (issue #3859)

  • Eligible warm no-impact diffs read zero Rust source contents and
    construct no Rust index (chmod-000 control, unix CI).
  • Exact workspace identity and totals remain truthful
    (byte-identical key, totals equality vs full path).
  • Every uncertain or semantic input change falls back
    conservatively with a typed reason (9/9 reasons pinned; 8/9
    live-triggered, corpus_changed_during_resolution safe-direction by
    construction with no-misfire evidence from the warm test).
  • fix(cache): prevent same-size timestamp-preserving edits from reusing stale Windows analysis #3848 native currentness controls pass; the shortcut stays
    disabled on platforms without a change witness (Windows fallback
    test).
  • Cold/warm and fast/fallback outputs canonically identical for the
    same subject modulo the prescribed zero-work counters.
  • Review-comments and canonical-gap rerun consume the shared
    implementation (single probe inside the shared function; consumer
    suites green).
  • Receipts make skipped work, fallback, and currentness admission
    observable (latency-trace statuses + zero-work cache label).
  • Exact-head required checks and independent review pass (CI + review).

Non-goals (per issue)

No owner/canonical-gap semantic-unit cache; no changed-production or
changed-test incremental claim; no dependency graph/dataflow engine; no
persistent service; no weakening of base/head/currentness; no release,
tag, publication, settings, or branch-protection mutation. Does not
satisfy #3796's central one-production-file semantic-reuse item.

Claim boundary

Removes needless content reads and index construction only for exact
warm no-impact diffs on an admitted change-identity surface.
Unix-only engagement (no ctime witness on Windows, per #3848); Windows
always takes the typed fallback at unchanged behavior.

Residual / limits

  • CorpusChangedDuringResolution has no live trigger (single-threaded
    race window); the arm declines safe-direction and the warm test shows
    the re-stat does not misfire on stable corpora.
  • Downstream 4,314-file fixture replay from the issue's proof list was
    not available in this environment; unix CI + dogfood cover the
    production-path replay.

Candidate

Exact candidate SHA: 56eea7a

@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!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 6c77cb7f-aec8-4605-a692-ec7b8fdd23f7

📥 Commits

Reviewing files that changed from the base of the PR and between c1e4d94 and 56eea7a.

📒 Files selected for processing (3)
  • crates/ripr/src/analysis/seam_cache.rs
  • crates/ripr/src/analysis/seam_inventory.rs
  • crates/ripr/src/analysis/workspace/mod.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Summary by CodeRabbit

  • Performance
    • Unchanged Rust analysis can now be skipped for eligible changes that do not affect seam or evidence results, speeding up inventory generation while preserving workspace identity and file totals.
    • Changes that may affect results, or cannot be verified safely, continue through the standard inventory process.
    • The shortcut can be disabled with RIPR_NO_IMPACT_FAST_PATH=0.

Walkthrough

The change adds detailed fingerprint-cache lookup outcomes and a guarded fast path for diff-scoped seam inventories. Eligible changes return an empty inventory with workspace identity and corpus totals. Ineligible changes continue through the conservative inventory path.

Changes

Diff-Scoped Seam Inventory

Layer / File(s) Summary
Fingerprint cache outcomes
crates/ripr/src/analysis/seam_cache.rs
The detailed lookup distinguishes cache hits, missing entries, corrupt entries, and incompatible entries. Zero-work stats start with zero counters and empty collections. Tests cover these outcomes and the zero-work state.
Fast-path eligibility and source roles
crates/ripr/src/analysis/seam_inventory.rs, crates/ripr/src/analysis/workspace/mod.rs
The eligibility probe checks changed owners, fingerprints, changed paths, and corpus stability. Shared source-role context construction supports inventory role classification, and the workspace module re-exports SourceRole.
Inventory routing and validation
crates/ripr/src/analysis/seam_inventory.rs
The diff-scoped entry point enables the shortcut unless RIPR_NO_IMPACT_FAST_PATH is exactly "0". Eligible probes return an empty inventory; declined probes continue through the conservative path. Tests cover eligibility, fallback reasons, identity, and zero-work stats.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant DiffScopedInventory
  participant NoImpactProbe
  participant CorpusDiscovery
  participant RepoCorpusFingerprintCache
  participant ConservativeInventory
  DiffScopedInventory->>NoImpactProbe: Check changed paths and fingerprint
  NoImpactProbe->>CorpusDiscovery: Discover corpus and source roles
  NoImpactProbe->>RepoCorpusFingerprintCache: Look up fingerprint mapping
  RepoCorpusFingerprintCache-->>NoImpactProbe: Return typed lookup outcome
  NoImpactProbe-->>DiffScopedInventory: Return empty inventory when eligible
  DiffScopedInventory->>ConservativeInventory: Continue when probe declines
Loading

Merge Risk: ⚪ Minimal · up to 56eea

No actionable merge-blocking risk is established for the fast path; complete the pending required checks before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 56eea

The shortcut falls back for relevant changes and unusable cache data. A concurrent addition to the analyzed file set could still make the reported workspace identity stale. No missed security finding or exploitable bypass was established.

Retained concerns

  • Low · reliability · inferred: The new shortcut can return an empty inventory with stale corpus totals and workspace identity if a Rust file is added after discovery: its final fingerprint checks only the original file list. This weakens the accuracy of analysis provenance under concurrent workspace mutation; an in-scope missed finding has not been demonstrated.
Security review details

Security Blast Radius

  • inferred — The examined exposure is the integrity of repository-analysis output consumed by review-comments and canonical-gap reruns, rather than a new externally callable or privileged interface.

Security Findings and Attack Paths

  • inferred — A concurrent file addition can evade the shortcut's final membership check and produce stale analysis provenance. The examined eligible documentation-only case yields no seams on the full path as well, so this evidence does not establish a missed security finding or an attacker-controlled bypass.

Trust Boundaries and Controls

  • observed — Changed Rust and role-authority paths decline to full analysis. Missing, corrupt, or incompatible fingerprint data also declines; a cache hit requires matching schema, workspace root, and fingerprint.

Resilience and Maintainability Implications

  • observed — The full path remains available after a typed decline and through the environment-controlled rollback. The scoped fallback does not itself repair a missing fingerprint mapping, but continues to compute the inventory.

Hardening Proposals

  • proposed — Compare a fresh corpus discovery with the initial file set before returning zero work, or establish a workspace snapshot or mutation exclusion that covers the decision and its consumption.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, eligibility rules, fallback behavior, tests, acceptance criteria, non-goals, and claim boundary. However, it omits many required template sections, includi… Update the description to include every required template section. Mark applicable checkboxes, provide source links or explicit N/A values, document rollback and traceability, complete CI Economics as n/a if applicable, and record the engin…
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 84.44% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 3 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main performance change: skipping Rust content reads and index construction for eligible warm no-impact diffs.
Full details: Description check

Explanation

The description explains the implementation, eligibility rules, fallback behavior, tests, acceptance criteria, non-goals, and claim boundary. However, it omits many required template sections, including Swarm / Source Boundary, Source-of-truth Links, Scope Classification, Support-tier Impact, Policy Impact, Rollback, Spec-Test-Code Traceability, Static Language Check, CI Economics, Engineering Check, and structured Gates checkboxes.

Resolution

Update the description to include every required template section. Mark applicable checkboxes, provide source links or explicit N/A values, document rollback and traceability, complete CI Economics as n/a if applicable, and record the engineering and gate results in the prescribed format.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit; I hop by the cache,
Where a warm fingerprint speeds up the dash.
If paths change, I take the full trail,
With zero-work stats tucked under my tail.
The seam inventory rests, neat and light.

Comment @coderabbitai help to get the list of available commands.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review (author COMMENT; GitHub bars author approvals — this is not approval).

reviewed_head_sha: 22a3f43365de5f76e159897dec4976969c6ebce9
integration_basis: main @ c1e4d94b934f99f35f3a75ca48867d6355f804eb
claim_boundary: warm no-impact diffs skip Rust content reads + index
  build with byte-identical key/totals; everything else unchanged.
  Unix-only engagement; Windows always typed-fallback. No #3796
  semantic-reuse claim.
changed_surfaces_and_semantic_owners_inspected:
  - analysis/seam_inventory.rs: NoImpactOutcome/Reason, eligibility,
    fast-path assembly, shared production_role_context refactor,
    16 tests. Semantic owner: diff-scoped inventory; consumers
    review-comments route (cli/commands.rs:1482) and canonical-gap
    rerun (cli/rerun.rs:722) — output shape unchanged, zero-stats
    aggregate cleanly.
  - analysis/seam_cache.rs: lookup_detailed (lookup delegates,
    behavior identical), FileFactCacheStats::zero_work, 4 tests.
    Owner: #2108/#3848 fingerprint authority — reused, not forked.
  - analysis/workspace/mod.rs: SourceRole re-export (one line).
blocking_findings: none.
non_blocking_suggestions: none.
refuted_or_stale_findings: none.
proof_and_ci_observed:
  - local: fmt clean; clippy zero warnings (fixed large_enum_variant
    via Box + needless_borrow during hardening); lib suites
    seam_inventory 69, seam_cache 80, review_comments 47, rerun 41;
    goldens check pass (fresh report, zero drift); dogfood 0;
    check-output-contracts 0; check-pr-shape 0.
  - discriminating controls: warm key/totals equality vs full path;
    chmod-000 zero-read proof (unix); cold/corrupt/foreign fallbacks;
    removal-control identity modulo counters; production-edit
    non-emptiness; eligibility matrix with exact reasons.
  - remote: 23 checks posted, none complete yet; 0 reviews.
  - rendered behavior: goldens ran the full fixture corpus through the
    linked binary with zero drift (no-regression arm); engagement arm
    is the unix unit e2e, pending unix CI on this head.
proof_or_review_missing:
  - required CI on this exact head (in flight).
  - unix execution of the 6 #[cfg(unix)] e2e tests (this lane ran
    Windows; unix CI is the capable oracle).
  - independent reviewer.
affected_currentness_dimensions: all dimensions current at this head;
  basis moved e4b819a59 -> c1e4d94b with no conflict (MERGEABLE).
residual_assumptions_and_non_claims:
  - CorpusChangedDuringResolution has no live trigger; arm declines
    safe-direction, warm test shows no misfire on stable corpora.
  - Downstream 4,314-file fixture replay unavailable here; unix CI +
    dogfood cover production-path replay.
  - Fast path never engages on Windows by design (#3848); Windows CI
    proves the fallback, not the shortcut.
disposition: REVIEW_INCOMPLETE (remote checks + unix oracles pending)

No merge convergence until a current REVIEW_READY on this exact head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Repair (REVIEW_INCOMPLETE held): CI Rust gates failed on cargo fmt --check — the SourceRole re-export was wrapped multi-line by my default-toolchain rustfmt while pinned rustfmt 1.9.0 wants it on one line. Fixed in 62a4eec (whitespace only; no production/test/oracle dimension changed), verified with cargo +1.95.0 fmt --check clean at the workspace root. Lesson recorded: use the pinned toolchain for fmt, not default stable. Awaiting CI on the new head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Repair (REVIEW_INCOMPLETE held): CI Rust gates failed at check-static-language — my doc comment used the prohibited term proven. Reworded to established in 1f39ae9 (comment only; no production/test/oracle dimension changed); check-static-language and pinned fmt --check verified locally. Awaiting CI on the new head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Repair (REVIEW_INCOMPLETE held): CI clippy --all-targets surfaced 6 type errors in my #[cfg(unix)] tests — they never compiled on this Windows host, so local green runs proved nothing about them. Fixed in 9493f9d: corrected Result vs unwrapped match shapes in the cold/corrupt/foreign/unreadable tests, and replaced Vec<ClassifiedSeam> structural comparison with canonical seam-id comparison (the type carries no PartialEq by design). Local check --all-targets (pinned) and fmt --check (pinned) clean; unix compilation + execution now rests with CI on this head.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Repaired head 5ae0f91: unix CI found 2 real test failures. Diagnosed: scoped-route helper warms only exact fingerprint, never stores it under the legacy map key — writers legitimately use scoped/legacy stores + memory_refresh_for_key accordingly. Fixed seam_inventory_warmer to warm through the same writer (scoped writes + scoped reads, legacy writes + legacy reads). Windows-only local proof on this head: fmt clean, 12 no-impact tests pass, seam_inventory 69/seam_cache 80/review_comments 47/rerun 41 passing (prior head; isolated new-test proof), goldens green; unix execution awaiting Rust gates. New head pushed.

@EffortlessSteven

Copy link
Copy Markdown
Member Author

Repaired head 56eea7a: the remaining unix failure was a test-vs-design mismatch, not a production bug. no_impact_fast_path_reads_no_rust_contents warmed the mapping, then chmod 0o000 between warm and fast-path call — but chmod bumps ctime, and the corpus fingerprint deliberately witnesses ctime (issue #3848), so the post-chmod fingerprint has no stored mapping and the fast path correctly declines missing_fingerprint_mapping. A Fast expectation there is unreachable by construction. Rewrote the test as no_impact_permission_only_change_declines_missing_mapping: same chmod mechanism, now pins the fail-closed decline (never pairs a key with an unwitnessed corpus). Deterministic as root and non-root (stat-only path, no EACCES involved). Note the test never executed on prior heads: nextest fail-fast cancelled the run at test 1950/8224 both times, and this test sits at position 1951 — the warmer fix merely exposed the next failure in line. Windows-local proof on this head: fmt clean, 12 no-impact tests pass; unix execution awaiting Rust gates.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inspection record (author self-review; COMMENT only per platform constraint) — disposition: REVIEW_READY.

reviewed_head_sha: 56eea7a
integration_basis: main @ c1e4d94; MERGEABLE/CLEAN; behind-only delta none (no restack).
claim_boundary: warm no-impact fast path for #3859 (unix-only engagement; Windows always typed-fallback at unchanged behavior). No output-schema change.
changed_surfaces_and_semantic_owners_inspected:

  • analysis/seam_inventory.rs: try_no_impact_fast_path + NoImpactOutcome/NoImpactFallbackReason + path-eligibility helpers (new); inner wiring fail-closed (Declined traces no_impact_fallback_ then full conservative path; Err propagates discovery failure exactly); WorkspaceKeyInputs/fingerprint_cached_workspace_key/store_corpus_fingerprint_mapping reuse the #2108 mapping authority unchanged.
  • analysis/seam_cache.rs: CorpusFingerprintLookup typed miss kinds (lookup delegates with identical behavior — Hit->Some, else None); FileFactCacheStats::zero_work.
  • analysis/workspace/mod.rs: SourceRole re-export (fmt-pinned one-liner).
  • 12 no-impact tests + 4 lookup/zero-work unit tests; test-only repairs at 9493f9d (unix match shapes), 5ae0f91 (warm via writer route), 56eea7a (permission-only change pins fail-closed decline).
    blocking_findings: none.
    non_blocking_suggestions: none.
    refuted_or_stale_findings: prior-head unix failures (corrupt-mapping, disabled-route) were test-oracle defects (warming via scoped route that never stores) — repaired at 5ae0f91, both PASS on this head. The chmod Fast expectation was unreachable by construction (chmod bumps ctime, the #3848 witness) — test rewritten to pin the designed decline, PASS at (1955/8230).
    proof_and_ci_observed:
  • Rust gates pass 22m32s + Result pass on exact head (run 36186361644); nextest Summary: 8230/8230 passed, 0 skipped — full denominator, no fail-fast truncation.
  • ub-review pass 15m15s on exact head. 0 unresolved threads. CodeRabbit rate-limited (missing review, not clean — covered by this record + ub-review).
  • Local: fmt clean, clippy clean, 166 seam_* suite, 49 rerun, 60 review_comments, goldens check, output-contracts pass.
  • Oracle grip both sides: unconditional-Fast would fail cold/corrupt/foreign/permission/role tests; never-Fast would fail warm-identity + disabled-route equivalence (byte-identical key/totals, zero-work counters).
  • Reason strings verified test/trace-only (2 as_str().to_owned sites are test error formatting); no stable-output leak. No new unwrap/expect/panic in added lines.
    proof_or_review_missing: CorpusChangedDuringResolution has no live trigger (stated in body; arm declines safe-direction).
    affected_currentness_dimensions: refreshed production, stimulus, oracle, platform (unix hit + Windows witness-absent decline), CI receipts — all bound to 56eea7a.
    residual_assumptions_and_non_claims: fast path engages unix-only by design (#3848); Windows takes the full path at unchanged behavior. 4,314-file fixture replay unavailable here; unix CI + dogfood cover production-path replay.
    disposition: REVIEW_READY

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant