V2.10.S2: Build.zig module registry and walk-based discovery
Status: Backlog
Epic: #[github-epic-issue]
Parent roadmap item: V2.10: Build System Consolidation And Qt Build Validation
Labels: type/story, area/platform
Refactor build.zig from its current ~1,766 lines into a <500-line declarative
build script with a module registry, walk-based test discovery, and utility
functions for import resolution and link helper application. No manual copy/paste
of per-file b.createModule + b.addTest blocks — a single registration loop
handles the pattern.
Product Outcome
Developers can add a new Zig test file without touching build.zig (except for
the optional module registry entry). Adding a test file drops from 20+ lines of
manual boilerplate to a zero-line change if the file falls under a declared
discovery path. This removes a structural barrier to community contribution.
User Story
As a developer adding a new Zig module with test {} blocks, I want
build.zig to auto-discover and register it, so that I don't need to read
existing entries, copy boilerplate, and carefully set imports and link helpers
for each of the three test lanes.
Scope
- In scope: create a module registry at the top of
build.zig declaring
~15–20 named modules (name → path + imports).
- In scope: implement a walk function that iterates over
src/tickoni/ paths
with configurable include/exclude glob patterns, sorted alphabetically for
determinism.
- in scope: implement import resolution from the module registry based on the
file's containing directory.
- In scope: implement link helper application by path convention
(e.g., c_abi/* → linkTickoniCodec, tiles/*/mod.zig importing c_abi →
linkTickoniFiredancer).
- In scope: refactor the unit/cov test registration into a single walk loop;
the cov lane reuses unit test artifacts with installArtifact instead of
runArtifact.
- In scope: refactor the integration test lane into a separate walk loop that
creates fresh module instances per lane.
- In scope: preserve
addPlainTestRun for process-mode tests.
- In scope: preserve existing link helper functions unchanged.
- In scope: all existing tests (unit, integration, cov) pass after the refactor.
- Out of scope: changes to CI pipeline structure (
.github/workflows/).
- Out of scope: changes to Firedancer C shim files or build.
- Out of scope: build-time caching or incremental build optimization.
Preconditions And Assumptions
- The current
build.zig at ~1,766 lines has ~1,400 lines (80%) of copy/paste
boilerplate for test declarations across unit, integration, and cov lanes.
- The link helper functions (
linkTickoniCodec, linkTickoniFiredancer,
linkTickoniTopoRun, linkTickoniTileRun) are correctly abstracted but
invoked manually per test step.
build.zig is a Zig build script, not Zig source code — the <500-line target
refers to lines of build script text.
Acceptance Criteria
Conditional Acceptance
Financial capability and policy
Audit and replay
Runtime topology and tile ownership
Model, tool, adapter, or execution boundary
CaseOps API or UI
Storage role: Memory, Analytics, Ledger
Metrics, diagnostics, and operations
Evidence Plan
- Demo or command:
zig build test, zig build test --summary all,
zig build cov, and confirm line count of build.zig.
- Tests: All existing unit, integration, and cov tests pass.
- Fixtures or samples: Module registry declaration.
- Audit/replay evidence: N/A - build script only.
- Blocked-flow evidence: A file outside all discovery paths is ignored without
build failure.
Quality Gate
Notes And Open Questions
- Module registry format:
{ "name", .{ .path = ..., .imports = ... } } vs
inline addModule calls. Spike the more readable option.
- Import resolution: per-directory nearest-module lookup vs per-file override
map. Spike based on how many files need overrides.
- Link helper inference: path-based convention vs explicit metadata on module
declarations. Spike for correctness guarantees.
- Cov lane: reuse unit artifacts with
installArtifact wrapper or separate
walk. Spike for build efficiency.
V2.10.S2: Build.zig module registry and walk-based discovery
Status: Backlog
Epic: #[github-epic-issue]
Parent roadmap item: V2.10: Build System Consolidation And Qt Build Validation
Labels:
type/story,area/platformRefactor
build.zigfrom its current ~1,766 lines into a <500-line declarativebuild script with a module registry, walk-based test discovery, and utility
functions for import resolution and link helper application. No manual copy/paste
of per-file
b.createModule+b.addTestblocks — a single registration loophandles the pattern.
Product Outcome
Developers can add a new Zig test file without touching
build.zig(except forthe optional module registry entry). Adding a test file drops from 20+ lines of
manual boilerplate to a zero-line change if the file falls under a declared
discovery path. This removes a structural barrier to community contribution.
User Story
As a developer adding a new Zig module with
test {}blocks, I wantbuild.zigto auto-discover and register it, so that I don't need to readexisting entries, copy boilerplate, and carefully set imports and link helpers
for each of the three test lanes.
Scope
build.zigdeclaring~15–20 named modules (name → path + imports).
src/tickoni/pathswith configurable include/exclude glob patterns, sorted alphabetically for
determinism.
file's containing directory.
(e.g.,
c_abi/*→linkTickoniCodec,tiles/*/mod.zigimporting c_abi →linkTickoniFiredancer).the cov lane reuses unit test artifacts with
installArtifactinstead ofrunArtifact.creates fresh module instances per lane.
addPlainTestRunfor process-mode tests..github/workflows/).Preconditions And Assumptions
build.zigat ~1,766 lines has ~1,400 lines (80%) of copy/pasteboilerplate for test declarations across unit, integration, and cov lanes.
linkTickoniCodec,linkTickoniFiredancer,linkTickoniTopoRun,linkTickoniTileRun) are correctly abstracted butinvoked manually per test step.
build.zigis a Zig build script, not Zig source code — the <500-line targetrefers to lines of build script text.
Acceptance Criteria
.zigfile undersrc/tickoni/withtest {}blocks, whenzig build testruns, thenbuild.zigdiscovers it via the walk,resolves imports from the module registry, applies the correct link
helpers, and registers the test binary.
build.zigis <500 lines after the refactor.mappings at the top of the file.
alphabetically.
zig build testpasses all existing unit tests.zig build test --summary allpasses all existing integration tests.just test-cov-tk(orzig build cov) passes.@import()calls — module declarationsremain explicit in the registry.
(e.g., skipped with a log message, not crashing the build).
installArtifact— no separatewalk loop for cov.
Conditional Acceptance
Financial capability and policy
build.zig(build script); no policy changes.Audit and replay
build.zig(build script); no audit/replay changes.Runtime topology and tile ownership
build.zig(build script); no topology changes.Model, tool, adapter, or execution boundary
build.zig(build script); no model/adapter/execution changes.CaseOps API or UI
build.zig(build script); no API/UI changes.Storage role: Memory, Analytics, Ledger
build.zig(build script); no storage changes.Metrics, diagnostics, and operations
build.zig(build script); no metrics/telemetry changes.Evidence Plan
zig build test,zig build test --summary all,zig build cov, and confirm line count ofbuild.zig.build failure.
Quality Gate
build.zigline count < 500.zig build testpasses.zig build test --summary allpasses.zig build covpasses.Notes And Open Questions
{ "name", .{ .path = ..., .imports = ... } }vsinline
addModulecalls. Spike the more readable option.map. Spike based on how many files need overrides.
declarations. Spike for correctness guarantees.
installArtifactwrapper or separatewalk. Spike for build efficiency.