proceeding_types taxonomy cleanup — separate primary proceedings from phases and cross-cutting admin #147
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?
m's bug (2026-05-26 21:49)
Live audit (46 active rows in
paliad.proceeding_types, 2026-05-26)Grouping the rows by what they actually represent:
A. Primary proceedings (~13) — these belong in
proceeding_typesSelf-contained matters with their own filing, their own deadline cascade, their own ablauf.
upc.inf.cfiupc.rev.cfiupc.pi.cfiupc.dni.cfiupc.dmgs.cfiupc.disc.cfiupc.bsv.cfiupc.apl.unifiedupc.epo.reviewde.inf.lg/de.inf.olg/de.inf.bghde.null.bpatg/de.null.bghepa.opp.opd/epa.opp.boa/epa.grant.exadpma.opp.dpma/dpma.appeal.bpatg/dpma.appeal.bghB. Phases of a primary proceeding (5) — should NOT be proceeding_types
These are stages WITHIN a CFI procedure, not standalone proceedings. A
upc.inf.cfimatter always passes through interim → oral → decision phases; they're not optionally elected, they're the structure of the parent.upc.cfi.interimupc.cfi.oralupc.cfi.decisionupc.costs.cfiupc.default.cfiC. Side-actions within a proceeding (10) — could go either way
Applications and orders that arise inside a primary proceeding. Treated today as their own "types" but are sub-events of the parent matter.
upc.evidence.cfiupc.experiments.cfiupc.security.cfiupc.intervention.ropupc.parties.changeupc.optout.cfiupc.inspection.cfiupc.freezing.cfiupc.withdrawal.ropupc.rehearing.coaD. Cross-cutting administrative / meta (8) — definitely not proceedings
These describe rules-of-procedure mechanics, not matters a lawyer takes on.
upc.case.mgmtupc.general.ropupc.service.ropupc.language.ropupc.representation.ropupc.fees.courtupc.legalaid.cfiupc.special.cfiupc.reestablishment.ropE. Edge cases — call needed
upc.ccr.cfi(Widerklage auf Nichtigkeit) — technically a sub-procedure of an INF action, never standalone. Hint: handled today via[with_ccr]flag inside UPC_INF.upc.pl.cfi(Schutzschrift) — pre-litigation defensive filing, not a proceeding yet. Could be standalone or a meta-event.The implementation question (m: "a different story")
Four candidate models for phases / side-actions / meta:
kinddiscriminator onproceeding_types—kind text CHECK ('proceeding','phase','side_action','meta'). Minimal schema change; pickers filter by kind. Cheapest. Doesn't model parent-relationship for phases.parent_id—proceeding_types.parent_proceeding_idfor phases / side-actions. Phase rows have akind='phase'and a parent FK; meta rows have NULL parent +kind='meta'. Models the structural relationship cleanly.proceeding_phases+proceeding_side_actions+proceeding_rop_general. Most expressive, most schema churn, queries get more joins.procedural_events— phases like "Zwischenanhörung" are arguably just events anchored to a primary proceeding'sproceeding_type_id. Side-actions like "Besichtigungsantrag" become events with their own follow-up rules. This is the most aggressive: shrinkproceeding_typesto category A (13 rows) and represent everything else as events under those proceedings.Each has different implications for the Fristenrechner overhaul (m/paliad#146) which uses
proceeding_typeas a qualifier in the R3 wizard row — restructuring proceeding_types changes R3's pick list.Data preserved
Whichever model wins, every existing
sequencing_rule.proceeding_type_idmust remain resolvable (no orphaned rules). The mig will reparent before any DROP.Open design questions for the inventor
de.inf.lg/de.inf.olg/de.inf.bghcollapse into onede.infwith aninstance_levelqualifier? They share most rules and are distinguished byinstance_level(mig 084 added that column).de.null.bpatg/de.null.bgh.upc.apl.unified(id=160) — already collapsed all UPC appeal types into one. Should DE follow that pattern (de.inf.unifiedwith instance_level)?upc.ccr.cfi— should it stay as a discrete proceeding_type or move to[with_ccr]flag onupc.inf.cfi?projects.proceeding_type_id(today FK to proceeding_types) should reference only primary proceedings, or also phases/side-actions?condition_expr/trigger_event_idadditions to disambiguate. How many rules need a new condition vs. how many are already trigger-event-anchored?Acceptance for the design pass
Deliverable:
docs/design-proceeding-types-taxonomy-2026-05-NN.mdcovering:proceeding_types, the new home and the FK reparentupc.inf.cfi.interim(now: phase) through the new model end-to-endprojects.proceeding_type_id,sequencing_rules.proceeding_type_id,sequencing_rules.spawn_proceeding_type_id, Fristenrechner Mode B R3 picker, Litigation Planner suiteNo code yet — design only. Coder shift comes after m ratifies.
Out of scope
TAXONOMY KIND DISCRIMINATOR COMPLETE — 23 rows reclassified
Commit:
9d68845onmai/ritchie/coder-mig-153-proceeding(t-paliad-325).What landed
internal/db/migrations/153_proceeding_types_kind.{up,down}.sql) — additive: ADD COLUMNkind text NOT NULL DEFAULT 'proceeding' CHECK (kind IN ('proceeding','phase','side_action','meta')), partial index on(kind, is_active), snapshot topaliad.proceeding_types_pre_153in same TX, set_config defensive audit_reason, DO-block invariant check (expects exactly 23 reclassified rows), new BEFORE INSERT/UPDATE triggerprojects_proceeding_type_kind_check.internal/services/project_service.go—validateProceedingTypeCategorynow picks upcategory + kind + is_activein one SELECT and surfaces a newErrInvalidProceedingTypeKindtyped error.internal/services/project_service_test.go— newTestProjectService_ProceedingTypeKindGuard(4 angles: service-layer kind reject; active-phase-row still rejects on kind; mig 153 trigger backstop on raw INSERT; happy-path kind='proceeding' accept). Skips withoutTEST_DATABASE_URL, matches the Slice 5 guard test pattern.cmd/gen-upc-snapshot/main.go— proceeding_types query now filtersAND kind = 'proceeding'for forward-compat.Acceptance verification
Pre-mig audit (Supabase MCP, 2026-05-27):
upc.costs.cfi(176) carve-out → stays primaryupc.pl.cfi(188) carve-out → stays primarysequencing_rules.proceeding_type_idpointing at any reclassified rowsequencing_rules.spawn_proceeding_type_idpointing at any reclassified rowprojects.proceeding_type_idpointing at any reclassified rowevent_category_concepts.proceeding_type_codepointing at any reclassified row's codego test ./internal/services/ ./pkg/litigationplanner/...shortSnapshot regen status
The embedded
pkg/litigationplanner/embedded/upc/snapshot is a placeholder today (meta.jsonsource_db_label: "placeholder — operator must runmake snapshot-upcagainst prod once mig 134/135 are applied"). It contains onlyupc.inf.cfiandupc.rev.cfi— none of the 23 non-primary rows are in it, so mig 153 doesn't change the placeholder JSON.The generator query is updated to filter
AND kind = 'proceeding'. A proper regen needs DATABASE_URL access to the live paliad DB with mig 153 applied — that's an operator step post-merge:Filing this as a separate snapshot-refresh follow-up rather than blocking this commit on prod-DSN access (ritchie's mAi role has read-only access to the paliad schema).
Migration sequencing reminder
Per design §7 + m's Q10: this mig lands in parallel with knuth's m/paliad#146 (Fristenrechner overhaul). Mig 153 must merge before knuth's S3 ships so the R3 chip query can add the
kind='proceeding'filter on day one. No data drift between mig 152 and mig 153.Sweep verdict (2026-07-29): ALREADY DONE.
This issue audited 46 active rows in
paliad.proceeding_typeson 2026-05-26. Prod now has 25, and every one is a primary proceeding or an appeal track: the six UPC CFI matters (inf,rev,pi,dni,dmgs,pl) plusbsv,ccr,costs,disc,epo.review, the threeupc.apl.*tracks, and the DE / DPMA / EPA families.No phases and no cross-cutting admin rows remain. The
proceeding_types_pre_153andproceeding_types_pre_155fossil tables date the restructure.Full sweep:
docs/findings-issue-sweep-2026-07-29.md(commit4c39886).