Files
Scott KarpandClaude Fable 5.1 6d3411fcfa engine: a word's root is what L1 records for it (tablet 33)
The Shoresh Engine never opened L1 to find a root. extractRoots called
every word of two or three letters a root and dropped every longer one:
את → א-ת-ה (padded with a He the text never wrote), ואת → ו-א-ת,
בכל → ב-כ-ל; ויאמר, ואהבת, אלהים → nothing. Handed all of Devarim 6:5
it found no א-ה-ב. Binyan was "Qal" for everything, nouns included.

shoresh-engine:
- Shoresh.Roots: an index over all of L1 (5853 verses, built once at
  server start, <1 s). A word resolves, in order: from the verse in
  scope (its own shoresh, with the binyan read from the verb's
  morphology; else its lemma's shoresh — לבבך → לבב); else the way Torah
  most often reads that surface form (its commonest lemma decides, so
  אשר the particle has no root); else a root the asker named, if Torah
  knows it. A word in the verse that L1 gives no root has none, whatever
  a homograph elsewhere carries. Unknown words yield nothing.
- Roots are rendered as L1 records them: two letters stay two letters.
- binyan is null unless a verb stands in the scoped verse.
- L1 is found via L1_MOUNT_POINT, not the literal l1/ relative to cwd —
  which is why parse_tree was null on the pod.
- Adds "surface" and "derivation" to each root (verse|lemma|torah|
  named_root). 22 new HSpec examples; 55 examples, 0 failures.

vav_pipeline:
- normalize_root places a lemma-derived root at the word it was heard
  from (L1 has no shoresh on לבבך to search by).
- A binyan is printed only where there is one; "binyan unknown" on a
  noun claimed a question that does not exist.
- test/tablet33_engine_roots_test.exs: the new shape through the router.
- liveness_test: clear a halt leaked by halt_monitor_test (the seed
  0/191243 flake, present since before tablet 30).
  461 tests, 0 failures on seeds 0 42 191243.

Verified before push with BOTH built images, the real engine binary and
a local PostgreSQL 16 (SSL): Devarim 6:5 → א-ה-ב (Qal, word 1), י-ה-ו,
א-ל-ה, כ-ל (words 5,7,9), ל-ב-ב, נ-פ-ש, מ-א-ד; 4 interpretations
written to L3, 0 L3_WRITE_FAILED, health healthy.

NOT repaired here: the quality of L1's own shoresh field, which the
engine is now faithful to — ויהי is recorded as יהי, שמים as שמ, יהוה
as יהו, הבאתי as בא. That is the quarry's tablet (scripts/build_l1.py)
and it changes the L1 hash; a decision, not a patch.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 17:28:08 +00:00

75 lines
2.5 KiB
Elixir

defmodule VavPipeline.LivenessTest do
@moduledoc """
Kohen Day 3, restart 1 (2026-09-07): both probes pointed at
/kodesh/health; a fresh pod with no manna read "degraded" → 503 → the
kubelet killed a live, serving process every three minutes until the
kohen wrote today.json.
tamid §2.1 check 3: manna absent → WAIT. Not die.
/kodesh/live answers one question — must this process be restarted —
and looks at nothing that is a wait state.
"""
use ExUnit.Case, async: false
use Plug.Test
alias VavPipeline.BigdeiKodesh.Router
alias VavPipeline.HaltMonitor
@opts Router.init([])
setup do
# Make sure no provision exists — the exact state of a fresh pod.
File.rm(VavPipeline.Manna.provision_file())
# ...and no halt. halt_monitor_test leaves the monitor halted on some
# seeds (0, 191243), and a fresh pod is not halted.
if HaltMonitor.halted?(), do: HaltMonitor.resolve("liveness test setup")
:ok
end
test "live is 200 with NO manna, while health is 503 (wait, not die)" do
health = conn(:get, "/kodesh/health") |> Router.call(@opts)
assert health.status == 503
assert Jason.decode!(health.resp_body)["checks"]["manna_present"] == "fail"
live = conn(:get, "/kodesh/live") |> Router.call(@opts)
assert live.status == 200
body = Jason.decode!(live.resp_body)
assert body["live"] == true
assert body["halt_monitor_alive"] == true
assert body["halt_status"] == "running"
end
test "live is 200 while HALTED — a halt is a state, not a death" do
HaltMonitor.halt!(:avodah_zarah, "liveness test", "test")
try do
assert HaltMonitor.halted?()
live = conn(:get, "/kodesh/live") |> Router.call(@opts)
assert live.status == 200
assert Jason.decode!(live.resp_body)["halt_status"] =~ "halted: avodah_zarah"
# And the public ring says so, rather than serving.
peah =
conn(:post, "/peah/ask", Jason.encode!(%{question: "בראשית ברא אלהים"}))
|> put_req_header("content-type", "application/json")
|> Router.call(@opts)
assert peah.status == 503
assert Jason.decode!(peah.resp_body)["error"]["code"] =~ "HALT_"
after
HaltMonitor.resolve("liveness test cleanup")
end
end
test "live touches neither manna nor L3 nor the cycle" do
VavPipeline.MannaLedger.reset()
on_exit(fn -> VavPipeline.MannaLedger.reset() end)
before = VavPipeline.MannaLedger.ledger()
conn(:get, "/kodesh/live") |> Router.call(@opts)
assert VavPipeline.MannaLedger.ledger() == before
end
end