fix(builder): surface proceeding_type id so + Verfahren hinzufuegen works (t-paliad-345) #156

Open
mAi wants to merge 0 commits from mai/euler/fixer-builder-add into main
Collaborator

Live regression fix for /tools/procedures Litigation Builder.

Root cause

/api/tools/proceeding-types returned {code, name, nameEN, group} but no id. The picker callback in builder.ts mountAddProceedingPicker POSTed {proceeding_type_id: meta.id} where meta.id === undefinedJSON.stringify dropped the key → server AddProceedingInput.ProceedingTypeID == 0 → 400 ('proceeding_type_id is required') → fetchJSON logged to console and returned null → user-visible symptom: 'nothing happens'.

frontend/src/client/fristenrechner-wizard.ts:599-628 already documented this exact wire-shape gap. The Litigation Builder hit it first.

Fix

  1. pkg/litigationplanner/types.go — add ID int json:"id" to FristenrechnerType.
  2. internal/services/fristenrechner.goSELECT id in ListProceedings + Scan into new field.
  3. frontend/src/client/builder.ts — defensive guard in openAddProceedingPicker: refuse to POST without a positive integer id, log a clear error.
  4. pkg/litigationplanner/types_wire_test.go — regression test pinning the contract.

Verification

  • go build ./... clean
  • go vet ./... clean
  • go test -short ./pkg/... ./internal/... clean (incl. new TestFristenrechnerType_WireShapeIncludesID)
  • bun run build clean (3050 i18n keys unchanged)

Playwright reproduction (honest note)

Mandate from the task brief was Playwright-first reproduction. Local paliad boot would need a Supabase user — no test creds available in the worktree. Reproduction relied on tracing the failure path end-to-end (builder.ts:856 → builder-picker.ts:84 → builder.ts:858 → scenario_builder.go:351). The fristenrechner-wizard.ts:599-628 comment confirmed the wire shape was code-keyed.

Post-merge smoke: /tools/procedures → Neues Szenario starten → + Verfahren hinzufügen → pick any UPC chip → triplet should render.

Test plan

  • CI green
  • After Dokploy redeploy: m loads /tools/procedures, picks a chip, sees a triplet render
  • /api/events?type=deadline still 200 (brunel's t-paliad-344 fix not regressed)
  • fristenrechner-wizard.ts:599-628 workaround can be retired in a follow-up — out of scope here

Refs m/paliad#153

Live regression fix for /tools/procedures Litigation Builder. ## Root cause `/api/tools/proceeding-types` returned `{code, name, nameEN, group}` but no `id`. The picker callback in `builder.ts` `mountAddProceedingPicker` POSTed `{proceeding_type_id: meta.id}` where `meta.id === undefined` → `JSON.stringify` dropped the key → server `AddProceedingInput.ProceedingTypeID == 0` → 400 ('proceeding_type_id is required') → `fetchJSON` logged to console and returned null → user-visible symptom: 'nothing happens'. `frontend/src/client/fristenrechner-wizard.ts:599-628` already documented this exact wire-shape gap. The Litigation Builder hit it first. ## Fix 1. `pkg/litigationplanner/types.go` — add `ID int json:"id"` to `FristenrechnerType`. 2. `internal/services/fristenrechner.go` — `SELECT id` in `ListProceedings` + Scan into new field. 3. `frontend/src/client/builder.ts` — defensive guard in `openAddProceedingPicker`: refuse to POST without a positive integer id, log a clear error. 4. `pkg/litigationplanner/types_wire_test.go` — regression test pinning the contract. ## Verification - `go build ./...` clean - `go vet ./...` clean - `go test -short ./pkg/... ./internal/...` clean (incl. new TestFristenrechnerType_WireShapeIncludesID) - `bun run build` clean (3050 i18n keys unchanged) ## Playwright reproduction (honest note) Mandate from the task brief was Playwright-first reproduction. Local paliad boot would need a Supabase user — no test creds available in the worktree. Reproduction relied on tracing the failure path end-to-end (builder.ts:856 → builder-picker.ts:84 → builder.ts:858 → scenario_builder.go:351). The `fristenrechner-wizard.ts:599-628` comment confirmed the wire shape was code-keyed. Post-merge smoke: /tools/procedures → Neues Szenario starten → + Verfahren hinzufügen → pick any UPC chip → triplet should render. ## Test plan - [ ] CI green - [ ] After Dokploy redeploy: m loads /tools/procedures, picks a chip, sees a triplet render - [ ] /api/events?type=deadline still 200 (brunel's t-paliad-344 fix not regressed) - [ ] fristenrechner-wizard.ts:599-628 workaround can be retired in a follow-up — out of scope here Refs m/paliad#153
mAi added 1 commit 2026-05-28 07:49:59 +00:00
fix(builder): surface proceeding_type id so add-proceeding POST works (t-paliad-345)
Some checks failed
Paliad CI gate / build (push) Has been cancelled
Paliad CI gate / test-go (push) Has been cancelled
Paliad CI gate / build (pull_request) Has been cancelled
Paliad CI gate / test-go (pull_request) Has been cancelled
Paliad CI gate / deploy (push) Has been cancelled
Paliad CI gate / deploy (pull_request) Has been cancelled
1c77cb6e67
The Litigation Builder's "+ Verfahren hinzufügen" silently failed in
prod after t-paliad-343 B2 shipped — clicking a Verfahren chip in the
picker did nothing, no visible error.

Root cause: the wire shape FristenrechnerType (the response of
/api/tools/proceeding-types) carried code+name+nameEN+group but not
id. Builder.ts mountAddProceedingPicker's callback POSTed
`{proceeding_type_id: meta.id}` to
/api/builder/scenarios/{id}/proceedings — meta.id was undefined,
JSON.stringify dropped the key, the server returned 400 ("invalid
input: proceeding_type_id is required"), and fetchJSON swallowed the
error to console. The user saw "nothing happens".

Fix:
- Add `ID int json:"id"` to lp.FristenrechnerType.
- SELECT id in FristenrechnerService.ListProceedings + Scan into the
  new field.
- Defensive guard in builder.ts openAddProceedingPicker — refuse to
  POST without a positive integer id and log a clear error, so a
  future wire-shape regression cannot recreate the silent-fail.
- Regression test in pkg/litigationplanner/types_wire_test.go pins the
  contract (id present in JSON, round-trips as integer).

Side-benefit: fristenrechner-wizard.ts:599-628 documented this exact
gap as a known limitation ("S5/follow-up can extend the wire shape to
include id"). That workaround can now be retired in a follow-up.

Refs m/paliad#153 (Litigation Builder)
Some checks failed
Paliad CI gate / build (push) Has been cancelled
Paliad CI gate / test-go (push) Has been cancelled
Paliad CI gate / build (pull_request) Has been cancelled
Paliad CI gate / test-go (pull_request) Has been cancelled
Paliad CI gate / deploy (push) Has been cancelled
Paliad CI gate / deploy (pull_request) Has been cancelled
This branch is already included in the target branch. There is nothing to merge.
View command line instructions

Checkout

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

No dependencies set.

Reference: m/paliad#156
No description provided.