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
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
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)
This commit is contained in:
@@ -855,6 +855,16 @@ function openAddProceedingPicker(anchor: HTMLElement): void {
|
||||
if (!state.active) return;
|
||||
mountAddProceedingPicker(anchor, state.procTypes, async (meta) => {
|
||||
if (!state.active) return;
|
||||
// Guard against a wire-shape regression: if the proceeding-types
|
||||
// endpoint stops returning `id`, `meta.id` is undefined and
|
||||
// JSON.stringify silently drops the field, the server rejects the
|
||||
// POST with a 400, and fetchJSON swallows the error — the user
|
||||
// sees "nothing happens" (t-paliad-345). Fail loud instead.
|
||||
if (typeof meta.id !== "number" || meta.id <= 0) {
|
||||
console.error("builder: missing proceeding_type id in picker meta", meta);
|
||||
setSaveState("error");
|
||||
return;
|
||||
}
|
||||
const proc = await addProceeding(state.active.id, {
|
||||
proceeding_type_id: meta.id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user