Skip to content

fix(orders): scope pending-edit notices and async handlers to active order - #1260

Merged
khaira777 merged 6 commits into
mainfrom
fm/remediate-n5-pending-edit-scope
Oct 21, 2026
Merged

khaira777 merged 6 commits into
mainfrom
fm/remediate-n5-pending-edit-scope

Conversation

@khaira777

@khaira777 khaira777 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1257

Intent

Fix finding N5 (GitHub issue #1257) in FreeOpenSourcePOS/FloCafe: scope pending-edit recovery notices, refresh errors, storage warnings, inline issues, and in-flight async handlers in frontend/src/components/orders/PendingOrderItemEdits.tsx and frontend/src/components/orders/OrderDetailPanel.tsx to the selected (tenantId, actorId, orderId) so switching orders never displays or triggers recovery warnings/refreshes from a previously selected order or a late-settling async request from another order.

What Changed

  • Scoped pending item edit transient state (recovery notices, inline issues, refresh errors, and storage warnings) to (tenantId, actorId, orderId) and keyed order components by order ID in OrderDetailPanel.
  • Added scope version guards to resolution and refresh handlers so in-flight async requests from a previously selected order are ignored when switching orders.
  • Added unit and Playwright E2E test suites verifying pending edit isolation across order switches, and updated frontend architecture documentation.

Risk Assessment

✅ Low: The changes cleanly scope pending-edit state and in-flight resolution handlers to the active (tenantId, actorId, orderId) tuple with component keying and versioned cancellation, backed by comprehensive unit and E2E coverage.

Testing

Exercised the live product end-to-end in Chromium against the running FloCafe Express API server and static Next.js frontend across 3 live scenarios (order switching with notices, adversarial late-settling async 409 resolution, and storage recovery scoping) alongside 177 unit and component harness tests in test:order-item-edit, all passing with 5 visual screenshot artifacts captured.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Switching from Order A with active edit conflict and refresh failure to Order B immediately isolates and clears notices ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-1-order-b-isolated-clean.png
Late-settling edit resolution and refresh responses from Order A do not leak notices or trigger refreshes when viewing Order B ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-2-order-b-after-late-settling-resolution.png
Order-scoped pending edit attempts in storage only offer recovery actions on the matching order ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-3-order-a-displays-own-attempt.png

Order A displaying edit version conflict and refresh failure notices
Order B displaying a clean panel with no residual notices from Order A
Order B remains unaffected after late 409 resolution on Order A
Order B offers no recovery actions when an attempt exists for Order A
Order A properly offers recovery actions for its own pending attempt

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

✅ **Review** - passed

✅ No issues found.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Switching from Order A with active edit conflict and refresh failure to Order B immediately isolates and clears notices ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-1-order-b-isolated-clean.png
Late-settling edit resolution and refresh responses from Order A do not leak notices or trigger refreshes when viewing Order B ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-2-order-b-after-late-settling-resolution.png
Order-scoped pending edit attempts in storage only offer recovery actions on the matching order ✅ pass live ~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD/scenario-3-order-a-displays-own-attempt.png
  • npm run test:order-item-edit
  • cd frontend && EVIDENCE_DIR=~/.no-mistakes/evidence/01M5EJCT0WY8Q1F5Z5JPGVATRD npx playwright test --config=playwright.config.ts e2e/issue-1257-pending-edit-scope.spec.ts --project=chromium
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: FreeOpenSourcePOS/FloCafe/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 08a41cf7-26b2-4dd1-a009-a93f11215a39

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review this at plus

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The follow-up changes appear safe to merge, with all three previous findings addressed.

Summary

The PR keeps pending-edit notices and late responses tied to the selected order.

  • Pending edit notices stay with the selected order.
  • Late edit results stop affecting a newly selected order.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Edit response arrives] --> B{Committed or rejected?}
  B -->|Yes, same identity| C[Clear matching saved attempt]
  B -->|No| D{Still mounted in the same scope?}
  C --> D
  D -->|No| E[Stop without refreshing or showing notices]
  D -->|Yes| F[Handle result for the selected order]
Loading

Reviews (2) · Last reviewed commit: "test(orders): address review feedback on..." · Reviewed by Greptile

Comment thread tests/order-item-edit.test.ts Resolved
…I checks: 1. **`Lint & Build Validation (Linux)` failure:** - **Root cause:** `frontend/e2e/issue-1257-pending-edit-scope.spec.ts` had unformatted imports/code causing `oxfmt --check` to fail during `scripts/ci/check-changed-format.cjs`. - **Fix:** Formatted the file using `npx oxfmt --write` according to repository formatting standards. 2. **`Playwright E2E (Shard 2/4)` and `End-to-End Playwright Tests` failures:** - **Root cause:** In `frontend/e2e/issue-1257-pending-edit-scope.spec.ts`, `EVIDENCE_DIR` was hardcoded to a local user path (`/Users/gurkiratkhaira/.no-mistakes/evidence/...`) and unconditionally invoked `page.screenshot()`. On CI Ubuntu runners where this directory did not exist, `page.screenshot()` failed with `ENOENT: no such file or directory` across all 3 scenarios. - **Fix:** Made screenshot capture conditional on `process.env.EVIDENCE_DIR` via a helper `captureScreenshot()` that verifies directory existence with `fs.mkdirSync(EVIDENCE_DIR, { recursive: true })` and safely ignores captures in CI runs where `EVIDENCE_DIR` is unset. 3. **`Required Checks Gate`:** - Satisfied as the underlying check dependencies (`Lint & Build Validation` and `Playwright E2E`) are resolved. Local verification executed: - `npm run format:check:changed -- --base 0818717` (Passed) - `npm run lint` & `npm run lint:budget` (Passed, 0 warnings/errors in frontend) - `npx playwright test e2e/issue-1257-pending-edit-scope.spec.ts` (All 3 scenarios passed both with and without `EVIDENCE_DIR`) - `npm run test:order-item-edit` (177/177 unit tests passed) - `npm run docs:check` (Passed) - `npm run i18n:check` (Passed) - `git diff --check` (Clean)
@khaira777

Copy link
Copy Markdown
Contributor Author

@greptileai review this at plus

@khaira777 khaira777 changed the title fix(orders): scope pending item edit recovery and async handlers to selected order fix(orders): scope pending-edit notices and async handlers to active order Oct 21, 2026
@khaira777
khaira777 merged commit 6bb2f1b into main Oct 21, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/remediate-n5-pending-edit-scope branch October 21, 2026 14:14
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.

fix(ui): scope pending-edit recovery notices and async handlers to the selected order

1 participant