Litigation Planner suite — extract Fristenrechner/Verfahrensablauf into a Go package for paliad + youpc.org reuse (inventor) #124
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 vision (2026-05-26 09:46)
m's direction (2026-05-26 09:55)
Reuse strategy locked: package-within-project (option 1). No API integration path; no separate service. paliad owns the package; youpc.org imports it as a library.
Phase: inventor design (READ-ONLY)
Inventor → coder gate per project CLAUDE.md.
Scope — design the litigation planner suite
Today's surfaces converging into the suite
/tools/fristenrechner) — manual deadline calculation, project-aware/tools/verfahrensablauf) — abstract browse-a-proceeding, side+appellant+per-card-choicesdeadline_rules+ anchors +project_event_choicesAll three already share
internal/services/fristenrechner.go+projection_service.go. The package extraction formalises that shared core.The package design
Target shape:
Key contract: NO database imports inside
pkg/litigationplanner/calc.go. The calculator takes rules + anchors + choices as Go values. Persistence (Postgres) lives in the catalog implementation. youpc.org provides its OWN catalog impl (likely an in-memory snapshot of the UPC rule subset, pinned to a paliad release).Open design questions
Q1 — Scenarios storage
A. Per-project named scenarios in paliad.project_event_choices: extend the table with
scenario_name+is_active. One project can have N scenarios, switch with a chip. (R) — simplest, no new table.B. New
paliad.scenariostable keyed on project_id + name + achoices jsonbblob. Cleaner separation but duplicates data.C. No persistence — URL-only scenarios, identical to today's per-card-choices URL state. Shareable, ephemeral.
Q2 — User-authored rules (m's 'add proceeding types or specific submissions')
A. Per-project draft rules:
paliad.deadline_rulesgains aproject_idnullable column. NULL = global catalog (current behavior); non-NULL = scoped to that project. Visible only on that project; calculator merges global + project-scoped. (R) — minimal schema change, clean visibility.B. Separate
paliad.project_deadline_rulestable linking projects to ad-hoc rules. More schema but cleaner separation.C. Defer entirely — out of scope for v1 of the planner.
m's framing strongly implies (A) or (B). The lawyer needs to add 'we filed an unusual motion X with deadline Y for a response' on top of the standard catalog.
Q3 — Package boundary for youpc.org
A. Go package within m/paliad (
pkg/litigationplanner). youpc imports via Go module dependency (require mgit.msbls.de/m/paliad/pkg/litigationplanner). Pull paliad as a submodule OR a versioned tag.B. Separate repo
m/litigationplanner, paliad imports it, youpc imports it. Cleaner ownership; more release-coordination overhead.m's pick: A (within paliad). Locked.
Sub-question: how does youpc get a SNAPSHOT of UPC rules without paliad's full DB?
go:embeda JSON snapshot of the UPC rule subset into the package. Refresh via a generator script. youpc gets a static copy; updates ship as paliad releases.(R) = A.1 — embed + generator. youpc.org has zero runtime dependency on paliad; updates are explicit + versioned. The generator script (
scripts/snapshot-upc-rules/main.goor similar) refreshes the embedded JSON on demand.Q4 — Coexistence with current shared core
internal/services/fristenrechner.gois paliad-internal today. Migration options:A. Extract from internal/services into pkg/litigationplanner all at once. paliad's services re-import; youpc imports the same package. Single source of truth.
B. Duplicate the calc into pkg/litigationplanner first, prove youpc can use it, then DRY paliad to also use it. Two-step migration.
(R) = A (atomic move). The current shared core IS the package's reason to exist. Duplicating creates a drift risk.
Q5 — Versioning
If the rule data shape changes (Wave 2 primitives, Tier 3 schema work, future), youpc's embedded snapshot drifts from paliad's runtime. How do we handle version skew?
A. Strict version pinning: every paliad release publishes a
litigationplanner@vN.M.Ktag; youpc updates Go module version on its own cadence. Stale snapshots are tolerated; new rule shapes break the build at youpc update time.B. Backward-compatible package API: the package versions ITS API explicitly; rule additions are forward-compatible; only breaking shape changes bump a major.
(R) = B with semver discipline. The package's API stays stable; the embedded snapshot is what changes.
Deliverable
docs/design-litigation-planner-2026-05-26.mdon branchmai/<inventor>/litigation-planner-design. Sections:pkg/litigationplanner/...)Hard rules
mai instruct head. Default to (R) per the questions above; escalate Q1/Q2 material picks.internal/services/fristenrechner.go+projection_service.go+deadline_calculator.gocarefully — they're the body to extract.paliad.deadline_rulescolumns,paliad.proceeding_typescolumns) so the package's RuleStub type matches.When done
Push design doc +
mai report completedwith 'DESIGN READY FOR REVIEW'. Inventor parked. Head gates coder shift to Slice A.Out of scope
Addendum from m (2026-05-26 10:14)
Reinforces the existing project CLAUDE.md language convention. Specifically for the new
pkg/litigationplanner/extraction (Slice A):litigationplanner, notfristenrechner.Frist→Deadline,Verfahrensschritt→ProceduralEvent,Klägerseite→ClaimantSide,Gegnerseite→OpposingSide,Träger→Carrieror similar.internal/services/fristenrechner.gocarries some German-flavoured identifiers — those move into the new package as the rename target. Slice A's atomic-move is the cleanest time to rename.Klageerhebung,Schriftsatz) — those are product/legal vocabulary, not code names. But: code identifiers should still use English equivalents (statement_of_claim_code, notklageerhebung_code).Fold this into Slice A's coder instructions. The renaming work IS part of Slice A; not deferred.
Slice A landed (atomic extract →
pkg/litigationplanner)docs/design-litigation-planner-2026-05-26.md(commits 8240717, 6e58595 — m's AskUserQuestion picks folded in:paliad.scenariosjsonb table + abstract scenarios, no user-authored rules).internal/servicesinto newpkg/litigationplanner. Net diff: +3 277 / −1 914 lines across 18 files.youpc.orgreuse.pkg/litigationplanner.Slices B-F still open. Slice B (catalog interface + Berufung unification) is next — m approved 2026-05-26 12:32: the 4-5 parallel Berufung proceeding_types (UPC_APP / UPC_COST_APPEAL / UPC_APP_ORDERS / Schadensbemessung / Bucheinsicht) get unified into one
Berufungproceeding_type +appeal_targetfield; system derives the correct frist sequence from the target. cronus parked on Slice A coder mode awaiting Slice B greenlight.Slice B landed (catalog interface + 3 unifications)
Three sub-slices, three reviewable merges:
upc.apl.merits7 rules,upc.apl.cost2,upc.apl.order7) into oneupc.apl+appeal_targetdiscriminator. 5 chip targets in the Verfahrensablauf picker: Endentscheidung, Kostenentscheidung, Anordnung, Schadensbemessung, Bucheinsicht. Schadensbemessung + Bucheinsicht are enum-defined and return empty timelines pending rule seeding (follow-up). Obsolete proceeding_types archived viais_active=false, never dropped.Catalog.LookupEvents(ctx, axes, depth)with 5 optional axes (jurisdiction, proceeding_type_id, party, event_category_id, appeal_target) and depth toggle (next/all-following). No schema delta — reuses existingparent_id+sequence_ordergraph. 5 test cases (live-DB skipped withoutTEST_DATABASE_URL). HTTP endpoint deferred to a future slice.RAISE NOTICElisting dirty rows +RAISE EXCEPTIONif any). Constraint:primary_party IS NULL OR primary_party IN ('claimant','defendant','court','both'). Package:PrimaryParty*constants +PrimaryParties[]+IsValidPrimaryParty(). Rule-editor pre-validates with user-friendly 400 before DB CHECK fires.pkg/litigationplanner/primary_party_test.goadds the first unit tests in the package.Migrations: 134 (Berufung), 135 (primary_party CHECK) — both purely additive, both audit-first where data changes, no destructive drops. Down-migrations preserve safety.
Open follow-ups in this issue's scope:
/admin/rules.LookupEvents— when a frontend surface needs it.Suite complete — Slices A → F all landed today (2026-05-26)
pkg/litigationplanner: Merge d1d0cf9upc.apl.unified+appeal_targetdiscriminator. (3 hotfixes applied: code-shape #130, audit_reason #131, updated_at column.)Catalog.LookupEvents(ctx, axes, depth), 5 optional axes.primary_partyCHECK constraint: Merge 932b177 — mig 135 audit-first.cmd/gen-upc-snapshot/,pkg/litigationplanner/embedded/upc/.paliad.scenariosjsonb table + Catalog API + engine adapter: Merge 3b601f1 — mig 145 additive; 6 REST endpoints + RLS.mai/cronus/coder-slice-f-paliad-snapshot-integrationon the youpc.org repo (offe0e4e407); local-replace dev wiring, awaiting paliad release tag for the cutover.Companion landings unrelated to a specific slice but on the same surface:
applies_to_targetbackfill for Schadensbemessung + Bucheinsicht — Merge 727e01cOpen follow-ups (not blockers, not closing this issue — m closes):
/admin/rulesif needed)./api/upc/*endpoints.Sweep verdict (2026-07-29): ALREADY DONE.
pkg/litigationplannerexists and is a real consumer boundary — per CLAUDE.md it is imported by youpc.org as a library, which is why./pkg/...was added to the CI test scope on 2026-07-29 (it had been in no gate at all until then).Full sweep:
docs/findings-issue-sweep-2026-07-29.md(commit4c39886).