Files
bikoret/talmudic_engine
Scott KarpandClaude Opus 4.7 6b96250255 talmudic_engine: regression test — interpret/2 output must pass self_grounding halt
Audit follow-up to commit b254ee9 (which added Form 4 self_grounding).

Verified every coupling_trace construction site across the codebase
(9 files) against is_l1_grounded_coupling/1:

  Production builders — SAFE:
    interpret.pl:128 — coupling_trace([])  empty triggers golden_calf
                                         (Form 2) only at non-low confidence,
                                         which is intentional
    interpret.pl:135 — coupling_trace(Couplings) where Couplings come from
                       lines 76, 82, 104:
                         coupled(domain(_), mitzvah(_))                  OK
                         coupled(root(_), mitzvah(_), via_verse(_,_,_))  OK
                         coupled(root(_), verse(_,_,_))                  OK
                       all match is_l1_grounded_coupling/1.

  Different layer — SAFE:
    vav_pipeline/lib/.../l3/interpretation.ex — Ecto field is
    {:array, :string}. L3 stores SERIALIZED string traces, not Prolog
    terms. They are not parsed back into Prolog or re-checked by
    halt rules. (Separate concern from finding L: the round-trip
    loses schema, but this is L's concern, not D's.)

  Tests / pattern matching / docs — SAFE: read positions, deliberate
  ungrounded test cases, comments only.

Conclusion: no production path trips the new self_grounding halt.

To prevent FUTURE schema drift in interpret.pl from silently introducing
ungrounded coupling shapes (which would then trip the halt on real
pipeline output), added two regression tests in
interpret_self_grounding_regression suite:

  1. interpret_output_does_not_self_ground — runs interpret/2 on a
     real case and asserts halt_check_self_grounding does not fire.
  2. every_interpret_coupling_is_l1_grounded — stronger: every
     coupling individually passes is_l1_grounded_coupling/1.

If anyone adds a new coupling shape to interpret.pl that does not
match the recognized L1 anchors (e.g. coupled(_, prior_decision(_)),
coupled(_, system_view(_))), these tests fail BEFORE the schema drift
becomes a production halt. The canary is in the same suite as the
halt rule it protects.

Test results: halt_test 47/47 (was 45, +2). Full Prolog suite 212/212
across all six test files.

Closes the verification half of Pass 2 finding L (coupling_trace
end-to-end population) for the Prolog layer. The Elixir L3 round-trip
is a separate concern — traces stored as strings cannot be
re-validated — and remains tracked under finding L.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 11:45:16 -04:00
..