Devarim 17:9 — v'darashta v'higidu lekha et d'var hamishpat. The inquiry requires that what is found is RECORDED. - Ecto Repo with graceful degradation (maybe_add_repo, like other engines) - Migration: interpretations, minority_opinions, teiku_registry tables - Append-only enforcement via REVOKE UPDATE/DELETE - Includes eish_zarah fields: coupling_trace, grounding_type, challenge_sequence - Ecto schemas: Interpretation, MinorityOpinion, TeikuRecord - Changeset validations: status inclusion, panel_size > 0, grounding_type enum - TeikuRecord.resolve_changeset restricts updates to resolved_at/resolution only - L3.Store bridge module: record, query, count operations - L3 tests tagged @moduletag :l3, excluded by default (no local PostgreSQL) - Enable with: SHORASHIM_L3=1 mix test --include l3 - All 76 existing Elixir tests pass, 195 Prolog tests pass, 33 Haskell tests pass Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
2.3 KiB
Elixir
71 lines
2.3 KiB
Elixir
defmodule VavPipeline.Application do
|
|
@moduledoc """
|
|
OTP Application for the Vav Pipeline.
|
|
|
|
Starts the supervision tree with:
|
|
- Repo (L3 PostgreSQL — oral tradition persistence)
|
|
- ShabbatTimer (mandatory cessation monitor)
|
|
- ShoreshEnginePort (Erlang Port to Haskell engine, if binary found)
|
|
- TalmudicEngineSocket (Unix socket to Prolog engine)
|
|
|
|
Step 14 (Architecture §4): Component connections supervised.
|
|
The port and socket are optional — the pipeline degrades gracefully
|
|
if external engines are not available (clients fall back to stubs).
|
|
"""
|
|
|
|
use Application
|
|
|
|
require Logger
|
|
|
|
@impl true
|
|
def start(_type, _args) do
|
|
shoresh_binary = Application.get_env(:vav_pipeline, :shoresh_engine_binary, "shoresh-engine")
|
|
shoresh_cwd = Application.get_env(:vav_pipeline, :shoresh_engine_cwd, nil)
|
|
talmudic_socket = Application.get_env(:vav_pipeline, :talmudic_socket_path, "/tmp/shorashim/talmudic.sock")
|
|
|
|
children =
|
|
[
|
|
{VavPipeline.ShabbatTimer, []}
|
|
]
|
|
|> maybe_add_repo()
|
|
|> maybe_add_shoresh_port(shoresh_binary, shoresh_cwd)
|
|
|> maybe_add_talmudic_socket(talmudic_socket)
|
|
|
|
opts = [strategy: :one_for_one, name: VavPipeline.Supervisor]
|
|
Supervisor.start_link(children, opts)
|
|
end
|
|
|
|
defp maybe_add_repo(children) do
|
|
repo_config = Application.get_env(:vav_pipeline, VavPipeline.Repo)
|
|
|
|
cond do
|
|
is_nil(repo_config) ->
|
|
Logger.warning("VavPipeline.Repo: no config found — running without L3 persistence")
|
|
children
|
|
|
|
repo_config[:start] == false ->
|
|
Logger.info("VavPipeline.Repo: start disabled — running without L3 persistence")
|
|
children
|
|
|
|
true ->
|
|
[VavPipeline.Repo | children]
|
|
end
|
|
end
|
|
|
|
defp maybe_add_shoresh_port(children, binary, cwd) do
|
|
case System.find_executable(binary) do
|
|
nil ->
|
|
Logger.warning("ShoreshEnginePort: binary '#{binary}' not in PATH — running without Haskell engine")
|
|
children
|
|
|
|
path ->
|
|
children ++ [{VavPipeline.ShoreshEnginePort, [binary: path, cwd: cwd]}]
|
|
end
|
|
end
|
|
|
|
defp maybe_add_talmudic_socket(children, socket_path) do
|
|
# Always add the socket client — it connects lazily on first request
|
|
children ++ [{VavPipeline.TalmudicEngineSocket, [socket_path: socket_path]}]
|
|
end
|
|
end
|