Repository navigation
fix(test): stabilize flaky long minified line scale test (#11881) - #11917
Conversation
Hoist ChangedFile construction outside the timed closure so only aligned_counterparts() is measured. When the growth ratio check fails, remeasure once at doubled repetitions before panicking. Add a unit test for the remeasure path; quadratic/cubic controls still fail. 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 22 minutes. View limit details
|
|
Self-review (head Inspected hoisted |
There was a problem hiding this comment.
Decision
- Needs one verification check before upstream.
Verification questions
- Confirm the long-line test now times aligned_counterparts only, but closure selection assumes every non-25,000 token count is the 50,000 case.
Evidence gaps
- No completed late cargo-test receipt is available in the packet, so the seeded local test claims remain unverified by the supplied hosted evidence.
- Model proof intent was rejected by deterministic validation.
- Central test proof for the changed Rust behavior is not yet available.
- Focused cargo-test evidence is not present in this packet: cargo-test is receipt-absent and ripr failed with exit code 2.
|
Merge-ready status: Label applied; head frozen at |
EffortlessSteven
left a comment
There was a problem hiding this comment.
Independent review (fresh-context reviewer, head 77ad673): REVIEW_INCOMPLETE
Inspected:
- Head re-fetched before writing: 77ad673 (base fa621a3). One commit: 77ad673 "fix(test): stabilize flaky long minified line scale test (#11881)".
- State: this PR was merged at 2026-10-31T23:17:50Z as 16d05b4 before this review was written, so this is a post-merge assessment bound to the merged head.
- Changed files (REST pulls/11917/files): crates/ripr/src/analysis/diff/model.rs (+21/-10) and crates/ripr/src/testing/scale.rs (+76/-26).
- Governing issue #11881 ("Flaky wall-clock scale test: a_very_long_line_does_not_pair_by_content fails on loaded hosted runners"). It sets the standing rule that the instrument is fixed rather than the test excluded, offers a deterministic work counter or "take the minimum across more repetitions and retry the comparison once before failing", and says explicitly "Do not widen the factor."
- The diff honours that constraint. The asserted factor at the call site stays 3 and NOISE_ALLOWANCE stays 2ms; growth_within_factor preserves the original predicate large_time <= small_time * factor + NOISE_ALLOWANCE exactly; the fix is the issue's sanctioned retry option, remeasuring once at doubled repetitions before failing. No control was relaxed.
- The model.rs hunk is entirely inside mod tests (the diff header is @@ -1063,31 +1063,42 @@ mod tests {), so no production semantics changed. It hoists the bundle/rebuilt strings and the ChangedFile construction out of the timed region, so the measurement now covers aligned_counterparts() only, which is the defect the issue describes.
- The hoisting is safe against the harness contract: assert_growth_within passes small and large to assert_growth_with_clock, which invokes the work closure only with those two sizes (crates/ripr/src/testing/scale.rs:32-58). The test's
if tokens == 25_000 { &small_file } else { &large_file }branch therefore never sees a third value. - Discriminators: the new one_stalled_large_sample_is_remeasured_before_failing injects a four-fold stall on the large size during the first measurement and asserts the remeasure recovers. Remove the retry logic and the first measurement exceeds the factor, so the assertion fires: it discriminates the changed behavior rather than restating it. The pre-existing controls in the same file still bound the instrument from both directions (cubic_glob_growth_fails, matched_2x_quadratic_work_fails_even_below_the_initial_floor, allowance_boundary_is_inclusive, measurement_just_outside_allowance_fails, zero_measurements_cannot_pass), so the retry cannot be used to smuggle a quadratic path past the guard.
- Hosted evidence at head 77ad673: merge-ready run 41247283658 and CI run 41247283622. I read the four shard JUnit artifacts directly: the candidate's own one_stalled_large_sample_is_remeasured_before_failing ran and passed in shard 3, and the previously flaky analysis::diff::model::tests::a_very_long_line_does_not_pair_by_content ran and passed in shard 4, so both the change under review and the test it stabilizes are green at this exact head.
Blocking:
- The required check "Ripr Rust Small Result" is RED at this head (job 124685375165). The Rust gates job (124673423577) is SUCCESS and shards 2, 3 and 4 are SUCCESS; shard 1 (job 124681125428) fails on exactly one test, analysis::language::python::guard_activation::tests::compare_literal_values_fails_open_on_undecoded_literals at crates/ripr/src/analysis/language/python/guard_activation.rs:1436, and its JUnit carries exactly one failure element with that name. I confirmed the red is inherited and not attributable to this diff: the base SHA fa621a3 has a directly comparable lane, run 41243698892 job 124662661026, whose log shows the same single failure at the same file and line, and the base file content at that line is the identical compare_literal_values("None", "!=", "0") assertion. The python red was fixed on main by #11918 (a5c3ba4, merged 23:08:59Z), which is not in this PR's merge base, so a merge onto current main would not reproduce it. The required check is nevertheless red at the reviewed head, so the disposition cannot be REVIEW_READY.
- No Rust lane has run this candidate against a base that contains the python fix, so there is no green head qualification for this exact diff; the green evidence for it is the shard 3 and shard 4 lanes described below.
Non-blocking:
- MEASUREMENT_PASS is a process-global AtomicU32 used as a per-test control flag, and assert_measured_growth resets it to 0 on entry from several callers in this file and from the model.rs long-minified test. In a harness that shares one process across tests, a concurrent call that starts between this test's store(1) and the end of its remeasure would re-inject the stall and make the test fail spuriously. The failure mode is fail-closed (a spurious failure, never a false pass), the qualification lanes use nextest with one process per test so they are not exposed, and only the cargo test based Rust-only feature lane shares a process. The CI nextest profile also sets retries = 0, so a spurious failure there would fail a lane outright. Threading a per-call flag through the closure would remove the shared state.
- The remeasure adds one extra batch of RUNS samples at doubled repetitions on the failing path, so a failing guard costs roughly three times the sampling of a passing one. A passing run is unchanged in cost.
- The model.rs fixture now substitutes the large fixture for any token count other than 25_000. That is safe today because the harness only ever calls the closure with small and large, but it would silently use the wrong fixture for a future third size instead of failing.
- The PR body says the hosted run "failed on inherited compare_literal_values_fails_open_on_undecoded_literals on main (reproduced locally)". The attribution is correct and I confirmed it independently, but the wording is loose: the failure is inherited from a stale merge base, not a property of current main, which already carries the #11918 fix.
- No changelog fragment accompanies this diff. check-changelog-fragments validates the form of the fragments that exist rather than requiring one per change, and this diff changes no user-facing behavior, so I am not raising it as a gap.
Not run:
- This review host has no Rust toolchain: rustc, cargo and rustup are all absent from PATH. Nothing was built, compiled, formatted, linted or tested locally. cargo fmt --check, cargo clippy, cargo xtask precommit, the testing::scale guards and every local cargo xtask gate were NOT run by this review.
- The hosted shard 1 lane is red for the inherited python test, so the full suite was not green at this head; shards 2, 3 and 4 are green.
- The behavior of the scale guards under a genuinely loaded runner is not established by this review. The fix is validated by the injected-stall unit test and by one green run of the previously flaky test, not by repeated execution under load; the PR body reports a local 20-iteration run that I did not reproduce.
- No runtime or mutation execution was performed. Every exposure statement here is static, and no claim is made about runtime mutation outcomes or test-suite sufficiency.
- No repository file was modified and no HEAD-moving git command was run.
Reviewed by an independent Mavis review agent on behalf of the maintainer; bound to head 77ad67365f61a88064defe953060213d61be2fc0. Not an approval.
Summary
Fixes flaky wall-clock failure in
a_very_long_line_does_not_pair_by_contentby measuring onlyaligned_counterparts()(strings/ChangedFilebuilt outside the timed work) and remeasuring once at doubled repetitions when the growth ratio check fails.Governing issue or accepted claim: #11881
Acceptance delta (one sentence): The long minified-line scale regression test no longer attributes string allocation or a single scheduling stall to superlinear diff alignment growth.
Closes #11881
Proof
cargo test -p ripr --lib scale::testsincluding remeasure + quadratic/cubic controlsa_very_long_line_does_not_pair_by_content×20 locallycargo xtask precommiton77ad67365fHosted qualification
merge-readyapplied. Run 41247283658 failed on inheritedcompare_literal_values_fails_open_on_undecoded_literalson main (reproduced locally); not this diff.Candidate SHA:
77ad67365f