-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
2657 lines (2516 loc) · 130 KB
/
Copy pathbuild.zig
File metadata and controls
2657 lines (2516 loc) · 130 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const std = @import("std");
const builtin = @import("builtin");
const codegen_corpus = @import("tests/etch_interp/codegen_corpus_build.zig");
pub fn build(b: *std.Build) void {
comptime {
if (builtin.zig_version.major != 0 or builtin.zig_version.minor != 16) {
@compileError(std.fmt.comptimePrint(
"Weld requires Zig 0.16.x, got {d}.{d}.{d}",
.{ builtin.zig_version.major, builtin.zig_version.minor, builtin.zig_version.patch },
));
}
}
// There is NO root binary: the engine is consumed as a lib + tools. The
// demonstration is the standalone `examples/triangle/` sub-project, which
// owns the windowing CLI and documents its own flags.
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Shared `weld_core` module — Tier 0 internals consumed by the runtime,
// the bench harness, and every test executable.
//
// `b.addModule` (instead of `b.createModule`) so the module is reachable
// by the standalone `examples/triangle/` sub-project via
// `b.dependency("weld", ...).module("weld_core")`. Tier 0
// `platform.window` is the public window API the triangle binary
// consumes to open its Vulkan-ready window — same rationale as
// `weld_render` exposed below.
const core_module = b.addModule("weld_core", .{
.root_source_file = b.path("src/core/root.zig"),
.target = target,
.optimize = optimize,
// Generated Vulkan + Wayland bindings use `extern "c"` for the
// dlopen/dlsym wrapper on POSIX hosts. Linking libc satisfies the
// resolver; on Windows the same code path takes the kernel32
// branch and libc is not actually referenced.
.link_libc = true,
});
// Shared `weld_etch` module — parser + type-checker + tree-walking
// interpreter (foundation submodule per `engine-directory-structure.md`
// §9.1). Etch is not a Tier 1 module; it is conceptually a foundation
// submodule and ships as its own top-level public surface under
// `src/etch/root.zig`. The interpreter pulls in `weld_core` to drive
// the runtime registry / dynamic archetype / resource store.
const etch_module = b.createModule(.{
.root_source_file = b.path("src/etch/root.zig"),
.target = target,
.optimize = optimize,
});
etch_module.addImport("weld_core", core_module);
// `weld_audio` module exposes the Tier 1 audio module entry
// (the Dummy backend is what exists; no real backend does). Consumed by the
// audio tests and, later, by the runtime once the audio strategy
// selection wires in.
const audio_module = b.createModule(.{
.root_source_file = b.path("src/modules/audio/root.zig"),
.target = target,
.optimize = optimize,
});
// `weld_render` module exposes the Render Tier 1 module entry,
// starting with the GAL (GPU Abstraction Layer) public surface and
// the `Null` + `Vulkan` backends. Consumed by `tests/render/*.zig`
// and, eventually, by the runtime + `examples/triangle/` standalone
// sub-project.
//
// Imports `weld_core` because the Vulkan backend uses
// `weld_core.platform.vk` (binding generated by `tools/bindgen`).
// `b.addModule` (instead of `b.createModule`) registers the module
// in `b.modules` and makes it consumable by dependents via
// `b.dependency("weld", ...).module("weld_render")` — a prerequisite of
// the `examples/triangle/` sub-project.
const render_module = b.addModule("weld_render", .{
.root_source_file = b.path("src/modules/render/root.zig"),
.target = target,
.optimize = optimize,
});
render_module.addImport("weld_core", core_module);
// `foundation` module: transversal sibling submodules
// (math, simd). Ships `simd` (batched-SIMD kernels; `adler32` inaugural).
// Imports nothing but std (engine-simd.md §4). Consumed by
// `asset_pipeline` (zlib ADLER32 trailer check), the simd tests, and the
// adler32 bench.
const foundation_module = b.addModule("foundation", .{
.root_source_file = b.path("src/foundation/root.zig"),
.target = target,
.optimize = optimize,
});
// Tier 0 gains a `foundation` dep. `foundation` imports nothing
// but std, so the graph stays acyclic (`ARCH-016`) and this is the shared
// bottom layer depending downward, not sideways. What makes the dep
// load-bearing rather than convenient: the float environment is ASSERTED by
// `forge_3d`, `forge_3d` may not import `weld_core` (a C1.1 exit metric), so
// the single owner of the register layout has to be reachable from
// `foundation` — and `core/jobs/scheduler.zig`, which creates threads, reads
// `foundation.math.float_env` from there.
core_module.addImport("foundation", foundation_module);
// `ARCH-031` rule 5: the shader hot-reload watcher creates a thread,
// so it must INSTALL the float environment. It reaches the single definition
// in `foundation/math/float_env.zig` directly, and NOT through a re-export
// across a tier boundary: a re-export adds a name without adding a
// definition, and the register layout has exactly one owner.
render_module.addImport("foundation", foundation_module);
// `weld_asset_pipeline` module: the Tier 1 Asset Pipeline. The on-disk
// surfaces it ships are FROZEN — the intermediate `<type>.asset.etch` schema
// and the runtime `.<type>.bin` 40-byte header — alongside the `AssetHandle`
// and the slot registry (refcount + generation invalidation). `weld_core`
// serves the async loader, which consumes the Tier 0 job system;
// `foundation` serves the DEFLATE/zlib codec, which verifies the ADLER32
// trailer via `foundation.simd.adler32`.
const asset_pipeline_module = b.createModule(.{
.root_source_file = b.path("src/modules/asset_pipeline/root.zig"),
.target = target,
.optimize = optimize,
});
asset_pipeline_module.addImport("weld_core", core_module);
asset_pipeline_module.addImport("foundation", foundation_module);
// `weld_forge` public API surface: Forge ECS component types
// (`engine-physics-forge.md` §2) + physics descriptor/handle types
// (`engine-tier-interfaces.md` §1). Imports `foundation` (math types) and
// `weld_core` (re-exports `core.ecs.components.Velocity` +
// `core.ecs.EntityId`). Rooted at `api/root.zig` and TYPES ONLY: the module
// that instantiates the physics module is a separate one, `forge_module`
// below, rooted at `forge/module.zig`. The `forge_3d` solver depends on this
// module.
const forge_api_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/api/root.zig"),
.target = target,
.optimize = optimize,
});
forge_api_module.addImport("foundation", foundation_module);
forge_api_module.addImport("weld_core", core_module);
// `physics_f64` build option (default false → `Real = f32`).
// `-Dphysics_f64=true` flips forge_3d to double precision (large worlds).
// Exposed to forge_3d as the `build_options` module read by `config.zig`.
const physics_f64 = b.option(bool, "physics_f64", "Build forge_3d in f64 (double) precision (default f32)") orelse false;
const forge_build_options = b.addOptions();
forge_build_options.addOption(bool, "physics_f64", physics_f64);
// `forge_3d` native 3D solver skeleton. Depends only on
// `foundation` (math) and `weld_forge` (the api surface; core entity types
// reach it through api/), plus the `build_options` for the `Real` scalar.
const forge_3d_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/forge_3d/root.zig"),
.target = target,
.optimize = optimize,
});
forge_3d_module.addImport("foundation", foundation_module);
forge_3d_module.addImport("weld_forge", forge_api_module);
forge_3d_module.addOptions("build_options", forge_build_options);
// `forge/sync.zig`, the ECS <-> solver seam. It is the ONE module
// that sees both sides: `weld_core` for the World and the `Transform`, `weld_forge`
// for the physics components, and `forge_3d` for `PhysicsWorld`. `forge_3d` itself
// keeps its two-import discipline and never learns about the ECS.
const forge_sync_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/sync.zig"),
.target = target,
.optimize = optimize,
});
forge_sync_module.addImport("weld_core", core_module);
forge_sync_module.addImport("weld_forge", forge_api_module);
forge_sync_module.addImport("forge_3d", forge_3d_module);
forge_sync_module.addImport("foundation", foundation_module);
// `forge/module.zig`, the `Forge3DModule` adapter. Same import set
// as `forge_sync`: `weld_core` for `ModuleContext`, `weld_forge` for the frozen
// descriptor and query types, `forge_3d` for `PhysicsWorld` and the query family.
// `forge_3d` keeps its two-import discipline and never learns about the ECS.
const forge_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/module.zig"),
.target = target,
.optimize = optimize,
});
forge_module.addImport("weld_core", core_module);
forge_module.addImport("weld_forge", forge_api_module);
forge_module.addImport("forge_3d", forge_3d_module);
forge_module.addImport("foundation", foundation_module);
// `src/interfaces/PhysicsModule.zig`, the Tier 1 physics interface and the first file
// of `src/interfaces/`. FROZEN: it carries
// `WELD_PHYSICS_PROTOCOL_VERSION` and the comptime surface guard over the thirty-two
// entries, plus the three body pose/velocity contracts moved out of
// `forge/api/types.zig`. It needs `weld_forge` for the descriptor and query types and
// `weld_core` for `ModuleContext`, which the guard's first entry names.
const interfaces_physics_module = b.createModule(.{
.root_source_file = b.path("src/interfaces/PhysicsModule.zig"),
.target = target,
.optimize = optimize,
});
interfaces_physics_module.addImport("weld_forge", forge_api_module);
interfaces_physics_module.addImport("weld_core", core_module);
// plugin loader ABI module shared with the stub
// plugin sub-projects under `tests/core/plugin_loader/stub_plugin/`.
// Exposes the C ABI types from `desc.zig` (no `WeldAPI` itself,
// just the declarations the stubs need: `WeldPluginDesc`,
// `WeldStr`, etc.). Case 3 decision — cross-import via a shared
// module rather than duplicating the types in each stub.
const plugin_loader_abi_module = b.createModule(.{
.root_source_file = b.path("src/core/plugin_loader/desc.zig"),
.target = target,
.optimize = optimize,
});
// stub plugin libraries, dynamic linkage. Each
// produces `lib<name>.so` (Linux), `lib<name>.dylib` (macOS),
// or `<name>.dll` (Windows). Installed under `zig-out/lib/`
// (POSIX) or `zig-out/bin/` (Windows) so the load_unload_test
// can find them at known paths.
const StubSpec = struct {
name: []const u8,
root: []const u8,
};
const stub_specs = [_]StubSpec{
.{ .name = "weld_stub_plugin_happy", .root = "tests/core/plugin_loader/stub_plugin/plugin.zig" },
.{ .name = "weld_stub_plugin_future", .root = "tests/core/plugin_loader/stub_plugin/plugin_future_api.zig" },
.{ .name = "weld_stub_plugin_legacy", .root = "tests/core/plugin_loader/stub_plugin/plugin_legacy_api.zig" },
.{ .name = "weld_stub_plugin_no_entry", .root = "tests/core/plugin_loader/stub_plugin/plugin_no_entry.zig" },
};
var stub_install_steps: [stub_specs.len]*std.Build.Step = undefined;
for (stub_specs, 0..) |spec, i| {
const stub_module = b.createModule(.{
.root_source_file = b.path(spec.root),
.target = target,
.optimize = optimize,
});
stub_module.addImport("weld_plugin_abi", plugin_loader_abi_module);
const stub_lib = b.addLibrary(.{
.name = spec.name,
.linkage = .dynamic,
.root_module = stub_module,
});
const stub_install = b.addInstallArtifact(stub_lib, .{});
stub_install_steps[i] = &stub_install.step;
}
const stub_plugins_step = b.step(
"stub-plugins",
"Build the three stub plugin libraries used by the plugin_loader tests",
);
for (stub_install_steps) |s| stub_plugins_step.dependOn(s);
// Shaders embedding — shared by the editor + runtime binaries for
// the viewport blit, and by `examples/triangle/` for the
// triangle.vert/frag SPIR-V. The `.spv` live under `assets/shaders/`.
// `b.addModule` (instead of `b.createModule`) so the standalone
// sub-project consumes it via `b.dependency("weld", ...).module("shaders")`.
const shaders_module = b.addModule("shaders", .{
.root_source_file = b.path("assets/shaders/embed.zig"),
.target = target,
.optimize = optimize,
});
// `zig build run-example-triangle` invokes the standalone
// `examples/triangle/` sub-project via a `zig build run` subprocess.
// It is the living architectural test of external consumability.
const ex_run = b.addSystemCommand(&.{
b.graph.zig_exe,
"build",
"run",
});
ex_run.setCwd(b.path("examples/triangle"));
if (b.args) |args| {
ex_run.addArg("--");
ex_run.addArgs(args);
}
const ex_step = b.step("run-example-triangle", "Build & run the triangle example sub-project");
ex_step.dependOn(&ex_run.step);
// `zig build verify-synth-100` builds the standalone
// `bench/fixtures/synth_100/` sub-project: a
// real path-dep package that cooks the committed corpus through the
// parent's `etch_cook` artifact and compiles it against
// `weld.module("weld_core")`. A nested cold build — kept OUT of the
// default `zig build test` (its own CI step, like the triangle).
const synth_verify = b.addSystemCommand(&.{
b.graph.zig_exe,
"build",
});
synth_verify.setCwd(b.path("bench/fixtures/synth_100"));
const synth_verify_step = b.step("verify-synth-100", "Build the synth_100 sub-project (nested zig build — the standalone proof)");
synth_verify_step.dependOn(&synth_verify.step);
// `zig build ecs-access-counterproof` drives the declared-access corpus in
// `tests/core/ecs/access_counterproof/` — the first harness in this
// repository that asserts a COMPILATION FAILURE.
//
// **It matches the diagnostic text and never the exit code**, because a
// build that dies before the guard is reached exits exactly like one the
// guard stops. Each case therefore carries two checks: the expected exit,
// which says something failed, and a substring unique to that case, which
// says WHAT failed. The substrings are distinct across cases on purpose —
// matching only the shared refusal marker would let any one case stand in
// for any other.
//
// The control runs in the SAME step and must SUCCEED. Without it the three
// refusals prove nothing: a view that refused every access would satisfy
// all three.
const counterproof_dir = "tests/core/ecs/access_counterproof";
const CounterproofCase = struct {
step: ?[]const u8,
marks: []const []const u8,
};
const counterproof_cases = [_]CounterproofCase{
// The control: `zig build` with no step argument, which this
// sub-project wires to the one fixture that must compile.
.{ .step = null, .marks = &.{} },
.{
.step = "case-undeclared",
.marks = &.{"weld-access-refused: this system attempts a read of component"},
},
.{
.step = "case-mutable-on-read",
.marks = &.{"weld-access-refused: this system attempts a write to component"},
},
.{
// The compiler's own message, not the view's marker: the pairing is
// refused at the SIGNATURE, so nothing here ever reaches an access
// test. Its predecessor omitted the `accesses` field and matched
// `missing struct field: accesses` — which measured that Zig
// refuses a literal missing a field without a default, a fact that
// owed nothing to this milestone and guarded nothing.
.step = "case-mismatched-pair",
.marks = &.{"expected type 'fn (ecs.scheduler.SystemContextOf"},
},
.{
// Also the compiler's, and for a stronger reason: the promotion is
// refused at the TYPE, before any access test can run. A refusal
// carrying the view's marker would mean the second view had been
// built and was objecting afterwards.
.step = "case-view-promotion",
.marks = &.{"expected type '*ecs.view.ErasedFor"},
},
.{
// The job bound, and the mark is the MARKER'S OWN TEXT rather than
// the refusal's frame — which is what says the reason travelled and
// not merely that something was refused.
.step = "case-erased-in-job",
.marks = &.{"the erased world a view is rebuilt from"},
},
.{
// The same bound reached through a FIELD. **The mark deliberately
// avoids the message's tail**, which today reads `no reason
// declared`: `reasonOf` walks only pointers and optionals where
// `carriesMarkedIn` enters everything, so a marker reached through a
// field refuses correctly and explains nothing. That asymmetry is a
// debt this milestone named and left to the bound's owner, and a
// fixture anchored on its message would go red the day it is
// repaired — asserting on a defect's symptom is how a repair gets
// read as a regression. The type name is what identifies this case.
.step = "case-erased-wrapped-in-job",
.marks = &.{"Carrier` reaches a dispatched body"},
},
};
const counterproof_step = b.step(
"ecs-access-counterproof",
"Assert the six declared-access refusals fire, and that legitimate code still compiles",
);
for (counterproof_cases) |case| {
const run = if (case.step) |name|
b.addSystemCommand(&.{ b.graph.zig_exe, "build", name })
else
b.addSystemCommand(&.{ b.graph.zig_exe, "build" });
run.setCwd(b.path(counterproof_dir));
// ALWAYS RE-RUN, and this is not a precaution. A `Run` step with no file
// argument is cached on its argv alone, and `setCwd` does not make the
// directory's contents an input — so the first version of this harness
// replayed a cached success and reported GREEN against a deliberately
// disabled guard. The verdict of a harness that cannot observe the code
// it judges is worth nothing, and it looks exactly like a verdict that is.
run.has_side_effects = true;
if (case.step == null) {
run.expectExitCode(0);
} else {
run.expectExitCode(1);
for (case.marks) |mark| run.addCheck(.{ .expect_stderr_match = mark });
}
counterproof_step.dependOn(&run.step);
}
const shader_compiler_module = b.createModule(.{
.root_source_file = b.path("tools/shader_compiler/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
const sp_compiler_module = b.createModule(.{
.root_source_file = b.path("src/modules/render/shader_pipeline/compiler.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
shader_compiler_module.addImport("shader_pipeline_compiler", sp_compiler_module);
const shader_compiler_exe = b.addExecutable(.{
.name = "shader_compiler",
.root_module = shader_compiler_module,
});
const shaders_run = b.addRunArtifact(shader_compiler_exe);
const shaders_step = b.step("shaders", "Regenerate .spv files from .glsl sources via glslc");
shaders_step.dependOn(&shaders_run.step);
const shaders_check_run = b.addRunArtifact(shader_compiler_exe);
shaders_check_run.addArg("--check");
const shaders_check_step = b.step("shaders-check", "Verify .spv on disk matches a fresh glslc regen");
shaders_check_step.dependOn(&shaders_check_run.step);
// `zig build vk-gen-check`: regenerates vk.zig and verifies that
// the diff vs the commit is empty. Delegated to the existing `bindgen-verify`
// which covers all generated bindings.
const vk_gen_check_step = b.step("vk-gen-check", "Verify vk.zig matches a fresh bindgen regen (delegates to bindgen-verify)");
if (b.top_level_steps.get("bindgen-verify")) |bv| {
vk_gen_check_step.dependOn(&bv.step);
}
// -------------------------------------------------------------- Tests --
const test_step = b.step("test", "Run all tests");
// Inline tests living next to the core code.
const core_tests = b.addTest(.{ .root_module = core_module });
test_step.dependOn(&b.addRunArtifact(core_tests).step);
// Same-file tests inside src/etch/*.zig.
const etch_tests = b.addTest(.{ .root_module = etch_module });
test_step.dependOn(&b.addRunArtifact(etch_tests).step);
// inline tests inside src/modules/asset_pipeline/**. The module
// root re-exports format/ and registry/, so every sub-file is reachable
// and its inline tests run (engine-zig-conventions.md §13).
const asset_pipeline_tests = b.addTest(.{ .root_module = asset_pipeline_module });
test_step.dependOn(&b.addRunArtifact(asset_pipeline_tests).step);
// inline tests inside src/foundation/** (traits + kernels).
// simd/root.zig re-exports traits/portable/dispatch/kernels, so they are all
// reachable and analysed (engine-zig-conventions.md §13).
const foundation_tests = b.addTest(.{ .root_module = foundation_module });
test_step.dependOn(&b.addRunArtifact(foundation_tests).step);
// inline tests inside src/modules/forge/api/** (component
// size/align asserts, descriptor + component defaults, Velocity re-export
// identity, BodyId pack/unpack). The api root re-exports components/ +
// types/, so their inline tests are reachable (engine-zig-conventions.md §13).
const forge_api_tests = b.addTest(.{ .root_module = forge_api_module });
test_step.dependOn(&b.addRunArtifact(forge_api_tests).step);
// forge_3d solver unit tests (C1.1 verification path): the
// inline tests in config/shape/body/body_manager + the acceptance suite
// under forge_3d/tests/. root.zig pins them all. Added to
// `zig build test`; `zig build test-forge-3d` runs just these.
const forge_sync_tests = b.addTest(.{ .root_module = forge_sync_module });
test_step.dependOn(&b.addRunArtifact(forge_sync_tests).step);
const forge_module_tests = b.addTest(.{ .root_module = forge_module });
test_step.dependOn(&b.addRunArtifact(forge_module_tests).step);
// the interface file's own tests: the attestation that no protocol
// version is declared yet, and that the three signatures follow the world scalar.
const interfaces_physics_tests = b.addTest(.{ .root_module = interfaces_physics_module });
test_step.dependOn(&b.addRunArtifact(interfaces_physics_tests).step);
const forge_3d_tests = b.addTest(.{ .root_module = forge_3d_module });
const forge_3d_tests_run = b.addRunArtifact(forge_3d_tests);
test_step.dependOn(&forge_3d_tests_run.step);
const forge_3d_test_step = b.step("test-forge-3d", "Run only the forge_3d solver tests");
forge_3d_test_step.dependOn(&forge_3d_tests_run.step);
// `zig build forge-determinism`: the determinism instrument, run
// at ONE worker over the canonical scenario. The step is deliberately an
// EXECUTABLE over a library (`tests/determinism/run.zig`) rather than a
// test, because it gets REPLAYED — at N workers, and on a rebuilt scheduler
// DAG — and a harness whose logic lived in its `main` would have to be
// re-entered through a process to be replayed at all. Its self-reproducibility and its artifact
// liveness are ALSO asserted inside `zig build test`, where the same library
// is exercised by `forge_3d`'s own suite.
//
// Its module carries the same imports as `forge_3d` itself because its root
// reaches the solver by relative path, exactly as the acceptance suite does.
const forge_determinism_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/forge_3d/determinism_main.zig"),
.target = target,
.optimize = optimize,
});
forge_determinism_module.addImport("foundation", foundation_module);
forge_determinism_module.addImport("weld_forge", forge_api_module);
forge_determinism_module.addOptions("build_options", forge_build_options);
const forge_determinism_exe = b.addExecutable(.{
.name = "forge-determinism",
.root_module = forge_determinism_module,
});
const forge_determinism_run = b.addRunArtifact(forge_determinism_exe);
if (b.args) |args| forge_determinism_run.addArgs(args);
const forge_determinism_step = b.step(
"forge-determinism",
"Run the canonical determinism scenario at one worker",
);
forge_determinism_step.dependOn(&forge_determinism_run.step);
// `zig build forge-asm-inventory`: the conformance test of
// `ARCH-031` rule 4, read in the EMITTED ASSEMBLY rather than in the source.
// `forge_3d` is compiled to assembly for the three targets the engine ships
// and every call site is inspected for a libm transcendental.
//
// The scanner is `tools/asm_inventory/` — a Zig program, not `grep`. Named
// substitution: the check has to anchor on the instruction mnemonic at line
// start, and the natural `\b` for that is a GNU extension that silently
// matches NOTHING on BSD grep. A scanner removes the class instead of
// dodging one instance of it, and it carries its own counter-factuals.
//
// A DEDICATED step and NOT part of `zig build test`: three cross-compiles
// of the whole physics module are minutes of work, `test` runs twice on
// every `git push` through the pre-push hook, and the answer is a property
// of the three TARGETS — it does not vary with the host that asks. So CI
// invokes it on one cell, exactly as it already does for
// `verify-synth-100`. The scanner's own tests are in `zig build test`.
const asm_inventory_module = b.createModule(.{
.root_source_file = b.path("tools/asm_inventory/main.zig"),
.target = b.graph.host,
.optimize = .ReleaseSafe,
});
const asm_inventory_exe = b.addExecutable(.{
.name = "asm_inventory",
.root_module = asm_inventory_module,
});
const asm_inventory_run = b.addRunArtifact(asm_inventory_exe);
// The three targets of the determinism contract: the two OSes of level 1
// and the ISA of level 2 (`engine-phase-1-criteria.md` C1.1). Each is
// pinned to `baseline` for the same reason every CI cell is — a runner
// image that changes processor generation must not change what is emitted
// (`ARCH-031` rule 6).
const inventory_targets = [_][]const u8{
"x86_64-linux-gnu",
"x86_64-windows-gnu",
"aarch64-linux-gnu",
};
for (inventory_targets) |triple| {
const query = std.Target.Query.parse(.{
.arch_os_abi = triple,
.cpu_features = "baseline",
}) catch @panic("bad inventory target triple");
const resolved = b.resolveTargetQuery(query);
// The module chain has to be rebuilt per target: a `Module` is bound to
// its target at creation, so the host-bound handles above cannot serve.
// It mirrors the graph declared earlier in this file and nothing more —
// if that graph gains an edge, this loop is where it has to be repeated,
// and a missing edge is a compile error here rather than a silent gap.
const t_foundation = b.createModule(.{
.root_source_file = b.path("src/foundation/root.zig"),
.target = resolved,
.optimize = .ReleaseSafe,
});
const t_core = b.createModule(.{
.root_source_file = b.path("src/core/root.zig"),
.target = resolved,
.optimize = .ReleaseSafe,
.link_libc = true,
});
t_core.addImport("foundation", t_foundation);
const t_forge_api = b.createModule(.{
.root_source_file = b.path("src/modules/forge/api/root.zig"),
.target = resolved,
.optimize = .ReleaseSafe,
});
t_forge_api.addImport("foundation", t_foundation);
t_forge_api.addImport("weld_core", t_core);
const t_forge_3d = b.createModule(.{
.root_source_file = b.path("src/modules/forge/forge_3d/root.zig"),
.target = resolved,
.optimize = .ReleaseSafe,
});
t_forge_3d.addImport("foundation", t_foundation);
t_forge_3d.addImport("weld_forge", t_forge_api);
t_forge_3d.addOptions("build_options", forge_build_options);
// Compiling `forge_3d/root.zig` DIRECTLY emits nothing — it is a
// re-export file and Zig is lazy. Measured before this indirection
// existed: `0 call sites examined` on all three targets, which the
// scanner refuses rather than reports as clean. The surface root forces
// the module's public functions into codegen; see its header.
const t_surface = b.createModule(.{
.root_source_file = b.path("tools/asm_inventory/forge_3d_surface.zig"),
.target = resolved,
.optimize = .ReleaseSafe,
});
t_surface.addImport("forge_3d", t_forge_3d);
const obj = b.addObject(.{
.name = b.fmt("forge_3d_asm_{s}", .{triple}),
.root_module = t_surface,
});
asm_inventory_run.addFileArg(obj.getEmittedAsm());
}
const asm_inventory_step = b.step(
"forge-asm-inventory",
"Assert zero libm transcendental call in forge_3d assembly (ARCH-031 rule 4)",
);
asm_inventory_step.dependOn(&asm_inventory_run.step);
// The scanner's own counter-factuals ride in `zig build test`: a scanner
// that cannot fire reports a clean tree for the wrong reason, and that is
// the failure this suite exists to make impossible.
const asm_inventory_tests = b.addTest(.{ .root_module = asm_inventory_module });
test_step.dependOn(&b.addRunArtifact(asm_inventory_tests).step);
// `zig build ecs-access-zero-cost` — the declared-access view claims to cost
// nothing, and that claim is about EMITTED CODE. It is read in the listing,
// on the `forge-asm-inventory` shape above: emit the assembly of a witness
// pair, hand the path to a Zig scanner, compare.
//
// ReleaseSafe rather than Debug: the claim is about the code a game ships,
// and Debug emits a prologue and stack probes that say nothing about the
// view. Pinned here rather than taken from the cell's mode, for the same
// reason `forge-asm-inventory` pins its own.
const view_asm_module = b.createModule(.{
.root_source_file = b.path("tools/view_asm_equiv/main.zig"),
.target = b.graph.host,
.optimize = .ReleaseSafe,
});
const view_asm_exe = b.addExecutable(.{
.name = "view_asm_equiv",
.root_module = view_asm_module,
});
const view_asm_run = b.addRunArtifact(view_asm_exe);
{
const zc_target = b.resolveTargetQuery(std.Target.Query.parse(.{
.arch_os_abi = "native",
.cpu_features = "baseline",
}) catch unreachable);
const zc_foundation = b.createModule(.{
.root_source_file = b.path("src/foundation/root.zig"),
.target = zc_target,
.optimize = .ReleaseSafe,
});
const zc_core = b.createModule(.{
.root_source_file = b.path("src/core/root.zig"),
.target = zc_target,
.optimize = .ReleaseSafe,
.link_libc = true,
});
zc_core.addImport("foundation", zc_foundation);
const zc_surface = b.createModule(.{
.root_source_file = b.path("tests/core/ecs/access_zero_cost_surface.zig"),
.target = zc_target,
.optimize = .ReleaseSafe,
});
zc_surface.addImport("weld_core", zc_core);
const zc_obj = b.addObject(.{
.name = "ecs_access_zero_cost",
.root_module = zc_surface,
});
view_asm_run.addFileArg(zc_obj.getEmittedAsm());
}
// `zig build c-api-read-column-constness` — the Tier 3 half of `ARCH-030`.
//
// C has no comptime view, and what it has instead is `const`. The witness
// compiles as published and must NOT compile with one line added that takes
// a mutable pointer to a column the query declared read-only. Both
// directions in ONE step, because a refusal nobody pairs with an acceptance
// is satisfied by a file that never compiles at all.
//
// Driven through `zig cc` rather than a `Compile` step: a C compilation
// expected to FAIL cannot be a step of the graph it would fail. The
// diagnostic is matched on its text, never on the exit code — a compiler
// that died for an unrelated reason exits identically.
const c_witness_dir = "tests/c_api/read_column_constness";
const c_witness_flags = [_][]const u8{ "-std=c11", "-Wall", "-Werror", "-pedantic" };
const constness_step = b.step(
"c-api-read-column-constness",
"Assert a Tier 3 read column is unreachable by a mutable pointer (engine-c-api.md 5.5)",
);
{
var argv: std.ArrayList([]const u8) = .empty;
defer argv.deinit(b.allocator);
argv.appendSlice(b.allocator, &.{ b.graph.zig_exe, "cc" }) catch @panic("OOM");
argv.appendSlice(b.allocator, &c_witness_flags) catch @panic("OOM");
argv.appendSlice(b.allocator, &.{ "-c", b.pathJoin(&.{ c_witness_dir, "witness.c" }), "-o" }) catch @panic("OOM");
const ok = b.addSystemCommand(argv.items);
// The object goes to a build-owned path rather than to a device: the
// point is that the compiler accepted it, and a run that writes nowhere
// is one the build system may legitimately skip.
_ = ok.addOutputFileArg("witness.o");
ok.has_side_effects = true;
ok.expectExitCode(0);
constness_step.dependOn(&ok.step);
}
{
var argv: std.ArrayList([]const u8) = .empty;
defer argv.deinit(b.allocator);
argv.appendSlice(b.allocator, &.{ b.graph.zig_exe, "cc" }) catch @panic("OOM");
argv.appendSlice(b.allocator, &c_witness_flags) catch @panic("OOM");
argv.appendSlice(b.allocator, &.{
"-DWELD_ASSIGN_THROUGH_READ_COLUMN",
"-c",
b.pathJoin(&.{ c_witness_dir, "witness.c" }),
"-o",
}) catch @panic("OOM");
const bad = b.addSystemCommand(argv.items);
_ = bad.addOutputFileArg("witness_counterproof.o");
// Always re-run: a `Run` cached on its argv alone replays a stale
// verdict, which is how the sibling counter-proof harness first
// reported green against a deliberately disabled guard.
bad.has_side_effects = true;
bad.expectExitCode(1);
bad.addCheck(.{ .expect_stderr_match = "discards qualifiers" });
constness_step.dependOn(&bad.step);
}
const view_asm_step = b.step(
"ecs-access-zero-cost",
"Assert the declared-access view emits the same instructions as a direct World access",
);
view_asm_step.dependOn(&view_asm_run.step);
// The scanner's own tests ride in `zig build test`, for the reason written
// beside `asm_inventory`'s: a scanner that cannot discriminate reports a
// clean verdict for the wrong reason.
const view_asm_tests = b.addTest(.{ .root_module = view_asm_module });
test_step.dependOn(&b.addRunArtifact(view_asm_tests).step);
// Out-of-tree tests: each file is its own root_module and imports
// `weld_core` to reach the engine internals. The exception is a group whose
// files `@import` each other — Zig 0.16 forbids a single file from belonging
// to two module trees, so such a group CANNOT be exposed as sibling modules
// and gets one thin facade module instead.
const wl_protocols_test_module = b.createModule(.{
.root_source_file = b.path("src/core/platform/window/wayland_protocols/tests_facade.zig"),
.target = target,
.optimize = optimize,
});
const etch_corpus_module = b.createModule(.{
.root_source_file = b.path("tests/etch/corpus_facade.zig"),
.target = target,
.optimize = optimize,
});
// Generic test driver module (independent of the corpus + runner) so it
// can be reused by the codegen-runner without modifying call sites.
const etch_interp_driver_module = b.createModule(.{
.root_source_file = b.path("tests/etch_interp/diff_runner.zig"),
.target = target,
.optimize = optimize,
});
etch_interp_driver_module.addImport("weld_core", core_module);
// Differential corpus — `tests/etch_interp/` houses the `.etch` programs
// and their sidecar `expected.zig` files. The facade enumerates
// them and is consumed by `corpus_test.zig` (the test driver) and by
// the bench harness. Sidecars in `programs/` reach the diff_runner
// types through the `diff_runner` module dependency below.
const etch_interp_corpus_module = b.createModule(.{
.root_source_file = b.path("tests/etch_interp/corpus_facade.zig"),
.target = target,
.optimize = optimize,
});
etch_interp_corpus_module.addImport("weld_core", core_module);
etch_interp_corpus_module.addImport("weld_etch", etch_module);
etch_interp_corpus_module.addImport("diff_runner", etch_interp_driver_module);
// Runner module — the interpreter backend.
const etch_interp_runner_module = b.createModule(.{
.root_source_file = b.path("tests/etch_interp/runner_interp.zig"),
.target = target,
.optimize = optimize,
});
etch_interp_runner_module.addImport("weld_core", core_module);
etch_interp_runner_module.addImport("weld_etch", etch_module);
// the toy service and the `.d.etch` emitter, defined HERE
// rather than beside the bindgen steps below because the test-spec loop
// needs them too, and one module definition serving both is what keeps the
// tests exercising the very code the `bindgen-check` step runs.
// The toy is a PERMANENT manifest entry: `etch-abi-zig.md` §8.7 has the
// interop gates prove themselves on a toy and never on the physics.
const toy_service_module = b.createModule(.{
.root_source_file = b.path("tests/etch_services/toy_service.zig"),
.target = b.graph.host,
.optimize = .Debug,
});
toy_service_module.addImport("weld_etch", etch_module);
const emit_detch_module = b.createModule(.{
.root_source_file = b.path("tools/bindgen/emit_detch.zig"),
.target = b.graph.host,
.optimize = .Debug,
});
emit_detch_module.addImport("weld_etch", etch_module);
// the physics service and the sensor-event types enter the
// manifest. They import the forge module, so their modules are built here
// alongside the toy's.
const forge_services_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/services/physics.zig"),
.target = b.graph.host,
.optimize = .Debug,
});
forge_services_module.addImport("weld_etch", etch_module);
forge_services_module.addImport("weld_forge", forge_api_module);
forge_services_module.addImport("forge_3d", forge_3d_module);
forge_services_module.addImport("weld_core", core_module);
forge_services_module.addImport("foundation", foundation_module);
forge_services_module.addImport("forge_module", forge_module);
// the MUTATION half of the service resolves an entity to the body the
// seam drives and marks the seam's own journal, so it needs the seam. `forge_sync` is
// the only module that sees both the ECS and `PhysicsWorld`, which is exactly what a
// wrapper writing an ECS mirror needs.
forge_services_module.addImport("forge_sync", forge_sync_module);
// the bidirectional Etch slice. It is DRIVEN by a test rather
// than left as a directory to read: a mechanism nothing executes is the defect
// an earlier milestone named and this one has closed twice.
const arena_slice_module = b.createModule(.{
.root_source_file = b.path("examples/arena/slice.zig"),
.target = target,
.optimize = optimize,
});
const forge_sensor_events_module = b.createModule(.{
.root_source_file = b.path("src/modules/forge/sensor_events.zig"),
.target = b.graph.host,
.optimize = .Debug,
});
forge_sensor_events_module.addImport("weld_etch", etch_module);
forge_sensor_events_module.addImport("weld_forge", forge_api_module);
forge_sensor_events_module.addImport("forge_3d", forge_3d_module);
forge_sensor_events_module.addImport("weld_core", core_module);
forge_sensor_events_module.addImport("foundation", foundation_module);
arena_slice_module.addImport("weld_core", core_module);
arena_slice_module.addImport("weld_forge", forge_api_module);
arena_slice_module.addImport("forge_3d", forge_3d_module);
arena_slice_module.addImport("weld_etch", etch_module);
arena_slice_module.addImport("forge_module", forge_module);
arena_slice_module.addImport("forge_services", forge_services_module);
arena_slice_module.addImport("forge_sensor_events", forge_sensor_events_module);
arena_slice_module.addImport("forge_sync", forge_sync_module);
arena_slice_module.addImport("foundation", foundation_module);
const TestSpec = struct {
path: []const u8,
wl_protocols: bool = false,
etch: bool = false,
etch_interp: bool = false,
/// when set, the test step depends on
/// `stub_install_steps[]` so the three stub libraries are
/// built before the test runs.
needs_stub_plugins: bool = false,
/// when set, imports the `weld_audio` module.
audio: bool = false,
/// when set, imports the `weld_render` module (GAL public
/// surface + Null backend, Vulkan backend wires in later).
render: bool = false,
/// when set, imports the `weld_asset_pipeline` module.
asset_pipeline: bool = false,
/// when set, imports the Forge synchronisation seam and the two
/// modules it joins, so a test can drive a `PhysicsWorld` against a real ECS
/// `World`.
forge: bool = false,
/// when set, imports the `foundation` module (simd).
foundation: bool = false,
/// when set, imports `weld_etch` (the scene cook driver). A
/// dedicated flag rather than `.etch` so `tests/scene/` does not pull in
/// the `corpus_facade` baggage `.etch` carries.
scene: bool = false,
/// when set, imports the bidirectional arena slice.
arena_slice: bool = false,
/// when set, imports the physics service, the sensor-event
/// types and `weld_etch`, so a test can drive a rule through the service.
physics_service: bool = false,
/// when set, imports the toy service module (which also
/// carries the toy EVENT and its emitted declaration).
etch_events: bool = false,
/// when set, imports the `.d.etch` emitter and the toy
/// service, so a test exercises the SAME functions `bindgen-check` runs.
bindgen_detch: bool = false,
/// when set, create a dedicated `zig build
/// <name>` step that runs ONLY this test. Used by the CI
/// runtime-smoke-test job to gate strictly on the capture PSNR
/// without re-running every other test in the repo (some of
/// which have unrelated ReleaseSafe issues tracked as
/// out-of-scope debt).
dedicated_step: ?[]const u8 = null,
};
const test_specs = [_]TestSpec{
.{ .path = "tests/smoke_test.zig" },
.{ .path = "tests/physics/transform_sync_test.zig", .forge = true },
// `Forge3DModule`: the allocator/fallibility shape of the
// frozen surface, and the `step` failure contract.
.{ .path = "tests/physics/forge_module_test.zig", .forge = true },
// the Tier 1 physics service called from a rule, and the two
// sensor deltas translated onto the Tier 0 bus.
.{ .path = "tests/physics/physics_service_test.zig", .forge = true, .physics_service = true },
// the slice, run in both directions.
.{ .path = "tests/physics/arena_slice_test.zig", .arena_slice = true },
.{ .path = "tests/ecs/world_test.zig" },
.{ .path = "tests/ecs/chunk_test.zig" },
.{ .path = "tests/ecs/query_test.zig" },
.{ .path = "tests/ecs/no_alloc_in_simulation_test.zig" },
.{ .path = "tests/ecs/generational_indices.zig" },
.{ .path = "tests/ecs/archetype_transitions.zig" },
.{ .path = "tests/ecs/queries.zig" },
// The POSITIVE half of the declared-access enforcement. The refusals it
// makes non-vacuous live in `tests/core/ecs/access_counterproof/`,
// driven by `zig build ecs-access-counterproof` — a compile error
// cannot be a test block.
.{ .path = "tests/core/ecs/access_view_test.zig" },
// What the command buffer no longer holds, and when it resolves what it
// does — the two halves of the `world` field's removal.
.{ .path = "tests/core/ecs/command_buffer_test.zig" },
// The Zig half of the `WeldQueryChunk` drift pin; the C half is the
// `_Static_assert`s in `tests/c_api/read_column_constness/`.
.{ .path = "tests/c_api/chunk_layout_test.zig" },
.{ .path = "tests/ecs/change_detection.zig" },
.{ .path = "tests/ecs/scheduler.zig" },
.{ .path = "tests/ecs/scheduler_dag.zig" },
.{ .path = "tests/ecs/no_alloc_scheduler_dispatch.zig" },
.{ .path = "tests/ecs/command_buffer.zig" },
.{ .path = "tests/ecs/observers.zig" },
.{ .path = "tests/ecs/no_alloc_steady_state.zig" },
.{ .path = "tests/ecs/integration_scenario.zig" },
.{ .path = "tests/ecs/sparse_routing_test.zig" },
.{ .path = "tests/ecs/hybrid_query_test.zig" },
.{ .path = "tests/ecs/requires_test.zig" },
.{ .path = "tests/core/rtti/comptime_builder_test.zig" },
.{ .path = "tests/core/rtti/hash_test.zig" },
.{ .path = "tests/core/rtti/registry_test.zig" },
.{ .path = "tests/core/rtti/ipc_compat_test.zig" },
.{ .path = "tests/core/resources/api_test.zig" },
.{ .path = "tests/core/resources/change_detection_test.zig" },
.{ .path = "tests/core/resources/query_exclusion_test.zig" },
.{ .path = "tests/core/resources/lifecycle_test.zig" },
.{ .path = "tests/core/events/queue_test.zig" },
.{ .path = "tests/core/events/saturation_test.zig" },
.{ .path = "tests/core/events/lifetime_test.zig" },
.{ .path = "tests/core/events/scheduler_integration_test.zig" },
// `core.ModuleContext`: the four-field pin and its negative
// twin (exactly one field reaches component registration and the event bus).
.{ .path = "tests/core/module_context_test.zig" },
.{ .path = "tests/bindgen/roundtrip_test.zig" },
.{ .path = "tests/core/plugin_loader/api_stub_test.zig" },
.{ .path = "tests/core/plugin_loader/load_unload_test.zig", .needs_stub_plugins = true },
.{ .path = "tests/jobs/deque_test.zig" },
.{ .path = "tests/jobs/scheduler_test.zig" },
.{ .path = "tests/window/win32_open_close_test.zig" },
.{ .path = "tests/window/wayland_open_close_test.zig" },
.{ .path = "tests/bindings/vk_abi_test.zig" },
.{ .path = "tests/bindings/wayland_abi_test.zig", .wl_protocols = true },
.{ .path = "tests/etch/corpus_test.zig", .etch = true },
// Etch idents that collide with Zig keywords must
// codegen to parseable (escaped) Zig. RED before the lower.zig fix.
.{ .path = "tests/etch/keyword_ident_test.zig", .etch = true },
// top-level recovery sync-point (ParseResult.diagnostics
// slice + resync at the next top-level keyword).
.{ .path = "tests/etch/recovery_toplevel_test.zig", .etch = true },
// EBNF harness: every ```etch example block parses clean.
.{ .path = "tests/etch/ebnf_examples_test.zig", .etch = true },
// AST stable interface freeze: thirty Level-1 entry points (§10.3.1).
// Compilation is the cross-phase invariant.
.{ .path = "tests/etch/ast_stable_interface.zig", .etch = true, .dedicated_step = "test-ast-stable" },
// interpreter hot-reload: edit rule body → AST swap →
// behaviour change on the same live world, measured < 500 ms.
.{ .path = "tests/etch/hot_reload_test.zig", .etch = true, .dedicated_step = "test-hot-reload" },
// full-grammar 500+ line integration reference: parse
// < 50 ms + type-check clean + Level-A interpret.
.{ .path = "tests/etch/reference_500_test.zig", .etch = true, .dedicated_step = "test-ref500" },
// `@storage` consumed end to end: the mode reaches the registry, a
// sparse component leaves the archetype signature, a rule selects on it
// and writes its row, and the codegen refuses a sparse program.
// `.etch = true` for `weld_etch`; `weld_core` is unconditional here.
.{ .path = "tests/etch/storage_mode_test.zig", .etch = true },
// one test per type-checker diagnostic code: each names its code and
// asserts PRESENCE, so it reddens the day emission stops.
.{ .path = "tests/etch/diagnostic_coverage_test.zig", .etch = true },
// TIME_LITERAL §3.2 expression arm wired (builtin Time §2.2).
.{ .path = "tests/etch/time_literal_test.zig", .etch = true, .dedicated_step = "test-time-lit" },
// the consolidated cook library.
.{ .path = "tests/etch/cook_consolidate_test.zig", .etch = true },
// triple-quote `"""…"""` multiline string lexer token
// + §1.4 common-indent strip at parse.
.{ .path = "tests/etch/lexer_triple_quote_test.zig", .etch = true },
// cross-file scene/prefab validation (E1782 cross-scene,
// E1786 cross-file prefab ref, E1791 cross-file prefab base).
.{ .path = "tests/etch/crossfile_scene_prefab_test.zig", .etch = true },
// `import` directive parsing: the four grammar forms (whole, selective,
// aliased, per-item alias), items accepting IDENT as well as TYPE_IDENT,
// and malformed-import recovery — resync, and no
// `UnsupportedConstructInS3`.
.{ .path = "tests/etch/import_parse_test.zig", .etch = true },
// module graph + cycle (E0108), exports binding
// (E0103/E0104), cross-file type resolution (no E0102).
.{ .path = "tests/etch/import_resolve_test.zig", .etch = true },
// qualified `m.Type` resolution under validateProject:
// type-alias-target parity with the selective form (`as m` + `m.Type`),
// use-site E0104/E0107, unresolved-alias E0102, and W0902.
.{ .path = "tests/etch/qualified_import_test.zig", .etch = true },
// the E1793 unblock: a `.prefab.etch` importing its