Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 145 additions & 138 deletions .github/workflows/brain-ci.yml

Large diffs are not rendered by default.

187 changes: 187 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2902,4 +2902,191 @@ pub fn build(b: *std.Build) void {
});
const run_arena_tests = b.addRunArtifact(arena_tests);
test_step.dependOn(&run_arena_tests.step);

// ═══════════════════════════════════════════════════════════════════════════════
// S³AI BRAIN — region tests run by .github/workflows/brain-ci.yml
// ═══════════════════════════════════════════════════════════════════════════════
//
// 42490a22 (#517) removed every test-<region>, test-brain and
// test-brain-stress step from this file while brain-ci.yml kept calling
// them, so each Unit Tests job died on "no step named 'test-basal-ganglia'"
// and Integration, Stress and CLI Smoke never ran behind it. The source
// files and their test blocks were never removed; these steps point back
// at them. Only regions whose tests compile and pass on 0.15.2 are here.
//
// Not restored, on purpose:
// test-intraparietal -- src/brain/intraparietal_sulcus.zig wraps the
// hslm library that moved to gHashTag/trinity-training. What is left
// are stubs (GF16 = TF3 = f32, PHI = 3.0) that do not compile, and its
// tests assert behaviour of the moved library.
// test-hslm -- hslm lives in gHashTag/trinity-training and is tested
// there; nothing named hslm is in this tree.
const brainModule = struct {
fn make(
bb: *std.Build,
t: std.Build.ResolvedTarget,
o: std.builtin.OptimizeMode,
root: []const u8,
imports: []const std.Build.Module.Import,
) *std.Build.Module {
return bb.createModule(.{
.root_source_file = bb.path(root),
.target = t,
.optimize = o,
.imports = imports,
});
}
}.make;

const bg_mod = brainModule(b, target, optimize, "src/brain/basal_ganglia.zig", &.{});
const rf_mod = brainModule(b, target, optimize, "src/brain/reticular_formation.zig", &.{});
const lc_mod = brainModule(b, target, optimize, "src/brain/locus_coeruleus.zig", &.{});
const bg_rf: []const std.Build.Module.Import = &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
};
const amygdala_b_mod = brainModule(b, target, optimize, "src/brain/amygdala.zig", &.{});
const persistence_b_mod = brainModule(b, target, optimize, "src/brain/persistence.zig", &.{});
const telemetry_b_mod = brainModule(b, target, optimize, "src/brain/telemetry.zig", &.{});
const thalamus_b_mod = brainModule(b, target, optimize, "src/brain/thalamus_logs.zig", &.{});
const pfc_b_mod = brainModule(b, target, optimize, "src/brain/prefrontal_cortex.zig", &.{});
const hh_b_mod = brainModule(b, target, optimize, "src/brain/health_history.zig", &.{});
const microglia_b_mod = brainModule(b, target, optimize, "src/brain/microglia.zig", &.{});
const alerts_b_mod = brainModule(b, target, optimize, "src/brain/alerts.zig", &.{});
const visualization_b_mod = brainModule(b, target, optimize, "src/brain/visualization.zig", &.{});
const learning_b_mod = brainModule(b, target, optimize, "src/brain/learning.zig", &.{});
const evolution_b_mod = brainModule(b, target, optimize, "src/brain/evolution_simulation.zig", &.{});
const state_recovery_b_mod = brainModule(b, target, optimize, "src/brain/state_recovery.zig", bg_rf);
// captureState() calls std.c.getpid(). macOS links libc implicitly, so this
// only fails on Linux: "dependency on libc must be explicitly specified".
state_recovery_b_mod.link_libc = true;
const federation_b_mod = brainModule(b, target, optimize, "src/brain/federation.zig", bg_rf);
const async_b_mod = brainModule(b, target, optimize, "src/brain/async_processor.zig", bg_rf);
const metrics_b_mod = brainModule(b, target, optimize, "src/brain/metrics_dashboard.zig", &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "locus_coeruleus", .module = lc_mod },
.{ .name = "amygdala", .module = amygdala_b_mod },
.{ .name = "prefrontal_cortex", .module = pfc_b_mod },
.{ .name = "telemetry", .module = telemetry_b_mod },
.{ .name = "health_history", .module = hh_b_mod },
.{ .name = "microglia", .module = microglia_b_mod },
});
const simulation_b_mod = brainModule(b, target, optimize, "src/brain/simulation.zig", &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "locus_coeruleus", .module = lc_mod },
});
const observability_b_mod = brainModule(b, target, optimize, "src/brain/observability_export.zig", &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "metrics_dashboard", .module = metrics_b_mod },
});
const admin_b_mod = brainModule(b, target, optimize, "src/brain/admin.zig", &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "state_recovery", .module = state_recovery_b_mod },
.{ .name = "telemetry", .module = telemetry_b_mod },
});
const sebo_b_mod = brainModule(b, target, optimize, "src/brain/sebo.zig", &.{
.{ .name = "evolution_simulation", .module = evolution_b_mod },
});

// One step per region: the region file is the test root, so the step
// runs exactly that file's own test blocks. Each test root is spelled out
// as b.createModule(.{ .root_source_file = b.path(...) }) and each step
// name is a literal, because the S01 capability checker
// (external/t27/tools/trinity_manifest.py) finds build targets by those
// patterns; a root passed through a helper or a loop is invisible to it.
const bg_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/basal_ganglia.zig"),
.target = target,
.optimize = optimize,
}) });
b.step("test-basal-ganglia", "Run Basal Ganglia tests (src/brain/basal_ganglia.zig)").dependOn(&b.addRunArtifact(bg_tests).step);
const rf_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/reticular_formation.zig"),
.target = target,
.optimize = optimize,
}) });
b.step("test-reticular-formation", "Run Reticular Formation tests (src/brain/reticular_formation.zig)").dependOn(&b.addRunArtifact(rf_tests).step);
const lc_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/locus_coeruleus.zig"),
.target = target,
.optimize = optimize,
}) });
b.step("test-locus-coeruleus", "Run Locus Coeruleus tests (src/brain/locus_coeruleus.zig)").dependOn(&b.addRunArtifact(lc_tests).step);

// test-brain: the aggregator src/brain/brain.zig (AgentCoordination over
// the regions above) plus src/brain/integration_test.zig (cross-region
// scenarios). brain.zig also names intraparietal_sulcus, perf_dashboard
// and benchmarks; none of its tests reference them, and Zig analyses an
// @import only when it is referenced, so they are not wired here.
const brain_agg_imports: []const std.Build.Module.Import = &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "locus_coeruleus", .module = lc_mod },
.{ .name = "amygdala", .module = amygdala_b_mod },
.{ .name = "persistence", .module = persistence_b_mod },
.{ .name = "telemetry", .module = telemetry_b_mod },
.{ .name = "thalamus_logs", .module = thalamus_b_mod },
.{ .name = "prefrontal_cortex", .module = pfc_b_mod },
.{ .name = "health_history", .module = hh_b_mod },
.{ .name = "microglia", .module = microglia_b_mod },
.{ .name = "metrics_dashboard", .module = metrics_b_mod },
.{ .name = "state_recovery", .module = state_recovery_b_mod },
.{ .name = "admin", .module = admin_b_mod },
.{ .name = "alerts", .module = alerts_b_mod },
.{ .name = "simulation", .module = simulation_b_mod },
.{ .name = "evolution_simulation", .module = evolution_b_mod },
.{ .name = "sebo", .module = sebo_b_mod },
.{ .name = "observability_export", .module = observability_b_mod },
.{ .name = "visualization", .module = visualization_b_mod },
.{ .name = "learning", .module = learning_b_mod },
.{ .name = "federation", .module = federation_b_mod },
.{ .name = "async_processor", .module = async_b_mod },
};
// integration_test.zig reaches metrics_dashboard.zig by file path, so that
// file is compiled as part of this module and needs its imports here too.
const brain_integration_imports: []const std.Build.Module.Import = &.{
.{ .name = "basal_ganglia", .module = bg_mod },
.{ .name = "reticular_formation", .module = rf_mod },
.{ .name = "locus_coeruleus", .module = lc_mod },
.{ .name = "amygdala", .module = amygdala_b_mod },
.{ .name = "prefrontal_cortex", .module = pfc_b_mod },
.{ .name = "telemetry", .module = telemetry_b_mod },
.{ .name = "health_history", .module = hh_b_mod },
.{ .name = "alerts", .module = alerts_b_mod },
.{ .name = "state_recovery", .module = state_recovery_b_mod },
.{ .name = "learning", .module = learning_b_mod },
.{ .name = "federation", .module = federation_b_mod },
.{ .name = "async_processor", .module = async_b_mod },
.{ .name = "microglia", .module = microglia_b_mod },
};
const brain_agg_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/brain.zig"),
.target = target,
.optimize = optimize,
.imports = brain_agg_imports,
}) });
const brain_integration_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/integration_test.zig"),
.target = target,
.optimize = optimize,
.imports = brain_integration_imports,
}) });
const brain_tests_step = b.step("test-brain", "Run brain aggregator + cross-region integration tests (src/brain/brain.zig, src/brain/integration_test.zig)");
brain_tests_step.dependOn(&b.addRunArtifact(brain_agg_tests).step);
brain_tests_step.dependOn(&b.addRunArtifact(brain_integration_tests).step);

// test-brain-stress: src/brain/stress_test.zig, 10,000-claim and
// 20,000-event load tests over basal_ganglia, reticular_formation,
// locus_coeruleus, telemetry and alerts. It imports them by file path, so
// it is a single module with no imports of its own.
const brain_stress_tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/brain/stress_test.zig"),
.target = target,
.optimize = optimize,
}) });
b.step("test-brain-stress", "Run brain stress tests (src/brain/stress_test.zig)").dependOn(&b.addRunArtifact(brain_stress_tests).step);
}
4 changes: 2 additions & 2 deletions external/t27/specs/tools/mcp/needle.t27
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const RESOURCES_ABOUT : [0]str = [];
pub const TOOLS_NOTE : str = "Input schema keys were not extracted for this server (schemas are inline Zig literals); names and descriptions only. The .claude-plugin/.mcp.json command is an absolute path into a developer checkout; its home prefix is written as <checkout> here (no home paths in specs).";
; true when the server is a third-party package launched by npx or an outside binary.
pub const EXTERNAL : bool = false;
pub const AGENTS : [0]str = [];
pub const AGENTS_NOTE : str = "No source binds an agent letter to this server: docs/agents/AGENTS_ALPHABET.md, specs/OWNERS.md and .claude/agents/*.md do not name it.";
pub const AGENTS : [2]str = ["T", "C"];
pub const AGENTS_NOTE : str = "docs/agents/AGENTS_ALPHABET.md \"Who holds a tool, and who holds a skill\" binds every tool to the Queen (T). Domain lead C: Held: ABOUT is \"Zig MCP server for AST-aware code editing ... structural search and replace, quality gates, preview\" and needle_quality_gates is \"Run quality gates: parse check, AST analysis, violation detection\" -- parser/AST is C's ground (KEY_FILES t27/compiler/parser/, EXIT_INVARIANT \"Generated code compiles, AST is valid\"). No second letter: the card lists six tools, all editing/parse tools.";
pub const WITNESS : str = "source-parse";
pub const ENABLED : bool = true;
4 changes: 2 additions & 2 deletions external/t27/specs/tools/mcp/trinity.t27
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub const RESOURCES_ABOUT : [0]str = [];
pub const TOOLS_NOTE : str = "Static list parsed from writeToolsList (210 entries; 32 entries have an unbalanced trailing brace in the source literal and were parsed after adding or removing one). Cell-generated tools from data/cells/mcp_tools.json are appended at runtime and are not listed here. .trinity/mcp_schemas.json lists a different, shorter set (29 names) and is not used as the source.";
; true when the server is a third-party package launched by npx or an outside binary.
pub const EXTERNAL : bool = false;
pub const AGENTS : [0]str = [];
pub const AGENTS_NOTE : str = "No source binds an agent letter to this server: docs/agents/AGENTS_ALPHABET.md, specs/OWNERS.md and .claude/agents/*.md do not name it.";
pub const AGENTS : [2]str = ["T", "B"];
pub const AGENTS_NOTE : str = "docs/agents/AGENTS_ALPHABET.md \"Who holds a tool, and who holds a skill\" binds every tool to the Queen (T). Domain lead B: Changed from B,O to B: ABOUT leads with \"exposes the tri pipeline, Golden Chain links\", and the chain_* tools run \"Chain Link 0\" through \"Chain Link 25\" (spec, codegen, test, bench, fix, docs, verdict, git, loop, \"Chain Link 20: Auto-deploy to cloud\") -- B's DOMAIN is literally Build / Pipeline with KEY_FILES build.tri and src/tri/pipeline/. O was dropped: the coordination tools the O case rested on are swarm_task_add / swarm_assign / job_start / job_cancel, which fit J's \"all jobs assigned\" at least as well, and the same ABOUT also lists swarm, cloud/farm, FPGA, doctor, issue, deploy, experience, oracle and needle -- a dozen subjects, so no second letter can claim it over the rest.";
pub const WITNESS : str = "source-parse";
pub const ENABLED : bool = true;
Loading
Loading