feat(ontology): encode YD 87:9 — chalav keivah (milk in abomasum) - #260
Conversation
Encode Shulchan Aruch Yoreh Deah 87:9 (chalav ha'nimtza b'keivah). Encoding Summary: - 7 rules encoded (3 Mechaber heter + 1 Rema karush heter + 3 Rema tzalul issur) - Worlds: mechaber, rema - Machloket: Mechaber (pirsha — mutar) vs Rema/Rabbenu Tam (tzalul = chalav mamash — issur d_oraita) - Tests: 22 scenarios (3.86s runtime) - Encoding Decisions: 4 total (4 definitive / 0 probable / 0 debatable) Key rulings: - Mechaber (Rif/Rambam): chalav_keivah = pirsha — mutar bishul/achiila/hanaah (both states) - Rema (Rabbenu Tam): karush = pirsha (mutar); tzalul = chalav mamash → issur d_oraita (all 3) - Shach sk25: karush assur lchatchila (mara'it ayin), mutar bedieved - Tzalul-she-nikrash = din tzalul (Rashba/Shach) Sources: - Primary: SA YD 87:9 (Mechaber + Rema gloss) - Talmud: Chullin 116b (hilkheta: פירשא בעלמא), Chullin 116a, Chullin 109b - Rishonim: Rif Chullin 38b, Rambam MT Maachalot Asurot 9:15, Tur YD 87 - Commentaries: Shach sk24/25, Taz sk7, AH 87:35/87:38, Kaf HaChayim 87:74-75 - Also: Rashi on Chullin 116a, Tosafot on Chullin 116a Schema changes: - 3 new food_category enum values: chalav_keivah, chalav_keivah_karush, chalav_keivah_tzalul - base.hll guard extension (ED-87-9-003) - 4 new predicates declared Review finding (HAL-2): issur(hanaah, d_oraita) added for Rema/tzalul at review phase Reviewed-by: RNekhoda Corpus-artifact: corpus-sources-YD-87-9.yaml Co-authored-by: Mistaber Code <code@mistaber.ai>
Co-authored-by: Mistaber Code <code@mistaber.ai>
There was a problem hiding this comment.
Pull request overview
Verdict: CHANGES REQUESTED
Counts: [CRITICAL] 4 · [IMPORTANT] 5 · [NIT] 1
Scope detected: encoding-session
Highlights:
- Missing required per-phase validation reports in the YD 87:9 archive (corpus-prep / hll-encode / validate / commit).
encoding-decisions.yamlschema deviates from established prior seif format (missing per-decisionreviewed_at, wrongalternativesshape, emptyhll_refs).scenario_{pos,neg}_87_9.hllmissing required@show(holds/2)projection for reviewability.- Several archived “phase reports / mappings” still reflect the pre–HAL-2 state (rule-count and traceability drift).
This PR encodes SA YD 87:9 (“chalav keivah” — milk found in the abomasum), adding new food_category values and dedicated detection predicates, with Mechaber heter and Rema tzalul issur d’oraita modeled as separate world assertions. It also archives the corresponding corpus artifacts and adds a per-seif tech-health overlay test.
Changes:
- Add new encoding for YD 87:9 (new HLL + compiled LP) and guard
mixture_has_chalavso chalav_keivah doesn’t trigger the general BB machinery. - Extend schema/vocabulary with new
food_categoryenum values and new derived predicates for chalav_keivah mixture detection. - Add archived corpus package for YD 87:9 (reports, QA set, tests) and update corpus manifest.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/engine/test_tech_health_yd_87_9.py | Adds per-seif production “tech health” overlay checks for YD 87:9 artifacts. |
| mistaber/ontology/meta.lp | Regenerates ontology meta to include new enum values and predicate metadata. |
| mistaber/ontology/corpus/yd_87/seif_9.lp | Adds compiled LP output for the new seif_9 encoding. |
| mistaber/ontology/corpus/yd_87/base.lp | Updates compiled base guard to exclude chalav_keivah types from mixture_has_chalav. |
| mistaber/dsl/vocabulary/base.yaml | Registers new predicates and enum values in the generated vocabulary. |
| mistaber/dsl/schema/sorts.hll | Extends food_category enum with chalav_keivah variants. |
| mistaber/dsl/corpus/yd_87/seif_9.hll | Introduces the YD 87:9 encoding (rules, predicates, annotations, dispute facts). |
| mistaber/dsl/corpus/yd_87/base.hll | Updates mixture_has_chalav guard to exclude chalav_keivah types. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/validation-report.md | Archives validate-phase report (but missing other phase reports required for completeness). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/validation-report-review.md | Archives review-phase validator report for the session checkpoint. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/test_yd_87_9.py | Adds archived python tests validating detection + Mechaber/Rema outcomes for the new encoding. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/scenario_pos_87_9.hll | Adds positive scenario fixture for tzalul case (needs @show(holds/2)). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/scenario_neg_87_9.hll | Adds negative scenario fixture for karush case (needs @show(holds/2)). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/review-package.md | Archives human review package for the seif. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/qa-set.yaml | Archives QA set describing coverage intent and per-question scenarios. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-report.md | Archives encoding report (currently inconsistent with final 7-rule state). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-mapping.yaml | Archives statement→rule mapping (currently missing HAL-2 hanaah rule and updated counts). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/encoding-decisions.yaml | Archives encoding decisions (schema/fields drift vs established format). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-report.md | Archives corpus report (still contains stale [PENDING] markers). |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-sources.yaml | Archives fetched sources and commentary texts for the seif. |
| mistaber/corpus/yoreh_deah/siman_87/seif_9/corpus-chain.mermaid | Adds mermaid graph for the seif’s source chain. |
| mistaber/corpus/corpus-manifest.yaml | Registers YD 87:9 as complete and updates overall progress totals. |
Comments suppressed due to low confidence (1)
mistaber/corpus/yoreh_deah/siman_87/seif_9/tests/test_yd_87_9.py:249
- [IMPORTANT] This seif introduces new production rule IDs, but the archived test suite does not include any
engine.explain(...)assertions to capture derivation traces / makor evidence for the newholds(...)claims. The codebase already uses explain-based tests (e.g. YD 87:3) to pin rule provenance.
Concrete remediation: add at least one explain-based test (ideally covering both Mechaber heter and Rema tzalul issur) and assert that the derivation/tree includes the expected rule ID and a sa("yd:87:9") makor.
def test_scenario_neg_inline(self, engine):
"""Negative scenario: karush + beheima — triggers karush mixture (inline facts)."""
facts = (
"food(bf_neg). food_type(bf_neg, beheima). "
"food(ka_neg). food_type(ka_neg, chalav_keivah_karush). "
"mixture(mk_neg). contains(mk_neg, bf_neg). contains(mk_neg, ka_neg)."
)
result = engine.analyze(facts, world="rema")
atoms = [str(a) for a in result["atoms"]]
assert any("is_chalav_keivah_karush_mixture(mk_neg)" in a for a in atoms), (
f"Negative scenario must trigger is_chalav_keivah_karush_mixture."
)
| --- | ||
| phase: validate | ||
| passed: true | ||
| validated_at: "2026-06-04T06:30:00Z" | ||
| validator: "validate-skill-self-check" |
| decisions: | ||
| - id: "ED-87-9-001" | ||
| type: event_identification | ||
| confidence: definitive | ||
| reviewed: true |
| # NOTE: Sources Chullin 116a, Rashi on Chullin 116a, Tosafot on Chullin 116a, | ||
| # Rif on Chullin, and Kaf HaChayim on SA YD 87:74-75 are pending fetch | ||
| # due to Sefaria SSE session expiry. To be added before hll-encode phase. | ||
|
|
| | `r_rema_keivah_karush_heter` | rema | heter | — | Rema: karush keivah milk = mutar (not chalav) | | ||
| | `r_rema_keivah_tzalul_issur_bishul` | rema | issur | d_oraita | Rema: tzalul keivah milk + beheima = issur bishul d'oraita | | ||
| | `r_rema_keivah_tzalul_issur_achiila` | rema | issur | d_oraita | Rema: tzalul keivah milk + beheima = issur achiila d'oraita | | ||
|
|
||
| **Total: 6 rules** (3 Mechaber heter + 1 Rema karush heter + 2 Rema tzalul issur) |
| - statement_id: s3 | ||
| type: ISSUR | ||
| rule_ids: | ||
| - r_rema_keivah_tzalul_issur_bishul | ||
| - r_rema_keivah_tzalul_issur_achiila | ||
| predicate: "issur" | ||
| world: rema | ||
| authority: "rema (Rabbenu Tam/Rosh)" | ||
| madrega: d_oraita | ||
| machloket: true | ||
| notes: "Rema: tzalul = chalav mamash → issur d'oraita with beheima. SA gloss: 'vechen nohagim'. Taz sk7 confirms Rema follows Rabbenu Tam." |
| @show(is_chalav_keivah_tzalul_mixture/1) | ||
| @show(is_chalav_keivah_mixture/1) | ||
| @show(asserts/2) |
| @show(is_chalav_keivah_karush_mixture/1) | ||
| @show(is_chalav_keivah_mixture/1) | ||
| @show(asserts/2) |
|
|
||
| @rule(r_keivah_mechaber_heter_achiila) | ||
| @makor([sa("yd:87:9"), tur("yd:87"), rif("chullin:38b"), rambam("maachalot:9:15"), bab("chullin:116b")]) | ||
| @encoding_note("ED-87-9-001: Mechaber heter for achiila — derived from the not-chalav classification ('einо chalav'), not explicitly stated in the SA text (which mentions only bishul: 'mutar levashel bo basar'). If the substance is not halachic chalav at all, the achiila and hanaah prohibitions of basar bechalav do not arise.") |
| ``` | ||
| Torah: Shemot 23:19 (lo tevashel gedi b'chalev imo) | ||
| ↓ | ||
| Mishnah Chullin 8 (kol habasar — BB framework) | ||
| ↓ | ||
| Gemara Chullin 109b:9 (baraita: keivah bishul b'chalavah) | ||
| ↓ [PENDING: Chullin 116a full sugya] | ||
| Rif on Chullin [PENDING] | Rashi | Rabbenu Tam | ||
| ↓ ↓ ↓ | ||
| Rambam MT 9:15 both assur karush mutar | ||
| (pirsha — mutar) tzalul assur | ||
| ↓ | ||
| Tur YD 87 (documents full 3-way machloket) | ||
| ↓ | ||
| Beit Yosef YD 87 (rules like Rif) | ||
| ↓ | ||
| SA YD 87:9 (Mechaber=Rif; Rema gloss=Rabbenu Tam) | ||
| ↓ | ||
| Shach sk24/25, Taz sk7, Aruch HaShulchan 87:38 | ||
| [PENDING: Kaf HaChayim 87:74-75] | ||
| ``` |
Encoding Summary
Key Rulings
Key principle: Rambam MT 9:15 — "חלב המכונס בה פירשא בעלמא" (the milk collected in it is merely secretion). Primary Talmudic source: Chullin 116b hilkheta.
Review Finding (HAL-2)
issur(hanaah, d_oraita) was missing for Rema/tzalul — added at review phase. If tzalul = chalav mamash, all three BB prohibitions apply (bishul + achiila + hanaah).
Schema Changes
food_categoryenum values:chalav_keivah,chalav_keivah_karush,chalav_keivah_tzalulbase.hllguard extension (ED-87-9-003): keivah milk isolated frommixture_has_chalavSource Chain (18 sources)
Chullin 116b → Chullin 116a → Rif Chullin 38b → Rambam MT 9:15 → Tur YD 87 → SA YD 87:9 + Shach sk24/25, Taz sk7, AH 87:35/87:38, Kaf HaChayim 87:74-75, Rashi/Tosafot on Chullin 116a
Test Plan
python -m pytest .mistaber-artifacts/tests/test_yd_87_9.py— 22/22 passpython -m pytest tests/engine/test_tech_health_yd_87_9.py— 4/4 passpython -m pytest tests/engine/test_tech_health.py -m "not perf"— 19/19 passpython -m mistaber.dsl.build— 0 warningsArtifacts
Archived to
mistaber/corpus/yoreh_deah/siman_87/seif_9/Reviewed-by: RNekhoda
Generated by Mistaber Code — Computational Halacha Encoding Agent