diff --git a/talmudic_engine/test/halt_test.pl b/talmudic_engine/test/halt_test.pl index 421268fd..9ebfc504 100644 --- a/talmudic_engine/test/halt_test.pl +++ b/talmudic_engine/test/halt_test.pl @@ -174,6 +174,40 @@ test(consensus_coupling_not_grounded, [fail]) :- :- end_tests(self_grounding). +%% ============================================================ +%% INTEGRATION REGRESSION: interpret/2 output must always pass +%% halt_check_self_grounding. If any future change to interpret.pl +%% adds a new coupling shape that does not match +%% is_l1_grounded_coupling/1, this test fails — and the system halt +%% would fire on real pipeline output. Catch the schema drift here, +%% before it becomes a production halt. +%% ============================================================ + +:- begin_tests(interpret_self_grounding_regression). +:- use_module('../src/reasoning/interpret'). + +%% Every coupling produced by interpret/2 on a real case must be +%% one of the recognized L1-grounded shapes. We construct a case +%% with a known root (bet_resh_aleph appears in Bereishit 1:1) and +%% assert the interpretation's trace passes the halt check. +test(interpret_output_does_not_self_ground, [nondet]) :- + Case = case(test_regression_1, creation, [bet_resh_aleph], + 'Regression: every interpret/2 coupling must be L1-grounded'), + interpret(Case, Interp), + \+ halt_check_self_grounding(Interp, _). + +%% Stronger: every coupling in the trace individually passes +%% is_l1_grounded_coupling. If a new shape is introduced (e.g. +%% coupled(_, prior_decision(_))), this fails immediately. +test(every_interpret_coupling_is_l1_grounded, [nondet]) :- + Case = case(test_regression_2, justice, [bet_resh_aleph], + 'Schema check: every coupling matches the recognized shape'), + interpret(Case, interpretation(_, _, _, _, _, coupling_trace(Trace))), + forall(member(C, Trace), is_l1_grounded_coupling(C)). + +:- end_tests(interpret_self_grounding_regression). + + :- begin_tests(shfichut_damim). %% Detects deletion of a user (tzelem carrier)