Skip to content

Commit 291ac8b

Browse files
gHashTagclaude
andcommitted
build(brain): spell out brain test roots so the S01 checker can see them
The capability index (external/t27/tools/trinity_manifest.py) finds build targets only as `const X = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path(...) }) })` and `b.step("literal", ...)`. The helper-built roots and the region-step loop showed up as `test:None` and hid three steps. Each brain test root and step is now written out, so every target has a precise name a capability card can own. No test changes: the same files are compiled with the same imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1cdca6a commit 291ac8b

1 file changed

Lines changed: 46 additions & 19 deletions

File tree

‎build.zig‎

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2993,23 +2993,36 @@ pub fn build(b: *std.Build) void {
29932993
});
29942994

29952995
// One step per region: the region file is the test root, so the step
2996-
// runs exactly that file's own test blocks.
2997-
const brain_region_steps = [_]struct { step: []const u8, desc: []const u8, mod: *std.Build.Module }{
2998-
.{ .step = "test-basal-ganglia", .desc = "Run Basal Ganglia tests (src/brain/basal_ganglia.zig)", .mod = bg_mod },
2999-
.{ .step = "test-reticular-formation", .desc = "Run Reticular Formation tests (src/brain/reticular_formation.zig)", .mod = rf_mod },
3000-
.{ .step = "test-locus-coeruleus", .desc = "Run Locus Coeruleus tests (src/brain/locus_coeruleus.zig)", .mod = lc_mod },
3001-
};
3002-
for (brain_region_steps) |r| {
3003-
const region_tests = b.addTest(.{ .root_module = r.mod });
3004-
b.step(r.step, r.desc).dependOn(&b.addRunArtifact(region_tests).step);
3005-
}
2996+
// runs exactly that file's own test blocks. Each test root is spelled out
2997+
// as b.createModule(.{ .root_source_file = b.path(...) }) and each step
2998+
// name is a literal, because the S01 capability checker
2999+
// (external/t27/tools/trinity_manifest.py) finds build targets by those
3000+
// patterns; a root passed through a helper or a loop is invisible to it.
3001+
const bg_tests = b.addTest(.{ .root_module = b.createModule(.{
3002+
.root_source_file = b.path("src/brain/basal_ganglia.zig"),
3003+
.target = target,
3004+
.optimize = optimize,
3005+
}) });
3006+
b.step("test-basal-ganglia", "Run Basal Ganglia tests (src/brain/basal_ganglia.zig)").dependOn(&b.addRunArtifact(bg_tests).step);
3007+
const rf_tests = b.addTest(.{ .root_module = b.createModule(.{
3008+
.root_source_file = b.path("src/brain/reticular_formation.zig"),
3009+
.target = target,
3010+
.optimize = optimize,
3011+
}) });
3012+
b.step("test-reticular-formation", "Run Reticular Formation tests (src/brain/reticular_formation.zig)").dependOn(&b.addRunArtifact(rf_tests).step);
3013+
const lc_tests = b.addTest(.{ .root_module = b.createModule(.{
3014+
.root_source_file = b.path("src/brain/locus_coeruleus.zig"),
3015+
.target = target,
3016+
.optimize = optimize,
3017+
}) });
3018+
b.step("test-locus-coeruleus", "Run Locus Coeruleus tests (src/brain/locus_coeruleus.zig)").dependOn(&b.addRunArtifact(lc_tests).step);
30063019

30073020
// test-brain: the aggregator src/brain/brain.zig (AgentCoordination over
30083021
// the regions above) plus src/brain/integration_test.zig (cross-region
30093022
// scenarios). brain.zig also names intraparietal_sulcus, perf_dashboard
30103023
// and benchmarks; none of its tests reference them, and Zig analyses an
30113024
// @import only when it is referenced, so they are not wired here.
3012-
const brain_agg_mod = brainModule(b, target, optimize, "src/brain/brain.zig", &.{
3025+
const brain_agg_imports: []const std.Build.Module.Import = &.{
30133026
.{ .name = "basal_ganglia", .module = bg_mod },
30143027
.{ .name = "reticular_formation", .module = rf_mod },
30153028
.{ .name = "locus_coeruleus", .module = lc_mod },
@@ -3032,10 +3045,10 @@ pub fn build(b: *std.Build) void {
30323045
.{ .name = "learning", .module = learning_b_mod },
30333046
.{ .name = "federation", .module = federation_b_mod },
30343047
.{ .name = "async_processor", .module = async_b_mod },
3035-
});
3048+
};
30363049
// integration_test.zig reaches metrics_dashboard.zig by file path, so that
30373050
// file is compiled as part of this module and needs its imports here too.
3038-
const brain_integration_mod = brainModule(b, target, optimize, "src/brain/integration_test.zig", &.{
3051+
const brain_integration_imports: []const std.Build.Module.Import = &.{
30393052
.{ .name = "basal_ganglia", .module = bg_mod },
30403053
.{ .name = "reticular_formation", .module = rf_mod },
30413054
.{ .name = "locus_coeruleus", .module = lc_mod },
@@ -3049,17 +3062,31 @@ pub fn build(b: *std.Build) void {
30493062
.{ .name = "federation", .module = federation_b_mod },
30503063
.{ .name = "async_processor", .module = async_b_mod },
30513064
.{ .name = "microglia", .module = microglia_b_mod },
3052-
});
3065+
};
3066+
const brain_agg_tests = b.addTest(.{ .root_module = b.createModule(.{
3067+
.root_source_file = b.path("src/brain/brain.zig"),
3068+
.target = target,
3069+
.optimize = optimize,
3070+
.imports = brain_agg_imports,
3071+
}) });
3072+
const brain_integration_tests = b.addTest(.{ .root_module = b.createModule(.{
3073+
.root_source_file = b.path("src/brain/integration_test.zig"),
3074+
.target = target,
3075+
.optimize = optimize,
3076+
.imports = brain_integration_imports,
3077+
}) });
30533078
const brain_tests_step = b.step("test-brain", "Run brain aggregator + cross-region integration tests (src/brain/brain.zig, src/brain/integration_test.zig)");
3054-
brain_tests_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = brain_agg_mod })).step);
3055-
brain_tests_step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = brain_integration_mod })).step);
3079+
brain_tests_step.dependOn(&b.addRunArtifact(brain_agg_tests).step);
3080+
brain_tests_step.dependOn(&b.addRunArtifact(brain_integration_tests).step);
30563081

30573082
// test-brain-stress: src/brain/stress_test.zig, 10,000-claim and
30583083
// 20,000-event load tests over basal_ganglia, reticular_formation,
30593084
// locus_coeruleus, telemetry and alerts. It imports them by file path, so
30603085
// it is a single module with no imports of its own.
3061-
const brain_stress_tests = b.addTest(.{
3062-
.root_module = brainModule(b, target, optimize, "src/brain/stress_test.zig", &.{}),
3063-
});
3086+
const brain_stress_tests = b.addTest(.{ .root_module = b.createModule(.{
3087+
.root_source_file = b.path("src/brain/stress_test.zig"),
3088+
.target = target,
3089+
.optimize = optimize,
3090+
}) });
30643091
b.step("test-brain-stress", "Run brain stress tests (src/brain/stress_test.zig)").dependOn(&b.addRunArtifact(brain_stress_tests).step);
30653092
}

0 commit comments

Comments
 (0)