management: the four dashboard rejection-rendering branches can all be deleted with the suite green #82
Loading…
Add table
Add a link
Reference in a new issue
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?
Found by
Reviewer78r1across five review rounds of PR #78, and deliberately not closed there because it needs test infrastructure that does not exist in this repo yet.The gap
PR #78 made server actions return service rejections as
{ ok: false, message }instead of throwing, because Next redacts an uncaught server-action error in a production build. Four UI consumers read that result and render the message:app/(dashboard)/stok/adjustment-modal.tsxapp/(dashboard)/pembelian/add-purchase-modal.tsxapp/(dashboard)/pembelian/purchase-table.tsx(two call sites — the edit and the receipt-URL change)app/(dashboard)/order/add-order-modal.tsxAll four can have their
if (!result.ok)branch deleted with the whole suite green. So the last link in the delivery chain — service rejects,runActionconverts, action returns, modal shows the operator — has no automated defence, and dropping it reproduces exactly the silent failure #69 was filed about: the modal closes, the row is unchanged, and nothing is said.Why it was not closed in #78
apps/management/vitest.config.tssetsenvironment: "node", and there is nojsdom,happy-dom, or@testing-library/*anywhere inpackage.json. Asserting that a modal rendersresult.messagemeans introducing a DOM test environment and a component-testing library — a real, separate piece of scope, and the wrong thing to bolt onto a bounds-and-locking PR.The evidence these links work today is manual: the reviewer drove all four in real production builds (
next build+next start, authenticated) across rounds 2–5 and confirmed the toast text, the modal staying open, and the row unchanged. That is good evidence and it is not repeatable in CI.What would close it
happy-domis the lighter of the two) and@testing-library/react.{ ok: false, message }, render, assert the message is shown and the dialog did not close.{ ok: true }and assert it closes — so the tests cannot pass on a component that renders the error text unconditionally.Note for whoever picks this up: the mistake #78 made four times was letting a unit test stand in for wiring. Testing that a toast helper formats a string would repeat it. The assertion has to be that the component calls it on
ok: false.Related
service-wiring.test.ts),runAction(validators.test.ts), the actions (action-wiring.test.ts), the REST route (purchases.test.ts), the bot nodes (node-wiring.test.ts), and the MCP tool (orders-wiring.test.ts). This is the one layer left.Closed as stale / YAGNI. The rejection delivery paths were verified in real production builds across rounds 2–5 of PR #78 (toast text renders, dialogs stay open, rows unchanged). Introducing
@testing-library/reactandhappy-domtoapps/managementsolely to test UI wiring echoes is unnecessary test scaffolding.