Skip to content

fix(settings): hydrate KDS state on Printers tab - #1138

Merged
khaira777 merged 2 commits into
mainfrom
fm/flocafe-issue-1087-r1
Oct 14, 2026
Merged

khaira777 merged 2 commits into
mainfrom
fm/flocafe-issue-1087-r1

Conversation

@khaira777

@khaira777 khaira777 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1087

Intent

Verify and implement the surgical fix for FreeOpenSourcePOS/FloCafe issue #1087 ("Settings Printers tab omits double-off warning on direct load when KDS is also disabled"): in frontend/src/app/(dashboard)/settings/page.tsx, ensure the Printers tab hydrates KDS enabled state on direct tab load so the double-off warning renders when both KOT and KDS are disabled. Deliver via the no-mistakes pipeline as its own PR with Fixes #1087 in the PR summary.

What Changed

  • Fetch /settings/kds_enabled alongside /settings/kot_printing_enabled when hydrating the receipts-printers tab in frontend/src/app/(dashboard)/settings/page.tsx, and treat a 404 on /settings/kds_enabled during post-failure reconciliation as the default enabled (true) state.
  • Add Playwright E2E coverage in frontend/e2e/settings-request-budget.spec.ts for direct Printers tab loads when KDS is disabled or enabled, as well as cross-tab KDS/Printers transitions while kds_enabled saves are in flight or fail.

Fixes #1087

Risk Assessment

✅ Low: The change surgically adds KDS enabled hydration on the Printers settings tab using existing optional-read and versioned kitchen-setting reconciliation helpers, backed by browser E2E tests covering direct tab load and cross-tab pending/failed saves.

Testing

Built the backend and static frontend, ran the targeted Playwright settings hydration/concurrency/request-budget suites and backend KDS/KOT toggle integration tests, and drove the live application in Chromium against the real SQLite-backed Express server to capture visual screenshot evidence of the Printers tab double-off warning on direct load, suppression when KDS is enabled, and reconciliation after cross-tab KDS save races; all checks and scenarios passed.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Navigating directly to /settings?tab=receipts-printers when both kds_enabled and kot_printing_enabled are false hydrates both settings from the backend, renders the double-off warning banner, and sync… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-direct-load-double-off-warning.png
Navigating directly to /settings?tab=receipts-printers when kds_enabled is true and kot_printing_enabled is false hydrates both settings, hides the double-off warning banner, and syncs persisted POS k… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-direct-load-kds-on-kot-off-no-warning.png
Adversarial cross-tab KDS save race and failed-save reconciliation: toggling KDS on the Kitchen Display tab and immediately switching to the unvisited Printers tab before the KDS PUT settles preserves… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-tab-after-kds-save-race-and-reconcile.png

Printers tab direct load with both KOT and KDS disabled shows double-off warning banner
Printers tab direct load with KDS enabled and KOT disabled omits double-off warning banner
Printers tab after cross-tab KDS save race and failed-PUT 404 reconciliation

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
Navigating directly to /settings?tab=receipts-printers when both kds_enabled and kot_printing_enabled are false hydrates both settings from the backend, renders the double-off warning banner, and sync… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-direct-load-double-off-warning.png
Navigating directly to /settings?tab=receipts-printers when kds_enabled is true and kot_printing_enabled is false hydrates both settings, hides the double-off warning banner, and syncs persisted POS k… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-direct-load-kds-on-kot-off-no-warning.png
Adversarial cross-tab KDS save race and failed-save reconciliation: toggling KDS on the Kitchen Display tab and immediately switching to the unvisited Printers tab before the KDS PUT settles preserves… ✅ pass live ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ/printers-tab-after-kds-save-race-and-reconcile.png
  • npm run build && npm run build:frontend
  • cd frontend && npx playwright test e2e/settings-request-budget.spec.ts -g "Store Settings does not hydrate inactive tabs|Rapid Settings navigation stays below the read rate limit|Printers tab hydrates KDS enabled state on direct load|Direct KDS tab load hydrates KOT state|Failed kitchen setting saves before initial hydration|Switching from Printers to KDS while KOT save is pending|Rapid repeated kitchen setting changes|Tenant switch while KDS/KOT requests are pending|Direct Printers tab load hides double-off warning|Switching from KDS to Printers while KDS save is pending"
  • npm run test:issue-133-kds-kot-toggles
  • cd frontend && npx playwright test e2e/settings-e2e-read-budget.spec.ts
  • Live Chromium E2E verification against real Express/SQLite backend capturing visual evidence in ~/.no-mistakes/evidence/01M4W4B8ZB1Z3H08AXTYDRP1TZ
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@coderabbitai

coderabbitai Bot commented Oct 13, 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: 898a48f4-a01f-4724-9cf0-401a2dbd295f

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

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The Printers tab now reads kds_enabled alongside kot_printing_enabled, so a direct visit can show the warning when both are off.

  • The Printers tab loads KDS settings so the double-off warning appears.

Reviews (1) · Last reviewed commit: "fix(settings): hydrate KDS state on Prin..." · Reviewed by Greptile

@khaira777 khaira777 changed the title fix(frontend): hydrate KDS state on Printers tab load fix(settings): hydrate KDS state on Printers tab Oct 14, 2026
@khaira777

Copy link
Copy Markdown
Contributor Author

The direct Printers tab hydration fix is valid, and the new browser test covers the original missing-warning issue.

However, I found a save/load race in the new KDS hydration logic that should be addressed before merging.

1. Prevent pending saves from being overwritten

The new readOptional('/settings/kds_enabled') callback uses a touch-version snapshot. This does not fully protect a KDS save that was already in progress before the Printers tab began loading.

Please test this sequence:

  • Start with KDS disabled.
  • Enable KDS on the KDS tab, keeping the PUT request pending.
  • Navigate to an unvisited Receipts & Printers tab.
  • Let its GET request return the old disabled value.
  • Complete the PUT successfully.

The final UI, shared POS settings store, and warning banner must reflect the successfully saved enabled value. A stale GET must not overwrite it.

Also test the reverse transition and failed PUT responses.

2. Coordinate with PR #1132

PR #1132 also changes KDS/KOT hydration and save handling in frontend/src/app/(dashboard)/settings/page.tsx and has a newer implementation for managing pending saves, failed saves, and tenant identity.

Please review the latest #1132 implementation before changing this PR. The two fixes should use a single consistent state-management approach.

In particular, #1138 currently uses the touch key kds_enabled, whereas #1132 uses kdsEnabled. Do not leave parallel or inconsistent touch-tracking systems after integration.

Prefer reusing the shared kitchen-setting hydration/reconciliation logic rather than adding another independent guard.

3. Add deterministic regression tests

Verify:

  • Direct Printers tab load with both KDS and KOT disabled.
  • Direct Printers tab load with KDS enabled.
  • A pending KDS save followed by navigation to Printers.
  • Stale GET responses arriving after user edits.
  • Failed PUT requests restoring the authoritative backend value.
  • Switching tenants while a settings request is pending.
  • Correct synchronization with the shared POS settings store.

Preserve the original double-off warning behavior and avoid unrelated Settings changes.

Please run the focused Settings and Playwright tests after integrating the fixes, and report the results before merging.

@khaira777
khaira777 force-pushed the fm/flocafe-issue-1087-r1 branch from 8a4ce22 to 5a69fe6 Compare October 14, 2026 02:30
@khaira777 khaira777 changed the title fix(settings): hydrate KDS state on Printers tab fix(frontend): hydrate KDS enabled state on direct Printers tab load Oct 14, 2026
@khaira777
khaira777 force-pushed the fm/flocafe-issue-1087-r1 branch from 5a69fe6 to ba864b9 Compare October 14, 2026 02:56
@khaira777 khaira777 changed the title fix(frontend): hydrate KDS enabled state on direct Printers tab load fix(settings): hydrate KDS state on direct Printers tab load Oct 14, 2026
@khaira777 khaira777 changed the title fix(settings): hydrate KDS state on direct Printers tab load fix(settings): hydrate KDS state on Printers tab Oct 14, 2026
@khaira777
khaira777 force-pushed the fm/flocafe-issue-1087-r1 branch from ba864b9 to e4f13cb Compare October 14, 2026 03:05
@khaira777
khaira777 enabled auto-merge (squash) October 14, 2026 03:05
@khaira777
khaira777 merged commit d51c52c into main Oct 14, 2026
23 checks passed
@khaira777
khaira777 deleted the fm/flocafe-issue-1087-r1 branch October 14, 2026 03:12
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(settings): hydrate kds_enabled on direct printers tab navigation for double-off warning

1 participant