Files
bikoret/vav_pipeline/lib/vav_pipeline/l3/interpretation.ex
T
Scott KarpandClaude Opus 4.6 54880b0682 L3 Oral Tradition: PostgreSQL persistence layer for interpretations, minority opinions, teiku
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>
2026-03-17 09:43:44 -04:00

52 lines
1.7 KiB
Elixir

defmodule VavPipeline.L3.Interpretation do
@moduledoc """
L3 schema for recorded interpretations.
Architecture §3.7: Each interpretation records the case, the reasoning,
the Torah references that grounded it, the panel vote, and the status.
Append-only: once inserted, never updated or deleted.
The oral tradition is written once.
"""
use Ecto.Schema
import Ecto.Changeset
schema "interpretations" do
field :case_ref, :string
field :interpretation, :string
field :status, :string
field :reasoning, :string
field :torah_references, {:array, :string}, default: []
field :roots_involved, {:array, :string}, default: []
field :panel_size, :integer
field :vote_count_for, :integer
field :vote_count_against, :integer
field :shema_context_hash, :string
field :processing_component, :string
field :coupling_trace, {:array, :string}, default: []
has_many :minority_opinions, VavPipeline.L3.MinorityOpinion
timestamps(type: :utc_datetime, updated_at: false)
end
@required_fields [
:case_ref, :interpretation, :status, :reasoning,
:torah_references, :roots_involved,
:panel_size, :vote_count_for, :vote_count_against
]
@optional_fields [:shema_context_hash, :processing_component, :coupling_trace]
@valid_statuses ~w(accepted rejected teiku)
def changeset(interpretation, attrs) do
interpretation
|> cast(attrs, @required_fields ++ @optional_fields)
|> validate_required(@required_fields)
|> validate_inclusion(:status, @valid_statuses)
|> validate_number(:panel_size, greater_than: 0)
|> validate_number(:vote_count_for, greater_than_or_equal_to: 0)
|> validate_number(:vote_count_against, greater_than_or_equal_to: 0)
end
end