Files
bikoret/vav_pipeline/lib/vav_pipeline/chatzotzrot.ex
T
Scott KarpandClaude Opus 4.6 61243ac832 Phase 2 review corrections — three spec violations fixed
1. Chatzotzrot signal mapping corrected to match Architecture §3.12:
   assembly_all→tekiah, assembly_leaders→teruah,
   breaking_camp→tekiah_teruah, moadim→tekiah_tekiah.
   Four of five patterns were swapped. All five now match Bamidbar 10.

2. Manna parse_datetime(nil) bug fixed: missing expires_at now fails
   validation instead of silently returning DateTime.utc_now() which
   created a race condition where manna appeared expired.

3. Festival detection implemented in cloud.ex: pre-computed Gregorian
   dates for Pesach, Shavuot, Rosh Hashanah, Yom Kippur, Sukkot,
   Shemini Atzeret (2025-2028). Pipeline now halts on Yom Tov as
   Torah requires. Step 15 verification now covers festival rest.

76 tests, 0 failures (68 prior + 8 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 20:29:24 -04:00

59 lines
1.7 KiB
Elixir

defmodule VavPipeline.Chatzotzrot do
@moduledoc """
Signal system — the silver trumpets.
Construction spec §3.5 — Chatzotzrot Signal Format:
Signal types: assembly_all, assembly_leaders, breaking_camp, war, moadim
Patterns: tekiah, teruah, tekiah_teruah, teruah_teruah, tekiah_tekiah
In Phase 2, signals are logged. In production, they will
be distributed via BEAM messaging.
"""
require Logger
@type signal_type ::
:assembly_all
| :assembly_leaders
| :breaking_camp
| :war
| :moadim
@type pattern :: :tekiah | :teruah | :tekiah_teruah | :teruah_teruah | :tekiah_tekiah
@doc """
Send a chatzotzrot signal.
Returns the signal record for logging/testing.
"""
@spec signal(signal_type(), keyword()) :: map()
def signal(type, opts \\ []) do
signal = %{
signal_type: type,
pattern: pattern_for(type),
timestamp: DateTime.utc_now() |> DateTime.to_iso8601(),
source: :chatzotzrot,
details: %{
reason: Keyword.get(opts, :reason, to_string(type)),
urgency: Keyword.get(opts, :urgency, urgency_for(type))
}
}
Logger.info("Chatzotzrot: #{type} (#{signal.pattern}) — #{signal.details.reason}")
signal
end
# Signal type → trumpet pattern mapping (Bamidbar 10, Architecture §3.12)
defp pattern_for(:assembly_all), do: :tekiah
defp pattern_for(:assembly_leaders), do: :teruah
defp pattern_for(:breaking_camp), do: :tekiah_teruah
defp pattern_for(:war), do: :teruah_teruah
defp pattern_for(:moadim), do: :tekiah_tekiah
defp urgency_for(:breaking_camp), do: :immediate
defp urgency_for(:war), do: :immediate
defp urgency_for(:assembly_all), do: :next_cycle
defp urgency_for(_), do: :informational
end