Skip to content

fix(analysis): exposure classification diverges across platforms on identical committed trees #3469

Closed

Description

@EffortlessSteven

Observed

ripr check --base <merge-base> --mode draft classifies the same committed tree differently per platform. Reproduced twice while landing Horizon A slices in EffortlessMetrics/ub-review (ripr 0.10.0):

Instance Windows 11 (local, working tree) ubuntu-24.04 runner (gate, merge ref)
A1.2 slice (PR ub-review#1246, run 32889504417) unsuppressed_exposure_gaps = 0, weakly_exposed = 0 new_unsuppressed = 51
Row-stamp slice (PR ub-review#1250, run 32912923990) 0 new_unsuppressed = 6

Both sides analyzed identical content: same base commit (932b887f / bcaa102a respectively), same merge-ref tree.

Ruled out

  • Line endings: git ls-files --eol shows i/lf w/lf for every involved file; blobs are LF and the Windows checkout is LF.
  • Base drift: compared against pinned origin/main SHAs; no intervening merges.
  • Test presence: the probes carried behavioral oracles in same-file #[cfg(test)] modules both times (exact rejection-message asserts, digest field-boundary tables, real temp-git fixtures), e.g. probe:src_revision_admission.rs:match_arm:f5bbbe35 (match parents.len()) sits above bail! sites whose exact messages are pinned by contract_surface_pins_tokens_labels_and_rejection_messages.

Symptom shape

The Linux side reports Discriminator unconfirmed: no assertion text references this probe's changed expression (observation_unverified) for probes whose asserting tests live in the same file and quote the adjacent bail!/expression text. The Windows side resolves those associations. This suggests an OS-dependent path in probe→test association or assertion-text extraction (path separators, case folding, corpus discovery order, or CRLF handling inside extracted spans).

Impact

  • Local zero-posture checks cannot predict the Linux gate verdict: authors either burn a CI cycle per PR or pre-suppress findings their platform cannot see.
  • Suppressions written from a Linux packet look stale/unnecessary under Windows analysis (and vice versa), accelerating suppression-ledger rot — we shipped 51 + 3 + 6 receipts this way (downstream tracker: ub-review#1247).

Ask

  1. Identify the platform-dependent step (association graph? span/text normalization? test-target enumeration?) and normalize so classification is platform-independent on identical inputs;
  2. or document the divergence explicitly in sensor docs so downstream zero-posture workflows know local runs are not authoritative.

Happy to provide both raw artifacts (Windows findings.json + badge-json showing 0, and the gate packet's sensors/ripr/exposure-gaps.json from runs 32889504417 / 32912923990) if useful.

Activity

  1. EffortlessSteven commented on Aug 27, 2026

    @EffortlessSteven
    MemberAuthor

    I’m taking this as the next implementation slice. @codex investigate the exact platform-dependent path using the supplied downstream receipts, reproduce with a committed-tree fixture where possible, identify whether association, assertion extraction, path normalization, or discovery order is responsible, and implement the smallest platform-independent fix. Add regression coverage that would fail on the opposite-platform behavior, preserve the deterministic evidence contract, run focused analysis tests plus required policy/format checks, and open a review-forward PR. Do not paper over the divergence with documentation until the implementation path is disproven.

  2. chatgpt-codex-connector commented on Aug 27, 2026

    @chatgpt-codex-connector

    Summary

    • Identified the platform-dependent step as same-file probe-to-test association, not assertion extraction or discovery order. The association previously used host-native Path::file_stem, which interprets foreign path separators differently across operating systems.
    • Added platform-independent stem extraction that recognizes both / and \, while retaining the existing deterministic normalized-path behavior.
    • Added regression coverage combining a Windows-style probe/owner path with a forward-slash indexed test path. The test verifies both SameTestFile association and preservation of the exact extracted assertion text.
    • Committed the candidate as fe9e3dfa8ea505421bc1b6478e42e639ad0377ff (fix(analysis): normalize cross-platform association stems).
    • A pull request could not be opened because this checkout has no configured Git remote, no GitHub credentials, and the requested make_pr tool is unavailable in this environment.

    Testing

    • ✅ cargo fmt --check
    • ✅ cargo test -p ripr same_file_association_normalizes_foreign_platform_separators
    • ✅ cargo test -p ripr analysis::classify::related_tests — 23 related-test analysis tests passed.
    • ✅ cargo xtask check-static-language
    • ✅ cargo xtask check-file-policy
    • ✅ git diff --check
    • ✅ git show --check --format=fuller HEAD
    • ⚠️ cargo xtask precommit — unable to resolve a merge base because neither origin/main nor a local main ref exists in this checkout.

    View task →

  3. EffortlessSteven commented on Aug 29, 2026

    @EffortlessSteven
    MemberAuthor

    Materialization-byte finding that weakens ruled-out #1 (line endings), from #3541/#3548:

    The ruled-out evidence checked the wrong bytes. git ls-files --eol (i/lf w/lf) describes the worktree and index attributes. But ripr's candidate analysis (0.10.x git_candidate_execution) materialized the analyzed tree via git archive, which honors .gitattributes eol transforms even with core.autocrlf=false — extracted bytes could silently differ from the bound blob identity. #3548 replaces archive extraction with ls-tree + cat-file raw blob bytes for exactly this reason. So "blobs are LF and the Windows checkout is LF" does not establish that the bytes ripr analyzed on the Windows side were LF.

    Concrete verification protocol for the 0.10.0-era reproductions:

    1. Re-run the Windows-side analysis with a pre-fix(analysis): preserve candidate blob bytes on Windows #3548 binary and hash the materialized candidate files (the temp subject dir) against git cat-file blob <tree>:<path> for the same paths — any hash mismatch on files involved in the failing associations confirms the byte-divergence mechanism.
    2. If the hashes match, the byte hypothesis is dead and the remaining suspects (corpus discovery order, association graph construction) stand.

    Honest boundary on direction: the eol-filter mechanism alone predicts the Windows side failing to associate (CRLF inside extracted spans breaks assertion-text matching), while this issue reports the opposite asymmetry (Windows resolves, Linux does not). So this finding invalidates the ruled-out evidence but does not by itself explain the reported direction; if the hashes in step 1 match, Linux-side corpus discovery/enumeration order becomes the leading suspect. I did not have the ub-review artifacts locally to run step 1 myself.

  4. EffortlessSteven commented on Aug 29, 2026

    @EffortlessSteven
    MemberAuthor

    Investigation result: the classify pipeline is deterministic on identical inputs — the realistic divergences are input skew (analyzed bytes / diff / binary), and the reported runs predate the direct fix (#3545)

    Inspected: EffortlessMetrics/ripr-swarm main @ 71663b36a (in sync with origin/main), 2026-08-29. All file:line refs are current main unless marked 0.10.0-era. Method: static read of the association/reveal/index/suppression paths plus one Windows test run. No Linux execution was done — Linux-side claims below are Rust std path semantics + code reading, and are labeled as such.

    1. Staleness assessment — the reproductions are ~83 analysis commits behind main

    v0.10.0 shipped 2026-06-15. Since then, 83 commits touched analysis/{classify,facts,syntax,probes,test_grip_evidence}, including:

    The issue is likely stale with respect to current main: the exact association family it points at was fixed three days after filing, and dozens of fact-extraction behaviors changed since the binary that produced the artifacts. A same-binary re-run is the right next step before any further platform hunt (recipe in §5).

    2. The quoted Linux message rules out the discovery-order family for this symptom

    observation_unverified ("no assertion text references this probe's changed expression", classify/reveal.rs:470-475) is emitted only when related_tests is non-empty (the empty case gets a different message, reveal.rs:20-34) and at least one assertion matched while none confirmed (reveal.rs:230-282). So on the Linux side the same-file tests were related and their assertions did match — only token/effect confirmation failed. Discovery order, corpus eviction, case folding, or path-form failures that drop a candidate produce "No reachable test oracle found" or a missing probe — never this message. Token confirmation is a pure function of (probe expression, extracted from the diff text) × (assertion text, extracted from indexed bytes) × (parsed oracle kind). Given the same message on both sides for the same probes, those inputs must have differed between the runs — not iteration order.

    For the record, the iteration/order surfaces are deterministic on current main (audited, no platform dependency found):

    • discovery sorts after read_dir: workspace/discover.rs:15-17
    • index insertion preserves input order across parallel parse batches: facts/build.rs:91-106, 157-177
    • related tests sort by (name, file): classify/related_tests.rs:206-207; observation_unverified is order-insensitive (any later confirmed match clears it, reveal.rs:253-262)
    • grip-context test indexes are BTreeMap, not HashMap: test_grip_evidence/related_tests/context.rs:15
    • case folding uses to_ascii_lowercase (classify/related_tests.rs:142-143); Rust's to_lowercase is Unicode-table-based (not OS-locale) and appears in this area only in test code (analysis/mod.rs:1086)
    • the diff-index scope cap fails closed instead of evicting: language/rust.rs:1570-1577
    • probe/finding IDs are separator-sanitized (probes/ids.rs:104-109) with owner separators normalized in the fingerprint (ids.rs:33-40, Line-keyed finding ids silently transfer suppressions to unrelated code #1053, landed 2026-06-11 → already in v0.10.0), so finding-id-keyed suppressions are platform-stable; path-glob suppressions normalize \→/ (output/suppressions.rs:617-624 and path_glob_matches, ~line 857)

    3. Ranked candidate mechanisms for the observed runs (all input skew, none OS-iterative)

    (1) Worktree mode never reads the committed tree — local evidence can exceed the merge ref (direction: fits; confidence: medium). ripr check --base <merge-base> without a bound subject runs worktree mode: the diff comes from git objects, but the index reads the live working tree (language/rust.rs:1600-1607, std::fs::read over options.root.join(file)), and untracked/unchanged local files are indexed as association evidence even though load_worktree_diff excludes untracked files from the diff (diff/load.rs:52-71). Any test file present locally but absent from the merge-ref tree (uncommitted, untracked, scratch) participates in the Windows association pass and is invisible on CI. The observed direction — local confirms, CI says observation_unverified — requires confirming evidence to exist locally and not on CI, which is exactly this hole. The git ls-files --eol verification does not cover it; git status --porcelain captured at local-run time would have.

    (2) Branch-tip tree vs merge-ref tree — different effective diffs (direction: fits the 0-vs-51 shape; confidence: medium). The local run diffed <base> against the branch-tip worktree; the gate ran at the merge commit. Unless the branch was exactly rebased onto main, the merge tree contains main-since-merge-base, and a merge-base computed at the merge commit can resolve to the main tip — so the two runs can analyze different (base, tree) pairs with no main movement between the runs. "Pinned base SHAs" pins the base argument, not the analyzed tree. This yields extra probes/tests on exactly one side and needs no OS dependency at all.

    (3) Build skew between two "0.10.0" runs (direction: either; confidence: low-medium). The gate installs crates.io 0.10.0 (June-15 code). If the local run was a dev build from a newer checkout, the two sides ran different classifiers. Note the per-file fact cache key pins only (schema "0.5" + CARGO_PKG_VERSION + raw path + content hash) — analysis/seam_cache.rs:148, 358-387 — so two different builds of the same "0.10.0" are not distinguished and warm caches serve facts from whichever build wrote them; seam_cache.rs:67-83 documents this exact hazard family ("while the package version stayed 0.10.0"). Cross-platform cache contamination itself is blocked (the key embeds the raw host path, so a Windows-written entry misses on Linux).

    CRLF/eol (#3541/#3548): real, open, and direction-mismatched for this issue. Both issues are still open and materialize still extracts via git archive (git_candidate_execution.rs:231-296); but that path executes only for bound git-candidate subjects, while the reported runs were worktree-mode. And the CRLF mechanism (checkout filters → CRLF on Windows, #3541) would degrade the Windows side's extracted assertion text — predicting Windows-weaker, the opposite of the reported asymmetry. I agree with the maintainer's tension note; this family should stop being cited as a suspect for #3469's reproductions.

    4. Remaining same-family residue (small normalization proposal — not claimed as the cause)

    The repo-seam grip path still derives SameTestFile stems with host-native file_stem on both sides of the lookup: test_grip_evidence/related_tests.rs:63-66 (owner stem) and test_grip_evidence/related_tests/context.rs:162-167 (index key). It is self-consistent per host and only reachable if a foreign-separator path reaches one side (no producer identified in-repo), so this is defense-in-depth, not evidence: apply the #3545 normalized_file_stem pattern there. It does not affect ripr check, and I am not claiming it caused this issue. Concurrent work check: gh pr list --state all --search 3469 shows only #3471 (closed) / #3545 (merged); #3541/#3548 (open) own the materialization-bytes seam.

    5. Recommended next step — same-binary, same-tree repro protocol

    1. Pin one build: at a current-main SHA, ship the identical binary to both platforms (same cargo install --locked --path crates/ripr result or the same artifact).
    2. On both platforms, fresh clone of the subject repo at the same merge-ref SHA (not a local branch tip); git status --porcelain must be empty on both.
    3. Prove input identity before comparing outputs: git diff --no-color --stat <base> hashed on both sides; git ls-files --eol on the CI checkout too (the original ruled-out evidence was Windows-side only); compare ripr's changed-file lists from --json.
    4. Run ripr check --base <base> --mode draft --json on both; compare per-probe related_tests + discriminate summaries for one probe, not summary counts. If the related sets match but confirmation differs, byte-diff the same assertion's oracle text from both sides — that names the remaining skew (bytes vs diff vs binary) immediately.

    If (3) shows identical inputs and (4) still diverges on the identical binary, that is a genuine ripr bug worth a committed fixture — and the failing pair (same finding id, two oracle texts) is the regression fixture.

  5. EffortlessSteven commented on Aug 31, 2026

    @EffortlessSteven
    MemberAuthor

    Closing reconciliation for the merged fix: #3598 landed at 535138c (squash of 54d3ed6) after the Linux CI failure was reproduced locally under WSL and root-caused to two stacked host-divergent layers — (1) the seam's /-normalized file identity missing the raw host-separator index key in rust_index::find_owner_function (Path component equality only absorbs this on Windows), and (2) host-native Path::file_stem extraction on both association stems; rust_index::is_test_file had the same component-vs-string divergence, and the review rounds added a fail-closed non-UTF-8 guard on both the stem and the owner-lookup fallback.

    Verification bound to the merged head: full ripr lib suite 4,702 passed / 0 failed on Linux (WSL, real POSIX path semantics), targeted suites green on Windows, fmt/clippy clean, required Ripr Rust Small Result green on the PR head and on the merge.

    Residual asks from this issue's thread: the same-binary cross-platform repro protocol remains documented above as future hardening; the classify-side normalized_file_stem lossy-stem hole (weak-affinity consumer only) is tracked with acceptance criteria in #3599. The input-skew attribution for the original 0.10.0-era observations (worktree-mode working-tree reads, merge-ref vs branch-tip trees, build skew) stands as recorded in the investigation comments.

  6. EffortlessSteven commented on Aug 31, 2026

    @EffortlessSteven
    MemberAuthor

    Reconciliation: association-path platform dependence fixed on main — PR #3598 (merge 535138c)

    Landed. PR #3598 merged to main at 535138c42 (2026-08-31) and is CI-pinned on Linux (Ripr Rust Small Result pass; full Rust-gate suite 16m54s green on the final head).

    What the investigation got right and where it landed:

    • The 2026-08-29 thread concluded the classify pipeline was deterministic on identical inputs and the 0.10.0-era reproductions were input skew. That conclusion holds for the reported runs — and the follow-up found a real platform-dependent break one layer over, now fixed:
    • RepoSeam::new normalizes file identity to / while index keys keep the producer's raw separators; find_owner_function compared them with Path equality — separator-insensitive on Windows, exact on Linux. On a mixed-separator corpus, Linux lost the owner (owner=None) and with it every related-test relation (related=[]), the exact symptom family in this issue (local and gate disagree on identical content).
    • Fixed at the same time: both grip association stems (OwnerContext::resolve, tests_by_file_stem keys) now use fix(analysis): normalize probe paths before test association #3545-style normalized extraction, and is_test_file judges the normalized form. The owner-lookup fallback requires valid UTF-8 on both sides — lossy replacement characters cannot fabricate an owner (devin/coderabbit findings, pinned by a unix unit test).

    Evidence shape: the end-to-end regression (given_foreign_separator_paths_when_grip_associates_then_same_test_file_still_matches) failed on Linux CI with owner=None; related=[] before the owner-lookup fix and passes over all four separator combinations after; goldens check + dogfood show zero drift (native-separator behavior unchanged). The failing run's diagnostics are preserved in the PR thread.

    Acceptance covered: ask #1 (identify and normalize the platform-dependent step) for the grip/association paths — the last known host-native stem and identity-comparison sites on the classify/grip surfaces are now normalized and pinned.

    Acceptance remaining (not started, needs its own lane): the original 0.10.0 reproduction artifacts were never re-run under the §5 same-binary same-tree protocol; the worktree-mode working-tree read (language/rust.rs ~1600) and merge-ref-vs-branch-tip skew identified as the likely causes of the reported runs remain open behavior questions. If downstream (ub-review) still observes cross-platform divergence on current ripr, that protocol is the next step — this issue should not be reopened for it; file against the protocol recipe in the thread above.

    Claim boundary: static-analysis vocabulary only; no killed/survived claims are made or implied.

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions