Repository navigation
perf(diff): remove temporary strings from cold owner lookup - #3853
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. Summary by CodeRabbit
WalkthroughOwner lookup now compares symbol IDs without allocating normalized strings. The comparison accepts slash direction differences and requires all other bytes and the ID length to match. Tests cover matching, ordering, unresolved owners, Unicode, and a large index. ChangesOwner symbol matching
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to Owner lookup appears to retain its existing behavior while avoiding temporary strings. No actionable merge risk remains beyond normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. A rabbit checks each symbol with care Comment |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Exact-head source review — REVIEW_INCOMPLETE
Blocking for merge: missing terminal native/integration proof. No additional actionable source defect was found in this inspection. This is an author COMMENT review, not an approval or an assertion of independent external review.
reviewed_head_sha:9e86c65eb5687b4d7cd590a08eeacf875d4b60eaintegration_basis:dc66cecc2fd8a2217e944f13723e53dac68e8f67; published candidate merge ref currently8ea5e1a1e855a51f950bd93ce433ccccc7637557.claim_boundary: eliminate temporary normalized strings per owner candidate without changing full-identity resolution. No claim of end-to-end speedup, removal of the linear scan, installed no-precache readiness, or release qualification.changed_surfaces_and_semantic_owners_inspected: complete committed change inanalysis/classifier/owner.rs, old/new bytes and blob identities, the per-probe caller inclassifier::classify_probe, Rust adapter diff classification, and the existing included-fragment attribution contract. The follow-up commit applies only the three rustfmt layout changes reported by hosted CI.blocking_findings: current-head Rust tests, full routed checks and consumer-output parity are not yet established. The original formatting blocker was fixed in source and the replacement run's formatting preflight is observed passing.non_blocking_suggestions: no additional source change proposed without profiling; an identity map would be a different performance slice with memory/order/currentness obligations.refuted_or_stale_findings: none. Gemini/CodeRabbit quota messages are unavailable review, not semantic findings and not approval.
Correctness and oracle challenge
The previous canonicalizer replaces ASCII backslashes with ASCII slashes without changing byte length. Equal byte lengths and pairwise equality-or-separator-equivalence therefore preserve comparison over UTF-8. .find and function iteration order are unchanged. The implementation does not use the probe location to narrow candidates: that would break include fragments whose owner identity belongs to a parent compilation unit.
The retained/added Rust tests cover full identity, Unicode, mixed/repeated separators, unequal lengths, case sensitivity, missing owners, first canonical-match ordering, and 4,096 unrelated same-named functions before the correct owner. An independent Python model was rerun with 116,281 ordered comparisons and 22 explicit ordered controls. Four deliberately wrong alternatives are distinguished: raw equality, zip without length, normalized terminal-name-only equality, and exact-match-first lookup. These are algorithm-model results, not Rust test results. The old implementation intentionally passes parity tests; the allocation-removal claim is verified in source rather than asserted as a measured allocator result.
Proof provenance
proof_and_ci_observed: local git diff --check on the exact one-file delta; original/current Git blob hashes; model results above; actual failed formatting log from initial run 35688654957 / job 106620823263; successful formatting preflight on current-head-associated run 35688819508 / job 106621295995, with its Required Rust gates still in progress at inspection. PR Plan and Security report success, but neither is test evidence.
proof_or_review_missing: terminal Rust compile/test/Clippy and applicable output/golden evidence; current substantive external review; installed binary no-precache benchmark/peak RSS/phase-work receipts. Local Rust execution is unavailable. Windows integration was not exercised; separator strings are covered in source/model controls only.
affected_currentness_dimensions: candidate head and formatting validation refreshed after the layout-only follow-up. Production logic, test stimulus/oracles and claim boundary did not change.
residual_assumptions_and_non_claims: this local change cannot establish that owner lookup dominates consumer latency or satisfy the integrated cold-diff acceptance recorded under #3794. No gates, output goldens, schemas, limits, cache keys or support claims were weakened.
disposition: REVIEW_INCOMPLETE — keep draft, no merge or release authorization.
EffortlessSteven
left a comment
There was a problem hiding this comment.
reviewed_head_sha: 9e86c65
branch_basis: dc66cec
current_main_compatibility_basis: ed4b160
claim_boundary: remove the two temporary normalized strings created per inspected owner candidate while preserving the existing ordered full-symbol identity match
currentness reconciliation:
- current protected main has advanced, but
crates/ripr/src/analysis/classifier/owner.rsis byte-identical there to the branch basis (blob2d8e8f2ff4c9b9c743c1a1215e06a0d2095ed0b7) - the one-file candidate therefore has no visible source conflict with current main, but its existing merge-ref checks do not establish the eventual current-main integration object
blocking_source_findings: none
source review:
- the old predicate is
left.replace('\\', "/") == right.replace('\\', "/") - replacing either ASCII separator is byte-length preserving, including around UTF-8 sequences; UTF-8 continuation bytes cannot alias
/or\\ - equal byte length plus pairwise equality-or-separator-equivalence is therefore exactly the prior predicate
- the unchanged iterator
.findpreserves function order and the first canonical match; an exact-first two-pass optimization would not - the implementation still compares the complete symbol identity and does not substitute terminal name, path location, or owner-name similarity
normalize_symbol_idhas no other production consumer- the exhaustive reference test, explicit full-identity/Unicode controls, first-match control, missing-owner control, and 4,097-function cold index distinguish the material wrong implementations
proof observed:
- Security and PR Plan succeeded at this head
- formatting preflight succeeded on routed run
35688819508
proof/currentness still required:
- current routed Required Rust gates remain in progress
ub-reviewremains in progress- branch must integrate current protected main and obtain fresh required checks on that integration object before leaving draft
- installed nonempty cold-diff work/latency receipts remain outside this local source claim
nonclaims:
- no removal of the linear function scan
- no end-to-end latency or allocation-profile measurement
- no semantic-unit/base-proof reuse
- no release qualification
disposition: SOURCE_REVIEW_COMPLETE__KEEP_DRAFT_PENDING_CURRENT_MAIN_AND_HOSTED_PROOF
Source disposition at
|
9e86c65 to
0f2814d
Compare
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- new five-test suite is non-tautological, oracle-rich, and discriminates all four mutation controls called out in the PR body (raw equality, zip-only prefix, terminal-name, exact-first). Remaining residual: the parity corpus is depth-4 bounded and the 4,097-function stress fixture reuses the original probe fixture rather than swapping in a heterogeneous owner. Neither rises to a public blocker; both are bounded oracle-strength gaps a human reviewer can spot-check.
Verification questions
- Confirm parity oracle depth-bounded to 4 concatenations of {a, /, , é} => 1 + 41 + 44 + 416 + 464 = 341 strings; this is sufficient but does not exercise empty-after-separator or trailing-separator corner cases.
- Confirm wider crate scan (crates/ripr/src outside analysis) shows no related compression, runtime, or encoding helpers that would park as sibling follow-ups to this allocation-removal optimization.
Refuted
- Length pre-check + pairwise zip makes the comparator provably equivalent to
left.replace('\\','/') == right.replace('\\','/'); UTF-8 continuation bytes (≥0x80) cannot alias/(0x2F) or\\(0x5C), so multibyte sequences survive untouched. No unsafe, no aliasing, no lifetime extension beyond the borrow passed intoresolve_owner_function. - active-view/resizable-buffer UB: a transiently resized backing buffer could leave same_symbol_id comparing a stale len() against bytes(), causing silent prefix match across unequal lengths.; refuted because: Left and right are &str projected from owned String fields; they share a backing allocation that no other lane mutates, the surrounding .find is a sync iterator, and length is checked on the same projection used for the zip. No resizable JS/WASM/ASM buffer touches this comparator.
- ASCII-only separator handling might misalign around multi-byte UTF-8 IDs (e.g., src\café.rs::値) and yield a false positive.; refuted because: UTF-8 continuation bytes (0x80–0xBF) cannot equal b'/' or b'\', so byte-level pairing remains aligned and length-preserving; the 341-string/116,281-pair oracle and the explicit 'src\café.rs::値' / 'src/café.rs::値' control distinguish this regression.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
Review — head 0f2814d (rebuilt on current main)Surfaces. What this PR does. Removes temporary string allocations from the cold diff owner-identity lookup (#3847) — borrows instead of building owned keys per hunk. Stimulus/oracle. Diff-load tests pin identical owner identity before/after on the fixture corpus; allocation not asserted directly (behavior-parity is the oracle). Validation. Ripr Rust Small Result: SUCCESS on 0f2814d. Disposition: REVIEW_READY. |
Summary
Remove the two normalized
Stringconstructions performed for every inspected function during diff-probe owner lookup. Compare borrowed bytes with the existing slash/backslash equivalence instead. This needs no pre-cache or base proof.Keep the original ordered full-identity lookup; do not narrow evidence or alter include-owner attribution. Add five Rust tests and preserve the existing included-fragment regression.
Current candidate and disposition
0f2814da87e6068a2eff8a627c50410316922e13(single squashed commit, rebased onto protected main532d379ae59c8f48c6e7ab4a91f09a4a809dd890on 2026-09-24;owner.rscontent is byte-identical to the reviewed9e86c65etip — same source blob, so prior source reasoning and oracles apply verbatim)532d379ae59c8f48c6e7ab4a91f09a4a809dd890278e4256f82b632dda38208c4b02906bb5975714Ripr Rust Small Result, andub-reviewconcluded success at this exact head (run35991332805), and local native proof on Windows passed (rustfmt,cargo check -p ripr, six targeted owner tests, include-owner integration test). End-to-end installed cold-diff latency remains unmeasured and stays outside the claim boundary.Swarm / Source Boundary
This PR targets
EffortlessMetrics/ripr-swarmonly. No write toEffortlessMetrics/ripr, consumer pin, release ref, package, workflow, ruleset, suppression, or gate threshold.Source-of-truth Links
Issue: #3847. Parent: #3794. Existing include-owner contract: #3490 / #3498. Observability: #3795. Warm semantic/base-proof work: #3796. Repo-evidence indexing: #3838 (different surface; no overlap).
The explicit nonempty diff + empty analysis caches + no precomputed base proof replay acceptance is recorded in #3794, comment
5771424199. This local optimization alone does not satisfy that integrated requirement.Scope Classification
Production delta: an allocation-free, equal-length, byte-wise equivalence predicate replaces two
str::replacecalls inside the existing scan.Evidence/support delta: independent old-comparator oracle over 341 generated strings / 116,281 ordered pairs; explicit UTF-8, case, full path/module/suffix, unequal-length and repeated-separator controls; first normalized match before a later exact match; absent/missing owner; fresh 4,097-function index with 4,096 unrelated same-named functions. No support-tier change.
Single acceptance criterion: preserve the exact owner-resolution result without constructing normalized strings per inspected candidate.
Non-goals: removing the linear scan; changing file selection or related-test semantics; a new cache/index/dependency; claiming whole-path cold latency; closing the integrated release/performance authorities.
Proof — observed, not inferred from aggregate green
Local observations:
2d8e8f2ff4c9b9c743c1a1215e06a0d2095ed0b7; re-fetched unchanged on the publication basis.278e4256f82b632dda38208c4b02906bb5975714matches the locally inspected bytes.git diff --check: PASS for the complete one-file delta in an isolated local review tree, not a full repository checkout.Hosted history:
82e7190a664b9236641aa97410fba81816f99dbd: routed run35688654957, job106620823263, checked merge object5f15c7816b7b9d4599e37cc0d6701839fed75723. Formatting preflight failed on tuple/assertion layout in the added tests. Actual job log inspected. Compilation and tests were skipped; no test-pass claim is attached to this run.9e86c65eb5687b4d7cd590a08eeacf875d4b60ea: exact rustfmt feedback applied in a normal follow-up commit; production behavior and test oracles unchanged. Routed run35688819508, job106621295995: Formatting preflight PASS, required Rust gates in progress at inspection. PR Plan and Security workflows reported success; those are not compiler/test proof.0f2814da87e6068a2eff8a627c50410316922e13: the branch was rebased/squashed onto protected main532d379awithowner.rscontent unchanged (blob verified278e4256f). Routed run35991332805: Rust gates PASS (job107605950571), Ripr Rust Small Result PASS, ub-review PASS, plus cargo-deny, dependency-review, pr-plan and CodeRabbit pass; advisoryDroid Auto Reviewstill queued at update time.cargo fmt --checkPASS;cargo check -p riprPASS;cargo test -p ripr --lib analysis::classifier::owner6 passed / 0 failed;cargo test -p ripr --test rust_include_compilation_unit1 passed / 0 failed. Output contracts are untouched by the change, so no golden rerun is required.Established at head
0f2814daafter the rebase: hosted routed Rust gates andRipr Rust Small Resultconcluded success (run35991332805), and the previously missing local native proof now exists (rustfmt,cargo check -p ripr, targeted owner lib tests, include-owner integration test — all PASS on Windows).Still not established:
Droid Auto Reviewwas still queued at update time; the quota-limited Gemini/CodeRabbit responses are not substantive reviews.#3986,#3773dependency bump,#4029) after the rebase; none touchesowner.rs, so no restack or rerun of unaffected proof was performed.Exact-head source review
reviewed_head_sha:0f2814da87e6068a2eff8a627c50410316922e13(re-inspected at finalization;owner.rsblob278e4256f82b632dda38208c4b02906bb5975714is identical to the inspected9e86c65econtent)integration_basis:532d379ae59c8f48c6e7ab4a91f09a4a809dd890classifier::classify_probe; Rust adapter's per-probe call; original included-fragment regression; applicable source/review/security/Rust invariants..findremains unchanged, retaining first-match ordering. No file paths, canonical outputs or cache identities are rewritten.disposition:REVIEW_READYat head0f2814da(wasREVIEW_INCOMPLETEat9e86c65e; the recorded blockers were the stale integration basis and missing native proof, both resolved above).Support-tier Impact
Policy Impact
Claim Boundary
For K inspected nonempty IDs, the old source constructs 2K temporary normalized strings; this comparator constructs none. This is a local work reduction, not a measured end-to-end speedup. It does not establish that owner lookup dominates the historical consumer run, that all cold diffs are fast, or that #3794/#3796 or the release are complete.
Rollback
Revert the single-commit one-file change normally. No data, schema, cache or migration rollback is required.
Spec-Test-Code Traceability
crates/ripr/src/analysis/classifier/owner.rs.crates/ripr/tests/rust_include_compilation_unit.rs(must remain green).CI Economics
Existing routed CI only. No added workflow, remote service, blanket full-repo scan, or universal wall-clock gate. The formatting failure was repaired on the same candidate; no rule bypass or force push.