Backfill applies_to_target: extend merits + order rules to cover Schadensbemessung / Bucheinsicht #134
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
After Slice B1's Berufung unification (m/paliad#124 §18.1), the picker exposes 5 appeal targets:
m's call (2026-05-26 ~15:31): extend
applies_to_targetarrays on the existing rules so Schadensbemessung uses the merits track and Bucheinsicht uses the order track — provided this is legally correct against the actual rules we have.Legal premise (worker MUST verify before drafting the migration)
The UPC R.224 appeal procedure (2-month notice + 4-month grounds) is uniform — it doesn't vary by the kind of substantive decision being appealed. Only the anchor differs (which decision triggers the timeline).
applies_to_target=['endentscheidung']rules to['endentscheidung','schadensbemessung'].applies_to_target=['anordnung']rules to['anordnung','bucheinsicht'].Worker MUST audit the live
paliad.deadline_rulesrows forupc.apl.unifiedfirst. For each of the 16 rules currently bound to it, read therule_code/legal_source/descriptionand confirm the proposed extension fits. Surface any rule where the extension is not obvious — do NOT extend blindly.Migration scope
MAX(version)at write time) — singleUPDATE paliad.deadline_rules SET applies_to_target = applies_to_target || 'schadensbemessung'::text WHERE ...per target, with strict WHERE clauses.SELECT set_config('paliad.audit_reason', 'mig 13X: t-paliad-... — extend applies_to_target for Schadensbemessung/Bucheinsicht per m/paliad#134', true);at the top of.up.sqland.down.sql(deadline_rules audit trigger). This is one of the three traps that bit mig 134 today.applies_to_target. RAISE EXCEPTION if any unexpected row appears.array_remove(applies_to_target, '...')keyed by the same WHERE clauses.deadline_rules.updated_atwrites (table has no such column — fourth trap to avoid).Acceptance
https://paliad.de/tools/verfahrensablauf?appellant=defendant&target=schadensbemessungand?target=bucheinsichtboth render the appropriate timeline (R.224 / R.220 events).go test ./...green, including any lookup_events / Berufung tests.Anti-patterns to avoid (lessons from today's mig 134)
proceeding_types.updated_atdoesn't.set_config('paliad.audit_reason', …)— everyUPDATE paliad.deadline_rulestriggers the audit barrier.Audit: live
paliad.deadline_rulesforupc.apl.unified(proceeding_type_id=160)16 active rules — exact distribution from prod DB just now:
Merits track —
applies_to_target=['endentscheidung'](7 rules) → propose extend with'schadensbemessung'RoP.224.1.aUPC.RoP.224.1.aRoP.224.2.aUPC.RoP.224.2.aRoP.235.1UPC.RoP.235.1RoP.237UPC.RoP.237RoP.238.1UPC.RoP.238.1Legal fit (Schadensbemessung): Schadensbemessungs-Entscheidung is a substantive judgment rendered under the same R.118 framework as an Endentscheidung (R.118.4 explicitly covers damages quanta as part of the Hauptentscheidung family). The R.224 appeal timeline does not vary by which substantive R.118 decision is being appealed — only the anchor (the decision being challenged) differs. Therefore all 7 merits-track rules transfer cleanly. The two no-rule_code anchor children (hearing, decision) are part of the merits procedural flow and apply to any R.224 appeal.
Order track —
applies_to_target=['anordnung'](7 rules) → propose extend with'bucheinsicht'RoP.220.2UPC.RoP.220.2RoP.220.3UPC.RoP.220.3RoP.224.2.bUPC.RoP.224.2.bRoP.235.2UPC.RoP.235.2RoP.237UPC.RoP.237RoP.238.2UPC.RoP.238.2Legal fit (Bucheinsicht): Bucheinsicht-Anordnungen sind Anordnungen unter R.190 (Lay-open-books-Anordnung als Teil des damage-assessment-Verfahrens) bzw. R.196 (vorläufige Anordnungen). Beide sind Anordnungen im Sinne von R.220.2: appealable mit Zulassung (R.220.2 — 15 Tage) oder via diskretionäre Überprüfung (R.220.3). Der gesamte Order-Track (R.224.2.b Begründung, R.235.2 Erwiderung, R.237/238.2 Anschlussberufung) ist uniform — er hängt nicht vom Inhalt der angegriffenen Anordnung ab. Alle 7 Order-Track-Rules übertragen sich daher sauber.
Cost track —
applies_to_target=['kostenentscheidung'](2 rules) → NOT touchedRoP.221.1UPC.RoP.221.1Intentional non-action: the kostenentscheidung leave-to-appeal track is distinct from both merits and order procedures and is not part of this slice.
Ambiguous cases
None surfaced. Every endentscheidung rule is a generic R.224 merits-track step (or an anchor-child); every anordnung rule is a generic R.220/224/235/237/238 order-track step (or an anchor-child). No rule carries content that is specific to a particular type of underlying decision/order — they describe procedural steps, not substantive subject matter.
Plan
Migration 137 (next available;
MAX(version)=106inpaliad_schema_migrations, last file is136_procedural_events_additive):set_config('paliad.audit_reason', 'mig 137: t-paliad-303 — extend applies_to_target for Schadensbemessung (merits) + Bucheinsicht (order) per m/paliad#134', true)at top of both up + down.applies_to_target, RAISE EXCEPTION if any unexpected row shape appears.SET applies_to_target = applies_to_target || 'schadensbemessung'::text WHERE pt.code='upc.apl.unified' AND 'endentscheidung'=ANY(applies_to_target) AND NOT 'schadensbemessung'=ANY(applies_to_target) AND is_active=true— expect 7 rowsSET applies_to_target = applies_to_target || 'bucheinsicht'::text WHERE pt.code='upc.apl.unified' AND 'anordnung'=ANY(applies_to_target) AND NOT 'bucheinsicht'=ANY(applies_to_target) AND is_active=true— expect 7 rowsarray_remove(applies_to_target, 'schadensbemessung')/array_remove(..., 'bucheinsicht')with same WHERE.updated_atwrites (deadline_rules has the column but the migration leaves it as-is — single-purpose touch, not a metadata refresh).Test update:
internal/services/lookup_events_test.go:147(appeal_target=schadensbemessung returns empty) becomes the inverse — schadensbemessung must now return ≥1 anchor row fromupc.apl.unified. Adding a parallel bucheinsicht assertion.Proceeding with the migration.