Skip to content

fix(web): preserve purchase context and pending action state - #47

Draft
cb8010d6 wants to merge 1 commit into
agent/auth/canonical-onboardingfrom
agent/frontend/purchase-context-safety
Draft

cb8010d6 wants to merge 1 commit into
agent/auth/canonical-onboardingfrom
agent/frontend/purchase-context-safety

Conversation

@cb8010d6

@cb8010d6 cb8010d6 commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Problem

Purchase collections and async action results could survive company/user changes, overwrite newer state, or clear a newer action's busy flag. Refresh after a completed write could erase another selected order's receipt draft, while a failed refresh obscured the successful save.

Changes

  • Bind readable data/results to company, user and auth context version; hide stale collections immediately. Request generations reject A→B→A races and post-unmount callbacks; same-context token refresh remains valid.
  • Share mutation guard with synchronous duplicate-submit lock and per-action identity; stale completion cannot unlock or overwrite a newer action.
  • Preserve selection-specific invoice/receipt drafts; lock receipt inputs only for the selected order currently being received. Retain another order's edits across refresh when its authoritative quantities are unchanged.
  • Show saved confirmation separately from refresh failure; stale data stays unavailable and read retry is explicit.
  • Round remaining receipt defaults to four decimal places, including 0.3−0.1→0.2 compatibility with authoritative fix(purchase): prevent split and concurrent overreceipts #45 validation.
  • Record iteration handoff, verified earlier heads and remaining production boundaries.

Validation

Luna max implementation with independent Astra review. Exact UI source commit a633f04:13 focused tests passed independently. Root integrated Web typecheck and all155 tests/27suites passed; integrated API704 tests passed. No new runtime dependencies or backend policy changes in this slice.

Exact integrated-head CI

Head f29c5b09c6f234474708df58ddf48940551d77bf: run 36289363016 passed every gate, including the aggregate validate check.

  • 887 regular tests: 28 scripts + 704 API + 155 Web.
  • 98 actual PostgreSQL regressions: includes 13 new receipt cases and eight new onboarding cases.
  • 25 actual HTTP steps: 13 stocked-trade + 12 manufacturing, including real synthetic initializer, engineering-role login and release, BOM consumption, reversal and replay.
  • 9 actual Chromium cases; browser identity/API responses are synthetic.
  • Security audit, commitlint, Prisma/typecheck/lint/build gates passed. Shell and PowerShell restore command tests actually executed with zero root-test skips.
    Actual final-head job logs inspected; local integration tree exactly matches remote tree b7b9573a5856935b9be409f24ef9a02e5066caa1. This evidence supersedes pre-CI checkpoints in the committed handoff.

Stacked on #46; the review stack includes #43–#46. Restore tests simulate Docker and are not a real recovery drill. No production deployment/main merge or production-readiness claim; #35, operational recovery/sign-off and historical/accounting boundaries remain open.

Copy link
Copy Markdown
Owner Author

Base #46 now has exact-head all-green evidence: 4810b62, run36289249119; eight new onboarding PostgreSQL races actually passed (98 PG total), synthetic initializer and manufacturing login/release passed. This PR's own head f29c5b0 already passed 9 Chromium cases; full final-head CI is still running. Prior source-reviews and local155 Web/704 API results are not substituted for final CI.

This branch has not been deployed

No deployments
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.

1 participant