Skip to content

Make zig-physics build; 0 tests were running out of 640 - #4

Merged
gHashTag merged 4 commits into
mainfrom
make-it-build
Aug 11, 2026
Merged

Make zig-physics build; 0 tests were running out of 640#4
gHashTag merged 4 commits into
mainfrom
make-it-build

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

The state this repository was in

87 source files, 640 test blocks, no workflow of any kind, and a
manifest that was not ZON:

build.zig.zon:1:7: error: expected ';' after statement
{.name: "zig-physics", version: "0.1.0", dependencies: {}}
      ^

That is JSON. zig build stopped at line 1, column 7, so no compiler had
ever reached a single one of the 87 files.

What was underneath

Fixed in order, each one revealed by fixing the one before it:

  1. Manifest — rewritten as ZON, with the .fingerprint Zig requires
    (it proposed the value itself).
  2. b.build_root_path — no such field; it is b.build_root.path. The
    line sat inside if (…) |x| else |_| {}, so had it compiled, a failure
    would have been swallowed silently.
  3. Two unused locals in build.zig — both addModule results discarded.
  4. addTest — took .root_source_file; since 0.15 it takes
    .root_module.
  5. The existence guard — nine modules were declared inside an
    inline for that checked whether each file existed and silently skipped
    the ones that did not. All nine exist, so it protected nothing; it only
    guaranteed that a module going missing would stop being exported without
    anybody being told. Declared directly instead.
  6. Fossil syntax in quantum/e8_integration.zigextern enum(c_int),
    export const on types, two-argument @ptrCast(*T, x), and four-argument
    expectApproxEqAbs(f64, …). None of these have existed in the language
    since roughly 0.11.

The part that matters

After all of that, zig build test passed — running zero tests:

$ zig test src/root.zig
All 0 tests passed.

Every domain root says pub const formulas = @import("formulas.zig"); and
nothing references it. Zig analyses a top-level declaration only when
something does, so those files were never part of the compilation and their
test blocks did not exist. 640 of them.

Adding one reference per import — test { _ = formulas; } — changes the
measurement:

before:  All 0 tests passed.
after:   253 passed; 1 skipped; 0 failed.   (254 reachable)

The one failure

test "Barbero-Immirzi prediction" failed the moment it could run.
quantumProjection can only ever return 0.436992, 0.618034 or 1.236068,
because |c[4]| + |c[5]| is 0, 1 or 2 for every E8 root — while the physical
value is 0.2375. The only value inside the asserted range is the fallback
branch taken when the projection has no input.

Filed as #3 and marked skipped with a pointer, not deleted and not relaxed:
the assertion is the correct physics and the projection is what has to
change. Fixing it means choosing a mapping, and any mapping I chose would be
fitted to the assertion it had to satisfy.

Not fixed here

src/plasma/ has no formulas.zig (#2) — the only domain without one. Its
root.zig exports nothing but testValues, which imports the missing file,
so the module has never had an implementation. The re-export is commented out
with the reason; writing the formulas from test_values.zig would produce a
model that agrees with its own test by construction.

CI

Three steps: zig build, zig build test, and a guard that fails when fewer
than 200 tests run. The third exists because this repository proves that a
suite running nothing also exits 0.

The manifest was JSON, so nothing had ever compiled. Underneath that:
a nonexistent Build field, a silent module-existence guard, pre-0.11
syntax, and a test suite that ran zero of its 640 blocks because every
import declaration was unreferenced.
It called zig test directly, bypassing link_libc, so on Linux it saw a
compile failure instead of a count and declared the suite empty while
the suite was green. A guard measuring with a different instrument than
the thing it guards reports on the instrument.
@gHashTag
gHashTag merged commit 83f7529 into main Aug 11, 2026
2 checks passed
@gHashTag
gHashTag deleted the make-it-build branch August 11, 2026 23:30
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