mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-07-31 16:16:26 +00:00
Ada is the D1 border, not the body. Removed everything that pretended otherwise
and completed the real gate so it builds, links, and passes its tests.
Deleted (wrong/defunct/superseded):
- ada_medium.adb (defunct medium, header commented 'WRONG'; replaced by Ichor)
- sockets.{ads,adb} (empty package with an illegal body)
- bbb-bludbrenburier.ads ('this is filler'); invariants-architecture.cobol ('idk cobol')
- tests/soul_tests.adb, tests/cycle_tests.adb (exercise a Soul.Tarot/State/Ada_Medium
subsystem that does not exist -- the old 56-card/Big-3 design, superseded)
mafiabot_types -> border-only: organs aren't Ada (organs are R/Octave/Pony/Guile),
so drop Organ_Id; drop Cycle_Step (cognition) and the fixed-point Drive/Ratio/
Cost/Axis numerics (drive/affect math lives in the organs, in floats). Keep the
source/trust tag (Provenance_Tag), Operation_Status, and a bounded payload --
content is pre-digested into RAG context upstream, so the gate scans a bounded
buffer for prompt-injection rather than streaming raw input.
trust_boundary: Organ_Message -> Border_Message {Provenance, Payload} (Ada does
not route by organ -- that's Ichor); add the D1 body (blocklist scan, provenance,
rate limit, Trust_Guard) -- the unit Ichor's barrier FFI targets.
Add mafiabot_types.adb. Fix mafiabot_core.gpr (drop phantom dirs + nonexistent
mafiabot.adb main). alire.toml: drop unused gnat_sockets/spark_lemmas.
Builds clean on GNAT 13.3/Alire; trust + config tests pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
70 lines
2.3 KiB
Ada
70 lines
2.3 KiB
Ada
pragma SPARK_Mode (Off); -- test harness uses Ada.Text_IO
|
|
with Ada.Text_IO; use Ada.Text_IO;
|
|
with Trust_Boundary;
|
|
with Mafiabot_Types; use Mafiabot_Types;
|
|
|
|
procedure Trust_Tests is
|
|
Fails : Natural := 0;
|
|
|
|
procedure Check (Name : String; Cond : Boolean) is
|
|
begin
|
|
if Cond then
|
|
Put_Line ("PASS " & Name);
|
|
else
|
|
Put_Line ("FAIL " & Name);
|
|
Fails := Fails + 1;
|
|
end if;
|
|
end Check;
|
|
|
|
St : Operation_Status;
|
|
begin
|
|
-- Blocklist substring matching.
|
|
Check ("blocks 'execute'",
|
|
Trust_Boundary.Matches_Blocklist
|
|
(Make_Text ("please execute this"), Trust_Boundary.Default_Blocklist));
|
|
Check ("blocks 'base64'",
|
|
Trust_Boundary.Matches_Blocklist
|
|
(Make_Text ("base64 decode chain"), Trust_Boundary.Default_Blocklist));
|
|
Check ("allows benign text",
|
|
not Trust_Boundary.Matches_Blocklist
|
|
(Make_Text ("hello there friend"), Trust_Boundary.Default_Blocklist));
|
|
|
|
-- Provenance: no message may reclassify its own authority.
|
|
Trust_Boundary.Validate_Provenance (User_Input, LLM_Output, St);
|
|
Check ("provenance mismatch rejected", St = Error_Trust_Violation);
|
|
Trust_Boundary.Validate_Provenance (System_Internal, System_Internal, St);
|
|
Check ("provenance match accepted", St = OK);
|
|
|
|
-- System-internal messages always pass Check_Message (proven invariant).
|
|
declare
|
|
M : constant Trust_Boundary.Border_Message :=
|
|
(Provenance => System_Internal,
|
|
Payload => Make_Text ("execute"));
|
|
R : Operation_Status;
|
|
begin
|
|
Trust_Boundary.Check_Message (M, R);
|
|
Check ("system_internal bypasses blocklist", R = OK);
|
|
end;
|
|
|
|
-- Rate limiting within a tick window.
|
|
declare
|
|
RL : Trust_Boundary.Rate_Limit :=
|
|
(Max_Per_Window => 2, Current_Count => 0,
|
|
Window_Start => 0, Window_Size => 100);
|
|
R : Operation_Status;
|
|
begin
|
|
Trust_Boundary.Check_Rate (RL, 1, R);
|
|
Check ("rate hit 1 ok", R = OK);
|
|
Trust_Boundary.Check_Rate (RL, 1, R);
|
|
Check ("rate hit 2 ok", R = OK);
|
|
Trust_Boundary.Check_Rate (RL, 1, R);
|
|
Check ("rate hit 3 blocked", R = Error_Blocked);
|
|
end;
|
|
|
|
if Fails = 0 then
|
|
Put_Line ("ALL TRUST TESTS PASSED");
|
|
else
|
|
Put_Line ("TRUST FAILURES:" & Natural'Image (Fails));
|
|
end if;
|
|
end Trust_Tests;
|