feat(deadline-rules/is-optional): conditional rules opt-in via save modal

m's 2026-05-08 batch Item 2: some rules don't always apply per-instance.
Antrag auf Kostenentscheidung (RoP.151) only fires when a party files
for it; some appeal-related deadlines depend on specific facts. Today
they render in the timeline as if always applicable; the save-to-
project modal pre-checks them so the user has to remember to uncheck.

New paliad.deadline_rules.is_optional bool flag (default false). Threads
through the Go model, ruleColumns SELECT, UIDeadline JSON, and the
frontend save modal:

  - Migration 066 adds the column + comment + a starter UPDATE that
    flips RoP.151 to is_optional=true. m can flip more via SQL as he
    reviews the rule library — distinct from is_mandatory, which is
    about statutory strictness once the rule applies (an "auf Antrag"
    rule can be is_mandatory=true once requested).
  - Save modal: optional rows pre-uncheck (the user opts in) and a
    small "auf Antrag" / "on request" pill renders in the meta line.
    Court-determined rows still pre-uncheck via the existing disabled
    path; isOptional doesn't override that.

Migration applied to live Supabase; tracker at v66.

Refs m/paliad#15 (m's 2026-05-08 18:21 follow-up batch Item 2).
This commit is contained in:
m
2026-05-08 18:26:26 +02:00
parent 614f9af753
commit 2d6ea3ee33
9 changed files with 77 additions and 3 deletions

View File

@@ -0,0 +1,3 @@
-- Reverse t-paliad-157 / m's batch Item 2.
ALTER TABLE paliad.deadline_rules DROP COLUMN IF EXISTS is_optional;

View File

@@ -0,0 +1,33 @@
-- t-paliad-157 / m's 2026-05-08 batch Item 2: mark rules that are not
-- always part of every proceeding instance as optional. Examples m
-- named: Antrag auf Kostenentscheidung (RoP.151) — only fires when a
-- party files for it; some appeal-related deadlines that depend on
-- specific facts.
--
-- Distinct from is_mandatory: a rule can be is_mandatory=true (the
-- deadline is statutorily fixed when it applies) AND is_optional=true
-- (whether the deadline applies at all is a per-case choice). Default
-- false on backfill so the existing always-applies semantic stays.
--
-- Frontend reads is_optional and pre-unchecks the row in the save-
-- to-project modal; user toggles to opt in. Timeline view stays
-- unchanged — the rule still renders so the user sees what could
-- apply.
ALTER TABLE paliad.deadline_rules
ADD COLUMN is_optional boolean NOT NULL DEFAULT false;
COMMENT ON COLUMN paliad.deadline_rules.is_optional IS
'When true, the deadline is conditional on an act the user takes '
'(filing a cost-decision request, choosing to appeal, etc.) and '
'should be opt-in when saving to a project. Distinct from '
'is_mandatory, which is about statutory strictness once the rule '
'applies. Backfill: false on every existing row except a small '
'starter set m identified (RoP.151).';
-- Starter backfill: m's explicit example. More flips can land via
-- targeted UPDATEs as m reviews the rule library.
UPDATE paliad.deadline_rules
SET is_optional = true
WHERE rule_code = 'RoP.151'
AND is_active = true;