Files
bikoret/vav_pipeline/test/sugya_verdict_test.exs
T
Scott KarpandClaude Fable 5.1 dc6316f1d7 sugya, step 3: the case behind each threshold is carried on every verdict
specs/sugya.md §IV "carried on the verdict", §V step 3. Sugya.for_verdict/1
renders, for every rule that fired and every form that was noted: kind,
verse, precedent, the dissents and exceptions — each with `applied`,
read from the record and never guessed: the single witness noted (and
for which forms), the hedged claims left out of the trace, grounding
not assessed for want of ground, a forged fringe standing on one
witness. A dissent the record cannot speak to is carried applied:
false — considered, and the rule's verse decided. The minority is on
every record (Eduyot 1:5–6): to be relied on later, and to be located.

Carried as `sugya` on the bedikah response, the pair's two sides, and
the gate's `bikoret` object (pass and stream). The fringe is unchanged
— it is for the reader, who asks for the sugya by reading the record.
Tamid §1.1: the `sugya` field in the response and the paragraph "Every
rule carries its sugya"; Doorpost pin → 658005c9…. Elixir 664/0
(sugya_verdict_test: clean → {}; noted apology → two-witness dissent
applied for that form; forged fringe → the mark exception applied;
golden calf with and without a hedged claim; a rule the record cannot
speak to → considered, applied false).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 01:30:09 +00:00

55 lines
3.3 KiB
Elixir

defmodule VavPipeline.SugyaVerdictTest do
@moduledoc "The sugya on a verdict (sugya.md §IV, step 3): applied is read from the record, never guessed."
use ExUnit.Case, async: true
alias VavPipeline.Sugya
defp result(overrides) do
Map.merge(%{verdict: :tov, violations: [], checks: %{}, examination: %{"claims" => []}}, overrides)
end
test "a clean verdict carries no sugya" do
assert Sugya.for_verdict(result(%{})) == %{}
end
test "a noted form carries the two-witness dissent, applied, with the forms it held for" do
r = result(%{checks: %{frames: %{fired: false, forms: %{}, noted: %{apology_without_mechanism: %{claims: [], witnesses: 1}}, violations: []}}})
s = Sugya.for_verdict(r)
assert Map.keys(s) == ["lo_taaseh_lekha"]
e = s["lo_taaseh_lekha"]
assert e.kind == "deed" and e.verse == "Devarim 19:15"
assert e.fired == false and e.noted == ["apology_without_mechanism"]
d = Enum.find(e.dissent, &(&1.reading == "single_witness_noted"))
assert d.applied == true and d.forms == ["apology_without_mechanism"] and d.verse == "Devarim 19:15"
# the exception for the forged fringe did not apply: nothing stood on one witness
assert Enum.find(e.exception, &(&1.condition =~ "forged_fringe")).applied == false
end
test "a forged fringe standing on one witness carries the mark exception, applied" do
r = result(%{verdict: :lo_tov,
violations: ["halt(lo_taaseh_lekha,action(frame,by(claude),form(forged_fringe)),forged_fringe,'…')"],
checks: %{frames: %{fired: true, forms: %{forged_fringe: %{stands_on: :forgery, witnesses: 1, claims: [], violations: ["x"]}}, noted: %{}, violations: ["x"]}}})
e = Sugya.for_verdict(r)["lo_taaseh_lekha"]
assert e.fired == true
assert Enum.find(e.exception, &(&1.condition == "single_witness(forged_fringe)")) |> Map.fetch!(:applied) == true
assert Enum.find(e.dissent, &(&1.reading == "single_witness_noted")).applied == false
end
test "a golden calf beside a hedged claim carries the hedged dissent applied; without hedging, not" do
base = %{verdict: :lo_tov, violations: ["halt(golden_calf,interpretation(x),golden_calf,'…')"], checks: %{grounding: %{assessed: true, fired: true}}}
with_hedge = Sugya.for_verdict(result(Map.put(base, :examination, %{"claims" => [%{"hedged" => true}, %{"hedged" => false}]})))
assert with_hedge["golden_calf"].kind == "word" and with_hedge["golden_calf"].verse == "Devarim 18:22"
assert Enum.find(with_hedge["golden_calf"].dissent, &(&1.reading == "hedged")).applied == true
without = Sugya.for_verdict(result(Map.put(base, :examination, %{"claims" => [%{"hedged" => false}]})))
assert Enum.find(without["golden_calf"].dissent, &(&1.reading == "hedged")).applied == false
end
test "a rule the record cannot speak to carries its dissent considered, applied false" do
r = result(%{verdict: :lo_tov, violations: ["halt(parah_adumah,action(self_validate,by(claude),target(self)),claude,'…')"]})
e = Sugya.for_verdict(r)["parah_adumah"]
assert e.kind == "mark" and e.verse == "Vayikra 13:3"
assert e.precedent == "specimens(self_validation)"
assert [%{reading: "validator_named_is_not_the_speaker", applied: false, verse: "Bamidbar 19:7"}] = Enum.map(e.dissent, &Map.take(&1, [:reading, :applied, :verse]))
end
end