design(t-paliad-181): Fristen Phase 2 — unified rule model + 12-slice plan
Phase 2 design pass operationalising all 7 m-locked + 8 head-default
picks from audit §9.
Headline architecture:
- ONE unified deadline_rules table (evolved, not replaced) absorbing
Pipeline A + Pipeline C. Adds trigger_event_id, spawn_proceeding_type_id,
combine_op, condition_expr (jsonb AND/OR/NOT), priority (4-way enum),
is_court_set (real column, drops heuristic), lifecycle_state +
draft_of + published_at (rule-editor draft → published lifecycle).
Drops condition_flag, condition_rule_id, is_mandatory, is_optional.
Net +5 columns, 32 → 37.
- paliad.deadline_rule_audit table + DB trigger + RLS for admin-only
rule editing (Q5C). Mandatory reason field. Migration-export
endpoint keeps rules in version control after-the-fact.
- paliad.projects.instance_level column (first/appeal/cassation)
enables DE_INF → DE_INF_OLG → DE_INF_BGH ladder without proceeding_type
re-pick.
- Cross-proceeding spawn wired via spawn_proceeding_type_id FK +
global rule index in the calculator + cycle guard.
- POST /api/tools/event-trigger preserves Pipeline C contract on
unified backend.
Migration path (Steps A-I, ~17 migrations 078-094):
- Step A additive schema → Step B backfill → Step C Pipeline C
data-move → Step D calculator unification (service refactor) →
Step E destructive drops (gated) → Step F project soft-merge
(Q2) → Step G spawn → Step H instance-level → Step I rule_id
backfill on legacy deadlines.
- Read-only trigger on paliad.event_deadlines during the cutover
window prevents drift.
- Backup snapshots before destructive drops.
12 prioritized slices (§10) for Phase 3:
- Slices 1-4 sequential: schema, backfill, Pipeline C migration,
calculator unification.
- Slices 5-8 parallel: project soft-merge, event-trigger endpoint,
spawn wiring, instance level.
- Slices 9-10 cleanup: destructive drops, rule_id fuzzy-match
backfill.
- Slices 11a + 11b: rule-editor backend + frontend (HEAVIEST,
lands last on stable schema).
- Slice 12: orphan concept seed (wiedereinsetzung first), through
the editor as its real-world workout.
§9 risk surface: destructive migrations, audit-log compliance gap
during cutover (mitigated by SET LOCAL audit_reason in migration
tooling), cross-corpus drift window (mitigated by read-only
trigger), condition_expr jsonb perf (trivial at 172-row scale),
migration-export manual step.
§12 has 12 open questions for HEAD (not m) — sub-decisions head
resolves at slice-start: migration window, draft lifecycle for
v1, audit retention, preview implementation, export format, slice
ordering, cycle-guard strictness, picker placement, testing scope,
ambiguity-tail handling, seed-vs-editor ordering, telemetry.
§0 drift since 2026-05-13 audit: 1 fristenrechner code deactivated
(20→19 active); mig 075-077 are SmartTimeline, NOT Fristen-logic;
new concept (56→57); new event_types (40→45). All audit findings
hold.
NOT self-merged. Head gates Phase 3 transition (no m-gate).
NOT cronus per memory directive 2026-05-06.