Skip to content

tests: sample the lower-feed shape bound robustly - #644

Closed
luisleo526 wants to merge 1 commit into
mainfrom
tests/lower-feed-ratio-sampling
Closed

luisleo526 wants to merge 1 commit into
mainfrom
tests/lower-feed-ratio-sampling

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

Makes the lower-feed shape-bound check in test_native_intrabar_lower_lookup robust to a noisy shared runner without weakening it.

The test compares a 4x-bars run against a base run and asserts the ratio stays under the fixed shape bound (6.0, unchanged). One measured run on a shared runner exceeded it by 1.3% while the same test passed elsewhere in the same CI run. The check now takes the best of N samples per arm, plus a bounded re-measure (tests/ratio_timing.hpp), so a single noisy sample cannot fail it. A real super-linear cost still fails: fixed-sample rows include a persistent-high pair that must still fail and a quadratic pair that must not be retried into a pass.

Test sources only.

🤖 Generated with Claude Code

…rline one once

test_native_intrabar_lower_lookup compares the time of a 4x lower feed with a 6.0 bound.
On a shared CI runner each leg is the best of three samples with independent scheduler
noise, so a true ratio near 4 occasionally read 6.08 and failed main's post-merge run once
(4000 bars 0.1140 s, 16000 bars 0.6934 s), then passed on a re-run.

Take the best of five user-CPU samples per leg, and give a ratio in [6, 12) exactly one
fresh measured pair, keeping the smaller ratio. A ratio of 12 or more (a quadratic lookup
measures about 16) is judged as measured with no retry, and the bound stays 6.0 with
CHECK(ratio < kShapeBound) as the only verdict, so a persistently high ratio still fails.

The decision is a small header-only helper in tests/ratio_timing.hpp, exercised inside the
same test binary on fixed sample sets: the observed noisy pair with a quiet re-measure
passes, the same pair with a high re-measure still fails, a quadratic pair is not retried,
and a clean linear pair is not retried.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Tightens the lower-feed linearity timing test against shared-runner noise: each leg now takes the best of five user-CPU samples instead of three, and ratio_with_remeasurement gives a ratio in [6, 12) one fresh measured pair and keeps the smaller of the two ratios. A ratio at or above 12 fails without a retry, and a passing ratio stands as measured, so a real quadratic regression is still caught. The retry path takes the lower ratio and treats a zero small-leg time as ratio 0, which is the spot where a bad retry measurement could slip under the bound.

Worth a look

  • Degenerate retry (small==0) yields ratio 0 and silently passes the bound — tests/ratio_timing.hpp:47 · Escalate · medium
    • NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 46 functions depend on the 46 functions this change touches.

Health — grade A; 1 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • main() — 0 callers, 6 callees (medium)

Verification — 46 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 46 function(s) in the blast radius were not formally verified this run

@luisleo526

Copy link
Copy Markdown
Collaborator Author

Superseded by #647 (same change on current main, folded with its sibling). Branch kept.

@luisleo526 luisleo526 closed this Oct 30, 2026
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