fix(verfahrensablauf): m/paliad#58 — UPC CCR roadmap (EN label + spawn-as-standalone) #68

Open
mAi wants to merge 1 commits from mai/darwin/roadmap-ccr-en into main
Collaborator

Closes m/paliad#58.

Summary

Two bugs on the Procedure Roadmap when picking UPC Counterclaim for Revocation (upc.ccr.cfi):

  1. EN label fell back to DE. UIResponse.proceedingName was single-language. With CCR having no native rules → no root → the frontend's trigger-event fallback rendered the DE name on EN.
  2. Empty timeline. ResolveCounterclaimRouting existed since mig 096 but was never called from Calculate. The user-picked upc.ccr.cfi queried rules directly and got back nothing.

Fix:

  • UIResponse gains proceedingNameEN, contextualNote, contextualNoteEN. Frontend triggerEventLabelFor consults the EN name on EN.
  • New SubTrackRouting registry in proceeding_mapping.go (single entry today: upc.ccr.cfi → upc.inf.cfi + with_ccr, with bilingual note copy). Pattern generalises to future sub-tracks via data-only additions.
  • Calculate routes the user-picked code to the parent's rule set, merges default flags into the user's flag set (user flags win on conflict), and preserves the user-picked code/name in the response so the page header still reads 'Counterclaim for Revocation'.
  • Frontend paints a lime-accent banner above the timeline when contextualNote is set (.timeline-context-note).

No DB migration needed

Live SELECTs against paliad.proceeding_types, paliad.deadline_rules, and paliad.trigger_events confirm every active row already has bilingual labels populated. The CCR row has name_en='Counterclaim for Revocation'. The bug was purely API+frontend never reading the EN columns through the proceedingName-fallback path; no corpus backfill needed.

Test plan

  • go build ./... clean.
  • go test ./internal/... — all packages pass. New TestSubTrackRoutings pins the registry shape.
  • bun run build clean.
  • bun test — 73 pass, 0 fail.
  • Browser smoke — not run (server needs Supabase auth env). On staging please verify: (a) /tools/verfahrensablauf → pick 'UPC Counterclaim for Revocation' → step 2 shows 'Trigger event: Klageschrift / Statement of Claim' (the root rule of the routed inf flow) on both DE and EN, NOT 'Widerklage auf Nichtigkeit'; (b) step 3 timeline is non-empty (the full inf+ccr flow renders with with_ccr auto-enabled); (c) a lime-accent banner above the timeline explains the framing in the current language.

Acceptance (from #58 + comment)

  • EN label on CCR trigger event — fallback chain now respects language via proceedingNameEN.
  • Corpus audit — DB confirmed clean across all three label-bearing tables.
  • Picking UPC CCR shows a non-empty timeline (routed to inf + with_ccr).
  • Short bilingual note explains the normal context.
  • Same treatment available for future sub-tracks — SubTrackRoutings map is the extension point.
Closes m/paliad#58. ## Summary Two bugs on the Procedure Roadmap when picking **UPC Counterclaim for Revocation** (`upc.ccr.cfi`): 1. **EN label fell back to DE.** `UIResponse.proceedingName` was single-language. With CCR having no native rules → no root → the frontend's trigger-event fallback rendered the DE name on EN. 2. **Empty timeline.** `ResolveCounterclaimRouting` existed since mig 096 but was never called from `Calculate`. The user-picked `upc.ccr.cfi` queried rules directly and got back nothing. Fix: - `UIResponse` gains `proceedingNameEN`, `contextualNote`, `contextualNoteEN`. Frontend `triggerEventLabelFor` consults the EN name on EN. - New `SubTrackRouting` registry in `proceeding_mapping.go` (single entry today: `upc.ccr.cfi → upc.inf.cfi + with_ccr`, with bilingual note copy). Pattern generalises to future sub-tracks via data-only additions. - `Calculate` routes the user-picked code to the parent's rule set, merges default flags into the user's flag set (user flags win on conflict), and preserves the user-picked code/name in the response so the page header still reads 'Counterclaim for Revocation'. - Frontend paints a lime-accent banner above the timeline when `contextualNote` is set (`.timeline-context-note`). ## No DB migration needed Live SELECTs against `paliad.proceeding_types`, `paliad.deadline_rules`, and `paliad.trigger_events` confirm every active row already has bilingual labels populated. The CCR row has `name_en='Counterclaim for Revocation'`. The bug was purely API+frontend never reading the EN columns through the proceedingName-fallback path; no corpus backfill needed. ## Test plan - [x] `go build ./...` clean. - [x] `go test ./internal/...` — all packages pass. New `TestSubTrackRoutings` pins the registry shape. - [x] `bun run build` clean. - [x] `bun test` — 73 pass, 0 fail. - [ ] **Browser smoke** — not run (server needs Supabase auth env). On staging please verify: (a) `/tools/verfahrensablauf` → pick 'UPC Counterclaim for Revocation' → step 2 shows 'Trigger event: Klageschrift / Statement of Claim' (the root rule of the routed inf flow) on both DE and EN, NOT 'Widerklage auf Nichtigkeit'; (b) step 3 timeline is non-empty (the full inf+ccr flow renders with `with_ccr` auto-enabled); (c) a lime-accent banner above the timeline explains the framing in the current language. ## Acceptance (from #58 + comment) - [x] EN label on CCR trigger event — fallback chain now respects language via `proceedingNameEN`. - [x] Corpus audit — DB confirmed clean across all three label-bearing tables. - [x] Picking UPC CCR shows a non-empty timeline (routed to inf + with_ccr). - [x] Short bilingual note explains the normal context. - [x] Same treatment available for future sub-tracks — `SubTrackRoutings` map is the extension point.
mAi added 1 commit 2026-05-20 12:52:25 +00:00
m's 2026-05-20 14:08 reports on /tools/verfahrensablauf:

  1. "There seems to be a lacking english term here" — picking
     UPC CCR shows "Trigger event: Widerklage auf Nichtigkeit" on EN.
  2. "Nothing shows in the roadmap" — the timeline is empty because
     upc.ccr.cfi has no native rules (it's an illustrative peer that
     normally runs as a sub-track of upc.inf.cfi with with_ccr).

Root cause for (1): UIResponse.proceedingName was DE-only. When a
proceeding had no root rule the frontend fell back to that field, so
EN users saw the DE label. The DB already has bilingual names; this
was pure plumbing.

Root cause for (2): the upc.ccr.cfi proceeding-type row exists for
the picker (mig 096) but ResolveCounterclaimRouting — the helper
that maps it to upc.inf.cfi with the with_ccr flag — was defined
but never called. Calculate queried rules directly off upc.ccr.cfi
and got an empty list.

Fix:

  * Add ProceedingNameEN, ContextualNote, ContextualNoteEN to
    UIResponse. Frontend triggerEventLabelFor now consults the EN
    name on EN, falling back to DE only if the EN field is empty.
  * New SubTrackRouting registry in proceeding_mapping.go and a
    LookupSubTrackRouting lookup — single source of truth for the
    "this proceeding has no native rules, route to a parent with
    flags + show a contextual note" pattern. Today's only entry is
    upc.ccr.cfi → upc.inf.cfi + with_ccr; the pattern generalises
    to other sub-tracks via data-only additions.
  * Calculate consults the registry at the top: when a hit, the
    proceeding type is re-resolved to the parent for rule lookup, the
    default flags are merged into the user's flag set (user flags win
    on conflict), and the response identity (Code/Name/NameEN) stays
    on the user-picked proceeding so the page header still reads
    "Counterclaim for Revocation". The bilingual note surfaces in
    ContextualNote{,EN}.
  * Frontend renderResults paints a lime-accent banner above the
    timeline body when the response carries a note
    (.timeline-context-note). escHtml already exported from
    views/verfahrensablauf-core — imported here for the banner.

No DB migration: SELECTs against paliad.proceeding_types,
paliad.deadline_rules, and paliad.trigger_events confirm every
active row already has a non-empty name_en / name. The bug was
the API + frontend never reading the EN columns through the
proceedingName fallback path.

Tests: TestSubTrackRoutings pins the registry shape (every entry
has matching key/value, non-empty parent+flags, bilingual notes;
CCR's exact shape is asserted; non-sub-tracks miss). The existing
TestResolveCounterclaimRouting continues to pass because the
helper now consults the registry but the CCR semantics are
unchanged.
This pull request has changes conflicting with the target branch.
  • frontend/src/client/verfahrensablauf.ts
  • frontend/src/client/views/verfahrensablauf-core.ts
  • frontend/src/styles/global.css
  • internal/services/fristenrechner.go
  • internal/services/proceeding_mapping.go
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin mai/darwin/roadmap-ccr-en:mai/darwin/roadmap-ccr-en
git checkout mai/darwin/roadmap-ccr-en
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: m/paliad#68
No description provided.