Skip to content

bootstrap/src/math_compare.rs is compiled by nothing; its plateau test contradicts its own goldens #2290

Description

@gHashTag

Found while landing the cargo test -p t27c gate for #2288. Not fixed — filing it because the fix is a judgement call about which number is right, and because wiring the file in today would land that gate red.

bootstrap/src/math_compare.rs is compiled by nothing

There is no mod math_compare; anywhere in the crate:

$ grep -rn 'math_compare' bootstrap/src/
bootstrap/src/math_bayes.rs:168:  /// Path to verification data (default: .trinity/experience/math_compare.json)
bootstrap/src/math_bayes.rs:343:  let path = experience_path.unwrap_or_else(|| ".trinity/experience/math_compare.json".to_string());
bootstrap/src/math_bayes.rs:366:  if event.as_str() == Some("math_compare") {
bootstrap/src/math_compare.rs:185:  let path = dir.join("math_compare.jsonl");
bootstrap/src/math_compare.rs:212:  "event": "math_compare",
bootstrap/src/math_compare.rs:331:  .join(".trinity/experience/math_compare.jsonl")

Every hit is a string literal or the file itself. Rust reaches source only through mod declarations, so cargo build, cargo test, and cargo check --workspace --all-targets all skip it. The 10 #[test] functions in it have never been compiled.

It is one of 8 orphan .rs files in bootstrap/srccodegen_python.rs, math_bayes.rs, math_compare.rs, math_pslq.rs, notebook.rs, runtime_minimal.rs, runtime_minimal_test.rs, tooling.rs — and the only one carrying tests.

Built standalone it is 9 pass / 1 fail, and the failing test contradicts the file's own goldens

test_hybrid_v2_plateau (line ~419) asserts:

assert!((n152 - n20).abs() < 1e-9, "N=152 should match N=20");

But GOLDEN_V2 at line 162 of the same file records:

(20,  0.9617435184, 15.8995),
(152, 0.9617435163, 15.8995),

Those two constants differ by 2.100e-9. Recomputing hybrid_v2_cosine independently in IEEE-754 double reproduces the recorded goldens exactly:

N=20   0.961743518402275
N=152  0.961743516301789
|n152 - n20| = 2.100486e-09    tolerance 1e-9    -> FAIL (2.10x over)

So the file asserts a plateau tighter than its own recorded data supports.

Classification: the test is wrong, not the implementation. hybrid_v2_cosine matches all seven GOLDEN_V2 entries, and the sibling golden tests (test_hybrid_v2_golden_n20, ..._n152) pass at their 1e-6 tolerance. The convergence is real; only the 1e-9 plateau bound is unsupported. Pure f64 arithmetic — no fixtures, no network, no binaries.

Deliberately left alone. Per the rule that a wrong test gets reported rather than adjusted, I did not relax the tolerance and did not add mod math_compare;. Adding the mod today would make cargo test -p t27c red, and a gate that lands red gets disabled rather than obeyed (Prop. 26).

What a fix has to decide

  1. Is the intended claim "N=152 equals N=20 to 1e-9"? Then the tolerance is right and the plateau claim is false at that precision — the honest change is to widen to 1e-8 (or assert against the goldens directly) and say so.
  2. Or is 1e-9 a typo for 1e-6, matching every other tolerance in the module?

Either way the module should then be wired in with mod math_compare; so the answer is enforced instead of assumed.

Related, same shape

bootstrap/src/proxy.rs:326 gates its 8 tests behind #[cfg(all(test, feature = "server"))]. No workflow passes --features server or --all-features, so those 8 are stripped before type-checking everywhere. Together with math_compare's 10 they exactly account for the gap between the 913 #[test] attributes in bootstrap/src and the 895 that compile into cargo test -p t27c.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions