Skip to content

Restore server-error handling in the code app pages after #32 - #33

Open
TomProkop wants to merge 1 commit into
mainfrom
claude/warehouse-picking-followup-fixes
Open

Restore server-error handling in the code app pages after #32#33
TomProkop wants to merge 1 commit into
mainfrom
claude/warehouse-picking-followup-fixes

Conversation

@TomProkop

Copy link
Copy Markdown
Member

Follow-up to #32. Keeps the new page layout/structure from that PR (it's a real improvement — tighter select projections, extra Status/Created columns, cleaner visual design) but restores a few things that got dropped along the way:

Changes

  • Restore if (!result.success) throw new Error(result.error?.message ?? ...) on every create/read call across all four pages (12 call sites). The generated Dataverse services resolve an IOperationResult<T> and never throw — without this check, every mutation's onSuccess fired unconditionally, so picking more than the available quantity showed a "Transaction created" success toast even when ValidateWarehouseTransactionPlugin rejected it server-side. This was the core scenario the code app was built to demonstrate.
  • Restore Number(...) casts on Whole Number fields (quantity, availablequantity, capacity) instead of sending raw strings — Dataverse's Web API expects real JSON numbers for these fields.
  • Restore the codeAppScaffolded idempotency guard in 05f-code-app.ps1 (Get-LabValue/Set-LabValue), matching every other scaffold script's convention — without it, re-running CP09 fails instead of skipping cleanly.
  • Restore aria-label="Refresh warehouse items" / data-testid="refresh-items" on the items page refresh button.
  • Restore the isLowStock/LOW_STOCK_FALLBACK helper in optionSets.ts and wire it back into the Available Qty columns on the items list and item detail page, so the code app agrees with the model-driven grid on what counts as low stock.

Testing

Docker/dotnet/txc aren't available in this session, so I couldn't re-run the full CP01-CP09 pipeline this time. I verified each edited file parses as valid TSX/TS with the TypeScript compiler (ts.createSourceFile, checked for parse diagnostics) and manually re-checked every result.success/Number() call site against the generated service signatures established in #28. Please run the local dry-run (LOCAL-DRY-RUN.md) or a live CP09-CP13 pass before merging to confirm npm run build/dotnet build are clean and the over-pick scenario now correctly shows the plugin's rejection message instead of a false success toast.


Generated by Claude Code

PR #32 rewrote the Warehouse Picking code app's pages and dropped the
if (!result.success) throw checks on every create/read call. Since the
generated Dataverse services resolve an IOperationResult and never throw,
every mutation's onSuccess fired unconditionally - including when
ValidateWarehouseTransactionPlugin rejects an over-pick server-side, so
the UI showed a success toast for a rejected transaction. Restores the
explicit success checks, the Number() casts on Whole Number fields
(quantity/availablequantity/capacity), the codeAppScaffolded idempotency
guard in 05f-code-app.ps1, the refresh button's aria-label/testid, and
the isLowStock indicator on the Available Qty columns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants