Skip to content

BUG: zig build test runs zero unit tests — test root src/main.zig has no test block (suite bitrotted, 15 compile errors on wiring) #88

Open

Description

@vernonstinebaker

Summary

zig build test reports success while running zero unit tests. The suite has never been wired to the build's test root, so CI has been green on an empty suite.

Reproduction

zig build test -Dembed-ui=false -Dbuild-ui=false --summary all
Build Summary: 4/4 steps succeeded
+- run test success 1ms MaxRSS:4M

Note the absence of a N/N tests passed count — nothing was executed. For comparison, tests/test_backend.sh reports 12/12 tests passed for its integration target.

Root cause

  • build.zig:79 declares the unit-test root as src/main.zig.
  • src/main.zig contains zero test { … } blocks.
  • src/root.zig:56 contains the expected test { _ = …; } block referencing the module tree (server, orchestrator, paths, registry, state, wizard_api, …), but it is never reached, because nothing in the test root imports it from a test scope.

Result: the test binary compiles main.zig and runs an empty set.

Scope of what is silently skipped

62 files under src/ contain test declarations. Examples: src/server.zig (72), src/core/launch_args.zig (13), src/core/integration.zig (5).

Impact

Wiring the root exposes bitrot (15 compile errors)

Adding the obvious one-line fix to src/main.zig:

test {
    _ = @import("root.zig");
}

…does not simply start passing — the dormant suite fails to compile:

compile test Debug native 15 errors
src/supervisor/health.zig:184  error: expected type '…ThreadCtx', found '…__struct_461448'
src/discovery.zig:62           error: root source file struct 'fmt' has no member named 'formatIntBuf'
src/discovery.zig:125          error: no field named 'config' in struct 'core.manifest.Manifest'
src/installer/downloader.zig:184  error: no field or member function named 'metadata' in 'compat.fs.File'
src/managed_skills.zig:263     error: no field or member function named 'realpathAlloc' in 'Io.Dir'
… (10 more)

These are stdlib/API drift (std.fmt.formatIntBuf, Io.Dir.realpathAlloc) and struct-shape changes that landed after the tests were last compiled. This is almost certainly why the gap went unnoticed: since the root was never wired, nothing ever compiled the suite.

Suggested path

  1. Wire the test root (one line in src/main.zig, or point build.zig:79 at src/root.zig).
  2. Fix the 15 compile errors (stdlib/API migration + struct-shape updates), or land it incrementally with a per-module allowlist so the gate is real from day one.
  3. Once wired, require a non-zero test count in CI so an empty suite can never again report success.

Context

Found while reviewing #84, which correctly notes this predates that PR. Not a regression from any open change.

Metadata

Metadata

Assignees

No one assigned

    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