Code review fixes + 13 middot added to spec

Zerikah fail-safe: empty offerings rejected, not processed (BUILD_KORBAN §5).
Halt monitor hardened: trap_exit, priority max, EXIT handler (Architecture spec).
13 Rules of Rabbi Yishmael added to Architecture §3.4 as Prolog inference predicates —
the engine reasons WITH Torah's hermeneutic methods, not just about their products.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott KarpandClaude Opus 4.6 committed 2026-03-09 16:55:42 -04:00
1 parent 33f8b03583
commit f8f70c77e5
6 files changed
+150 -20

No files matched your search

@@ -78,6 +78,18 @@ def process_korban(
# 3. Zerikah — extract vital content
vital, discarded = zerikah(terminated, korban)
# If zerikah found no vital content, the offering has no vital organs.
# BUILD_KORBAN.md §5: rejected, not processed into empty propositions.
if not vital.strip():
return ProcessedKorban(
vital_content="",
propositions=[],
provenance=source,
offering_type=offering_type,
discarded=discarded,
source_query=query,
)
# 4. Haktarah — transform to propositions
propositions = haktarah(vital)
@@ -96,11 +96,12 @@ def zerikah(terminated_content: str, korban: Korban) -> Tuple[str, List[str]]:
else:
discarded_sentences.append(sentence)
# If nothing was deemed vital, keep everything —
# better to pass through than to discard all content
# If nothing was deemed vital, the offering has no vital organs.
# BUILD_KORBAN.md §5: "the offering without vital organs is rejected,
# not processed into empty propositions."
# Return empty vital content — the caller handles rejection.
if not vital_sentences and sentences:
vital_sentences = sentences
discarded_sentences = []
discarded_sentences = sentences
vital = " ".join(vital_sentences)
return vital, discarded_sentences
+8 -12
View File
@@ -266,21 +266,17 @@ class TestBuildVerification5_EmptyOffering:
"""System does not raise on empty offering — handles gracefully."""
assert isinstance(self.result, ProcessedKorban)
def test_propositions_are_not_garbage(self):
def test_empty_offering_rejected_not_processed(self):
"""
If propositions exist for an empty offering, they must still be valid Prolog terms.
Empty or minimal propositions are acceptable — garbage propositions are not.
The offering without vital organs is REJECTED — not processed
into empty propositions. BUILD_KORBAN.md §5.
"""
for prop in self.result.propositions:
assert is_valid_prolog_term(prop), \
f"Garbage proposition from empty offering: {prop!r}"
assert self.result.vital_content == ""
assert self.result.propositions == []
def test_vital_content_has_no_assistant_voice(self):
"""Whatever survives, it must not contain assistant preamble."""
assert "Great question" not in self.result.vital_content
assert "I'd be happy" not in self.result.vital_content
assert "As an AI" not in self.result.vital_content
assert "Let me know" not in self.result.vital_content
def test_discarded_content_recorded(self):
"""What was stripped is recorded — the hide and offal are diagnostic data."""
assert len(self.result.discarded) > 0
def test_source_query_preserved(self):
assert self.result.source_query == "test empty"
+7 -4
View File
@@ -164,13 +164,16 @@ class TestZerikah:
assert vital == ""
assert discarded == []
def test_all_filler_fallback_preserves_content(self):
"""If nothing is vital, zerikah preserves everything rather than discarding all."""
def test_all_filler_rejected(self):
"""
If nothing is vital, zerikah returns empty vital content.
BUILD_KORBAN.md §5: the offering without vital organs is rejected.
"""
filler = "There are many perspectives. People disagree. Context matters."
korban = make_korban(filler)
vital, discarded = zerikah(filler, korban)
# Since nothing qualifies as vital, fallback returns everything
assert vital != "" or discarded == []
assert vital == ""
assert len(discarded) > 0
def test_stateless_between_calls(self):
"""Kiyyor principle: second call unaffected by first."""