mAi: #95 - t-paliad-264 - fix de.inf.lg Replik/Duplik sequencing

Replik and Duplik had parent_id = NULL with a 4-week placeholder
duration, so the projection anchored both off the proceeding's
trigger date (Klageerhebung) - both rows rendered at the same
calendar date AND before Klageerwiderung.

Migration 124 anchors Replik on Klageerwiderung
(de.inf.lg.erwidg) and Duplik on Replik, and marks both
is_court_set = true with legal_source DE.ZPO.273. The 4-week
placeholder duration is retained so the timeline gives a sane
notional date for each row; the lawyer overrides it with "Datum
setzen" once the court issues the actual period.

Each UPDATE is guarded by parent_id IS NULL so a re-apply against
a DB that already carries the fix no-ops cleanly (mig 095
convention). No new audit-log rows on idempotent re-runs.

Slot note: originally landed as 123 in an earlier iteration;
cronus's t-paliad-246 Backup-Mode migration won slot 123 in the
parallel merge race, so this migration shifted to slot 124.

ZPO citations in the migration comment per the t-paliad-264 brief:
  - Klageerhebung           - section 253 ZPO
  - Anzeige Verteidigungsbereitschaft - section 276 Abs. 1 S. 1 ZPO
  - Klageerwiderung         - section 276 Abs. 1 S. 2 + section 277 ZPO
  - Replik / Duplik         - vom Gericht bestimmte Frist
    (section 273 ZPO Anordnungskompetenz; section 282 ZPO
    prozessuale Foerderungspflicht)

Verified ordering for trigger 2026-05-25:
  Klage         2026-05-25 Mon
  Anzeige       2026-06-08 Mon
  Klageerwidg   2026-07-06 Mon
  Replik        2026-08-03 Mon
  Duplik        2026-08-31 Mon

Each row strictly later than the previous; Replik and Duplik no
longer collide on the same date and no longer precede the
Klageerwiderung.
This commit is contained in:
mAi
2026-05-25 15:27:03 +02:00
parent 51fca9383f
commit 8c94dccf83
2 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
-- Revert t-paliad-264 / m/paliad#95.
-- Restores Replik and Duplik to parent_id = NULL with the pre-fix
-- "Frist vom Gericht bestimmt" placeholder note. The pre-fix rows
-- carried legal_source = NULL and is_court_set = false; both
-- placeholder durations (4 weeks) are left untouched (the .up
-- migration did not modify them).
--
-- audit_reason set_config required for the mig 079 trigger.
SELECT set_config(
'paliad.audit_reason',
'mig 124 revert: unwind de.inf.lg Replik/Duplik sequencing back to pre-#95 placeholder state',
true);
UPDATE paliad.deadline_rules
SET parent_id = NULL,
is_court_set = false,
legal_source = NULL,
deadline_notes = 'Frist vom Gericht bestimmt',
deadline_notes_en = NULL
WHERE submission_code = 'de.inf.lg.replik'
AND is_active = true;
UPDATE paliad.deadline_rules
SET parent_id = NULL,
is_court_set = false,
legal_source = NULL,
deadline_notes = 'Frist vom Gericht bestimmt',
deadline_notes_en = NULL
WHERE submission_code = 'de.inf.lg.duplik'
AND is_active = true;

View File

@@ -0,0 +1,94 @@
-- t-paliad-264 / m/paliad#95 — Fix de.inf.lg Replik + Duplik sequencing.
--
-- BEFORE this migration, the de.inf.lg rules for Replik and Duplik
-- had parent_id = NULL with duration_value = 4 weeks each. The
-- projection therefore anchored both off the proceeding's trigger
-- date (Klageerhebung) and added 4 weeks → both rows rendered at the
-- same calendar date, BEFORE Klageerwiderung (which sits at
-- Klageerhebung + 6 weeks per § 276 Abs. 1 S. 2 ZPO).
--
-- Correct ZPO sequence for first-instance infringement before the
-- Landgericht is:
--
-- Klageerhebung (§ 253 ZPO)
-- → Anzeige der Verteidigungsbereitschaft (§ 276 Abs. 1 S. 1 ZPO,
-- 2 Wochen ab Zustellung der Klage)
-- → Klageerwiderung (§ 276 Abs. 1 S. 2 + § 277 ZPO; vom Gericht
-- gesetzte Frist von mindestens 2 Wochen, in der Praxis 6 Wochen)
-- → Replik (vom Gericht gesetzte Frist; Anordnungskompetenz aus
-- § 273 ZPO, prozessuale Förderungspflicht der Parteien aus
-- § 282 ZPO; in der Praxis ~ 4 Wochen ab Zustellung der
-- Klageerwiderung)
-- → Duplik (vom Gericht gesetzte Frist; § 273, § 282 ZPO; in der
-- Praxis ~ 4 Wochen ab Zustellung der Replik)
--
-- Replik and Duplik have NO statutory period — the Landgericht fixes
-- the period in its prozessleitende Verfügung. We model them as
-- is_court_set = true with a placeholder 4-week duration anchored on
-- the immediately preceding filing so the timeline (a) renders them
-- in strict chronological order and (b) gives the lawyer a sane
-- notional date that can be overridden via "Datum setzen" once the
-- court issues the actual period.
--
-- legal_source set to DE.ZPO.273 (Vorbereitung des Termins —
-- court's case-management power that authorises setting Replik /
-- Duplik periods). The full citation chain (§§ 273, 282 ZPO) lives
-- in deadline_notes so the rendered card explains the source.
--
-- Scope strictly de.inf.lg / cfi per the t-paliad-264 brief. Other
-- jurisdictions are out of scope and will be addressed via curie's
-- m/paliad#94 audit follow-ups (Wave 0+).
--
-- Slot note: this migration originally landed as 123 in an earlier
-- iteration; cronus's t-paliad-246 Backup-Mode migration won slot
-- 123 in parallel-merge order, so this one shifted to 124.
--
-- Idempotency: each UPDATE is guarded by a WHERE clause that only
-- matches the pre-fix row state (parent_id IS NULL on Replik /
-- Duplik, since that was the load-bearing bug). A re-apply against
-- a DB that already carries the fix matches zero rows and no-ops —
-- no duplicate audit-log rows in paliad.deadline_rule_audit, no
-- redundant writes. Mig 095 convention.
--
-- audit_reason set_config required at the top — the mig 079 trigger
-- on paliad.deadline_rules raises EXCEPTION 'audit reason required'
-- on any UPDATE without it.
SELECT set_config(
'paliad.audit_reason',
'mig 124: t-paliad-264 / m/paliad#95 — anchor de.inf.lg Replik on Klageerwiderung and Duplik on Replik, mark both is_court_set per § 273 ZPO',
true);
-- Replik anchors on Klageerwiderung (de.inf.lg.erwidg).
-- Guard: parent_id IS NULL — only fires against the pre-fix shape.
UPDATE paliad.deadline_rules
SET parent_id = (
SELECT id FROM paliad.deadline_rules
WHERE submission_code = 'de.inf.lg.erwidg'
AND is_active = true
LIMIT 1
),
is_court_set = true,
legal_source = 'DE.ZPO.273',
deadline_notes = 'Frist vom Gericht in der prozessleitenden Verfügung bestimmt (§ 273 ZPO, prozessuale Förderungspflicht § 282 ZPO). In der Praxis ca. 4 Wochen ab Zustellung der Klageerwiderung; mit "Datum setzen" überschreiben, sobald die gerichtliche Verfügung vorliegt.',
deadline_notes_en = 'Period set by the court in its case-management order (§ 273 ZPO; parties'' duty to file timely under § 282 ZPO). Typically ca. 4 weeks after service of the Statement of Defence; use "Set date" to override once the court issues the actual period.'
WHERE submission_code = 'de.inf.lg.replik'
AND is_active = true
AND parent_id IS NULL;
-- Duplik anchors on Replik (de.inf.lg.replik).
-- Guard: parent_id IS NULL — only fires against the pre-fix shape.
UPDATE paliad.deadline_rules
SET parent_id = (
SELECT id FROM paliad.deadline_rules
WHERE submission_code = 'de.inf.lg.replik'
AND is_active = true
LIMIT 1
),
is_court_set = true,
legal_source = 'DE.ZPO.273',
deadline_notes = 'Frist vom Gericht in der prozessleitenden Verfügung bestimmt (§ 273 ZPO, prozessuale Förderungspflicht § 282 ZPO). In der Praxis ca. 4 Wochen ab Zustellung der Replik; mit "Datum setzen" überschreiben, sobald die gerichtliche Verfügung vorliegt.',
deadline_notes_en = 'Period set by the court in its case-management order (§ 273 ZPO; parties'' duty to file timely under § 282 ZPO). Typically ca. 4 weeks after service of the Reply; use "Set date" to override once the court issues the actual period.'
WHERE submission_code = 'de.inf.lg.duplik'
AND is_active = true
AND parent_id IS NULL;