Repository navigation
feat: add structured diagnostics and actionable POS failure feedback - #1032
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@greptile review |
|
375bb94 to
6cb1b30
Compare
…Electron test unavailable)
… by missing dependency
…y missing Electron
…ency test state index, and Playwright recovery fixtures and assertions. Updated PaymentModal to preserve an applied equal share while its matching locked payment is awaiting replay confirmation. Verification passed: frontend build, lint, all 17 equal-share E2E tests, plus the focused first-run, currency-adapter, release-regression, and prepaid-reconciliation checks. `git diff --check` passed. An earlier broad browser run also had three unrelated `layout-integrity` failures; the aggregate E2E and required-check gate were not rerun because this assignment covers only the CI fix phase
…ts, and restore surgical formatting
…align outbox test
…tron tests unavailable
…udSync stub records `captureOperationFailure()` and the startup-failure assertion expects diagnostics capture instead of the removed telemetry event. Removed the obsolete telemetry sender from the stub. `node --check` and `git diff --check` passed. `npm run test:shutdown-lifecycle` could not reach the test because repo-local `tsc` is missing
…y file flagged by CI. The Required Checks Gate failure was downstream of the formatting failure. `npx oxfmt --check` on the file, `node --check`, and `git diff --check` passed. The full changed-file checker could not run because repo-local `oxfmt` is missing, and `npm run test:shutdown-lifecycle` was blocked by missing `tsc`
… diff-check passed
…y missing Electron
eb20c30 to
cb2c5d3
Compare
Intent
Resolve cashier order rejection rejections with specific actionable error messages, synchronize structured operation failure registry with 119 capture points, and complete Singapore community tax pack verification
What Changed
Risk Assessment
Testing
Built the backend and desktop frontend, drove the POS rejection through a real isolated browser and API, and exercised diagnostics and Singapore tax-pack routes with disposable databases. The first diagnostics run hit its 30-write/minute limit; pacing the client allowed the real limiter to reset and the integration run to complete. Evidence was captured and transient worktree artifacts were cleaned up.
Evidence: Live cashier rejection and persisted-order check
Evidence: Diagnostics registry integration run
Evidence: Diagnostics feature coverage
Evidence: Singapore community tax pack verification
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed (3) ✅
frontend/src/app/(dashboard)/orders/page.tsx:504- The required criterion is “Resolve cashier order rejection rejections with specific actionable error messages.” On a correlated postpaid append rejected by validation, the server returns an actionableerrorwith a trustedvalidation.rejectedtuple (main/routes/orders.ts:1690-1702,1984-2003), and the classifier retains it asfailure.serverError(frontend/src/lib/order-attempt.ts:555-565). This handler discards that detail and shows only a generic correction prompt. The6cb1b30efix-round change clears the rejected retry state but leaves both this recovery path and the normal submit path generic (frontend/src/app/(dashboard)/orders/page.tsx:1302). Please preserve a safe, specific rejection message in both paths.main/routes/diagnostics.ts:62- Nested metadata arrays have no item limit: this loop sanitizes every element before the 4 KB serialized-size check at line 100. An authenticated caller withsupport.usecan submit a large array in a request accepted by the API’s 50 MB JSON body limit, making the handler traverse and duplicate it before rejecting it. Bound array traversal or reject oversized arrays before sanitizing them.main/routes/settings.ts:1746- If the app starts with diagnostics transmission disabled,reload()does not start the diagnostics flusher (main/services/cloud-sync.ts:1001-1010). Turning transmission on later reaches this consent sync call, but it does not start a timer or flush existing aggregates (main/services/cloud-sync.ts:1645-1679). If no further failure is captured, queued diagnostics remain pending until a restart. Start or trigger the flusher when an effective opt-in is saved.main/tax-packs/community-singapore.json:17- The Singapore pattern rejects six-digit UENs, although the pack describes accepting UEN syntax. IRAS lists six-digit UENs for LLPs and local branches in its GST tax-reference instructions, and its invoice guidance recognizes a UEN as the GST registration number when they are the same. A Singapore business using such a UEN as its GST registration number is rejected when saving tax settings (main/services/tax.ts:121-135;main/routes/settings.ts:341-350,426-435). Include the valid six-digit form.🔧 Fix applied.
2 errors still open:
🚨
frontend/src/app/(dashboard)/orders/page.tsx:504- The required criterion is “Resolve cashier order rejection rejections with specific actionable error messages.” On a correlated postpaid append rejected by validation, the server returns an actionableerrorwith a trustedvalidation.rejectedtuple (main/routes/orders.ts:1690-1702,1984-2003), and the classifier retains it asfailure.serverError(frontend/src/lib/order-attempt.ts:555-565). This handler discards that detail and shows only a generic correction prompt. The6cb1b30efix-round change clears the rejected retry state but leaves both this recovery path and the normal submit path generic (frontend/src/app/(dashboard)/orders/page.tsx:1302). Please preserve a safe, specific rejection message in both paths.🚨
frontend/src/app/(dashboard)/orders/page.tsx:1302- The required criterion “Resolve cashier order rejection rejections with specific actionable error messages” remains unmet for item appends. A confirmed validation rejection from/orders/:id/itemsreturns anerrorwith a trustedvalidation.rejectedtuple (main/routes/orders.ts:1690-1702,1990-2003), and the classifier preserves the detail asfailure.serverError(frontend/src/lib/order-attempt.ts:555-564). Both the automatic recovery and normal submit handlers discard it and show only a generic prompt (frontend/src/app/(dashboard)/orders/page.tsx:504,1302). The later append-state fix in6cb1b30eleft this detail undisplayed in both paths. Show the trusted rejection detail, with a generic fallback.main/routes/diagnostics.ts:63- The round 2 fix caps each container at 40 items, but the caps multiply: an authenticated caller withsupport.usecan submit 40 array-valued metadata keys, each containing 40 objects with 40 strings of 300 characters. The handler copies this roughly 64,000-string tree and serializes it before rejecting it at line 101. Object key traversal atmain/routes/diagnostics.ts:71compounds the array fan-out at this site. Apply a cumulative node or byte budget during traversal.🔧 Fix applied.
2 warnings still open:
main/routes/diagnostics.ts:63- The round 2 fix caps each container at 40 items, but the caps multiply: an authenticated caller withsupport.usecan submit 40 array-valued metadata keys, each containing 40 objects with 40 strings of 300 characters. The handler copies this roughly 64,000-string tree and serializes it before rejecting it at line 101. Object key traversal atmain/routes/diagnostics.ts:71compounds the array fan-out at this site. Apply a cumulative node or byte budget during traversal.main/routes/diagnostics.ts:96- Round 3 bounded recursive metadata traversal, but diagnostics still processes unbounded request fields:event_codeis trimmed and regex-checked before a length guard, whileseverity,correlation_id, andmessageare also consumed without raw-length limits (lines 98-99, 116-122). An authenticated caller can submit a near-50 MB value under the API body limit and cause additional full-string scans. The sibling/capturepath forwards unboundedfactsat line 168;serializeOperationFailurematerializes every entry before rejecting an unknown key (main/lib/operation-failure.ts:1408-1410). Add size and fact-count bounds before scanning or materializing these inputs.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm run test:community-tax-packsnpm ci --ignore-scripts --no-audit --no-fundandnode node_modules/electron/install.jsto materialize worktree-local test dependencies after the first suite was blocked by missing Electron.npm run test:community-tax-packsnpm run test:diagnostics-event && npm run test:diagnostics-feature-coverage && npm run test:diagnostic-signaturenpm run build && npm run build:frontendto prepare the E2E product runtime.Startedtests/e2e-server.cjson isolated ports 3311-3313; used Playwright to log in, alter the outgoing order quantity while forwarding the request to the real API, assert the structured rejection and UI message, and capture a screenshot.npm run test:issue-788-order-attempt-storageExploratory runtime registry-count/serialization probe; excluded from step judgment because that same count concern is recorded as declined on this branch.git diff --check✅ No issues found.
npm run buildnpm run build:frontendnpx playwright test --config=playwright.config.ts --project=chromium e2e/codex-live-order-rejection.spec.ts --reporter=lineagainst local API/KDS/Server App ports 39081–39083; request reached the real backend and evidence screenshot was captured.npm run test:community-tax-packsnpm run test:diagnostics-feature-coveragenpm run test:diagnostics-eventinitially hit the diagnostics write limit; reran withNODE_OPTIONS=--require=$PWD/.test-tmp/rate-limit-paced-fetch.cjsso the real limiter could reset, and the suite completed.curlhealth checks for the isolated Main API and Server Appgit diff --check fd858b6eff7e0201a5144d185ce8c9407780c822 a7b2e67cadd819218ea7029763fc43ee26e587ee✅ **Document** - passed
✅ No issues found.
✅ No issues found.
🔧 **Lint** - 1 issue found → no changes applied ✅
markdownlint-cli2andoxlintwere not found, and the repository-localoxfmtmodule is missing. This blockednpm run docs:check,npm run lint, and the changed-file format check. Direct documentation link, index, and policy checks passed;git diff --checkpassed. No tests were run.🔧 No changes applied.
✅ Re-checked - no issues remain.
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
✅ No issues found.