Phase 2 P1 / m's Q5 divergence (2026-05-27, verbatim):
"Reverse the unification as suggested in 3. They are different
proceedings, I only wanted the approach to be unified in the
'determinator' — but they are actually different proceedings!"
Mig 155 reverts the mig-096 unification:
Before: id=160 upc.apl.unified active (16 rules), id=11/19/20 inactive
After: id=11 upc.apl.merits (7 rules), id=19 upc.apl.cost (2 rules),
id=20 upc.apl.order (7 rules) all active; id=160 inactive
The 16 rules under id=160 split cleanly by event_code prefix; all 10
parent_id edges among them are bucket-local (pre-flight audit), so
the tree shape survives the rebind unchanged.
Spawn FK retarget: pi.cfi.appeal_spawn flips from 11 (merits) → 20
(orders track) per design §3.1 — PI appeals land on orders, not
merits. The inf/rev/dmgs spawns keep target=11 (merits), now active.
Determinator routing layer (proceeding_mapping.go) keeps its single
"Berufung" front door per m's intent — only the data shape changes.
Pre-flight verified: 0 projects bound to id=160, 0 scenarios reference
upc.apl. Zero data migration on the project side.
Tests: lookup_events_test.go assertions on the three appeal_target
buckets updated to the new codes (endentscheidung → upc.apl.merits,
schadensbemessung → upc.apl.merits, bucheinsicht → upc.apl.order).
Same rule set, post-split coordinates.
Snapshot regen (pkg/litigationplanner/embedded/upc/) deferred: the
current snapshot only contains inf+rev so the apl re-split doesn't
shift its contents; regenerating would surface unrelated active PTs
and pollute this slice. Tracked as a follow-up.
Verified: go vet clean, go test ./internal/services/... -run
LookupEvents|proceeding_codes clean.
Design: docs/design-deadline-system-revision-2026-05-27.md §3.1
(re-split mig), §1.3 (spawn graph post-Q5). t-paliad-331.
44 lines
1.5 KiB
PL/PgSQL
44 lines
1.5 KiB
PL/PgSQL
-- 155_upc_apl_resplit.down — t-paliad-331 / m/paliad#149 Phase 2 P1
|
|
--
|
|
-- Best-effort rollback. Restores from the same-TX snapshots written by
|
|
-- mig 155. Drops the snapshots once restoration is verified.
|
|
|
|
BEGIN;
|
|
|
|
SELECT set_config(
|
|
'paliad.audit_reason',
|
|
'mig 155 down: revert upc.apl re-split (restore unified id=160)',
|
|
true
|
|
);
|
|
|
|
-- ----------------------------------------------------------------
|
|
-- 1. Restore proceeding_types.is_active from snapshot.
|
|
-- ----------------------------------------------------------------
|
|
|
|
UPDATE paliad.proceeding_types pt
|
|
SET is_active = pre.is_active
|
|
FROM paliad.proceeding_types_pre_155 pre
|
|
WHERE pt.id = pre.id
|
|
AND pt.is_active IS DISTINCT FROM pre.is_active;
|
|
|
|
-- ----------------------------------------------------------------
|
|
-- 2. Restore rule bindings from snapshot.
|
|
-- ----------------------------------------------------------------
|
|
|
|
UPDATE paliad.sequencing_rules sr
|
|
SET proceeding_type_id = pre.proceeding_type_id,
|
|
spawn_proceeding_type_id = pre.spawn_proceeding_type_id
|
|
FROM paliad.sequencing_rules_pre_155 pre
|
|
WHERE sr.id = pre.id
|
|
AND (sr.proceeding_type_id IS DISTINCT FROM pre.proceeding_type_id
|
|
OR sr.spawn_proceeding_type_id IS DISTINCT FROM pre.spawn_proceeding_type_id);
|
|
|
|
-- ----------------------------------------------------------------
|
|
-- 3. Drop the snapshots.
|
|
-- ----------------------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS paliad.sequencing_rules_pre_155;
|
|
DROP TABLE IF EXISTS paliad.proceeding_types_pre_155;
|
|
|
|
COMMIT;
|