Repository navigation
Conversation
Greptile SummaryThe PR adds persisted Light, Dark, and System theme modes, synchronizes renderer and native Electron chrome, and introduces follower-window hydration and recovery behavior.
Confidence Score: 0/5The PR does not appear safe to merge because follower reconciliation and settings recovery can still leave users on stale themes or overwrite a newer persisted selection. Authenticated followers can permanently retain stale mirrored state after bounded recovery ends, mirror authority still leaks across authentication reboots, and the settings recovery sequence can miss hydration, retain a stale rollback baseline, or override a later successful save. Files Needing Attention: frontend/src/components/layout/ThemeSync.tsx; frontend/src/app/(dashboard)/settings/page.tsx
|
| Filename | Overview |
|---|---|
| frontend/src/components/layout/ThemeSync.tsx | Adds theme boot resolution, mirror ownership, authentication reboot, and bounded follower reconciliation; previously reported authority and recovery-lifetime failures remain. |
| frontend/src/app/(dashboard)/settings/page.tsx | Adds the Appearance controls and optimistic persistence, but previously reported recovery-arm and rollback-baseline races remain. |
| frontend/src/store/theme.ts | Introduces the shared theme-mode store and a persistent in-window user-selection guard. |
| main/ipc.ts | Adds validated theme settings support and the narrow effective-theme IPC path. |
| main/title-bar-theme.ts | Adds helpers for validating and resolving theme mode and applying native title-bar colors. |
| frontend/src/app/layout.tsx | Adds the blocking pre-paint theme resolver and mounts renderer synchronization. |
Sequence Diagram
sequenceDiagram
participant User
participant Settings
participant Store
participant API
participant ThemeSync
participant Electron
User->>Settings: Select theme
Settings->>Store: Optimistic mode update
Settings->>API: Persist theme_mode
Store->>ThemeSync: Mode changed
ThemeSync->>Electron: setThemeEffective(isDark)
API-->>Settings: Success or recovery path
Reviews (11): Last reviewed commit: "feat: add Light/Dark/System theme suppor..." | Re-trigger Greptile
d093cf4 to
126cb4f
Compare
|
Thanks @greptile-apps — both P1s are fixed in 126cb4f (branch squashed to a single commit): P1-1 (late hydration overwrites user choice): the theme store now carries a per-window-session P1-2 (stale mirror bypasses persisted theme): follower chain reordered to DB → param → mirror → OS. The token-gated Also aligned two stale test expectations that CI caught: Verified: |
|
Re-checked 126cb4f: both P1 findings are addressed.
The added tripwires cover both ordering/race invariants, and the reported build, lint, i18n, and Electron tests passed. I have no further blocking findings. Tip: You can customize Greptile's behavior for this repo with |
06e01c8 to
1456df8
Compare
|
Thanks @greptile-apps — both P1s from the second pass are fixed (1456df8, branch squashed): P1 (settings rollback uses unhydrated baseline): on a failed PUT, the page now restores from server truth — it re-fetches P1 (failed fetch preserves stale mirror): the follower settings fetch now retries once after 1s (cancelled-safe), and the mirror fallback on a fetch-failed path no longer marks the value authoritative — the stale palette is painted best-effort but never written back to the mirror. The no-fetch path (logged-out popups, spec §8(b)) keeps its existing authoritative mirror behavior. Both invariants are source-locked by new tripwires in |
|
Re-checked commit
The new tripwires cover these invariants, and the reported theme FOUC, build, i18n, lint, and Electron checks passed. I have no further blocking findings. |
|
Thanks @greptile-apps — both round-3 P1s fixed (branch squashed): Follower reconciliation stops permanently: an authed follower whose startup fetch failed now schedules a single one-shot re-check after 60s that re-runs the bounded fetch; on recovery it applies the DB value, marks authoritative, and corrects the mirror. No recurring polling — reconciliation beyond that stays on next-open per the spec's §12 boundary for short-lived surfaces. Rollback retains unhydrated baseline: a failed PUT and failed recovery GET now arm a Both invariants are source-locked by new tripwires in |
1456df8 to
56287fa
Compare
|
Re-checked the latest squashed head and the round-3 fixes. Both reported P1s are addressed:
The source tripwires cover both invariants, and the reported FOUC, build, i18n, lint, and Electron checks are green. I have no further blocking findings. |
32e0fa8 to
3698c94
Compare
c573bea to
65c59f0
Compare
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
65c59f0 to
a768571
Compare
|
@carvalab if you resolve the conflicts and push the changes CI will trigger. Let me know if you want me to take a look at anything. |
Hey there, @khaira777 Yes, there are quite a few changes happening, but I'm carefully checking to make sure nothing breaks and am running some end-to-end tests. Having a fresh pair of eyes would be wonderful! |
bbe5cba to
dd405e5
Compare
|
CI is green except one flaky upstream test. Fixed it in this push: the reports-insights fixtures were pinned to June dates and quietly fell out of the 90-day query window on Aug 31 (which is why it started failing for everyone). The fixtures now anchor to the current week, so the test is stable no matter when it runs. Also cleaned up a couple of stale test expectations from the rebase while I was in there. |
cb916f5 to
3dae2f4
Compare
|
@carvalab if it works on your end and you have review/tested, you can go ahead and merge. We are out of greptile reviews for 2 days. |
3dae2f4 to
d148bc3
Compare
…ion (FreeOpenSourcePOS#513) - theme_mode setting (light|dark|system, default system) validated in both write paths (IPC set-setting + HTTP wildcard PUT); no migration, no seeding - useThemeMode store + ThemeSync component: matchMedia resolution, .dark toggle, ownership-gated localStorage mirror, token-gated DB seed for follower windows (DB > param > mirror > OS, bounded retry with real delay + one-shot 60s re-check after transient failure), in-window user-choice guard, server-truth rollback with needsServerTruth hydration delivery, post-login re-hydration via flo:auth-changed, set-theme-effective push - FOUC pre-paint guard (param > mirror > prefers-color-scheme) with vm-based precedence matrix test - main-process wiring: direct getDatabase() initial isDark at window creation, sender-validated set-theme-effective handler (overlay + background color, main window only), effectiveTheme on get-status, ?theme= on the KDS window URL - Appearance settings tab (ownerManager-gated, optimistic + rollback, 5 locales incl. French from FreeOpenSourcePOS#549) - native Electron e2e: dark toggle, nativeTheme.themeSource system sync, relaunch persistence; theme-mode-settings + theme-fouc-script suites; KDS-hardening and renderer-API expectations aligned - full dark-mode coverage: Settings page and panels, products, customers, tables, staff, addon-groups, POS modals, KDS components, dashboard — light mode pixel-stable; docs amended (title-bar-phase1, platform matrix) Review fixes (greptile): in-window user-choice guard; DB fetch before mirror; bounded retry with no stale mirror write-back; server-truth rollback; one-shot follower re-check after transient outage; hydration delivers server truth when a failed save armed it. Ponytail cleanup: shared fetchThemeMode helper (boot + recheck dedup), stdlib asserts in theme-mode-settings, trimmed VM stubs, optional relaunch on relaunched harness, dead refs/conditions/comments removed (-144 lines). Rebase follow-ups (FreeOpenSourcePOS#537/FreeOpenSourcePOS#549/FreeOpenSourcePOS#546): tokenize weighted-products/refund/ period-toggle surfaces; fr.json theme-key parity; auth-changed dispatch guarded for non-browser envs (auth-ui-deterministic); themed order-card selector in quick-customer-creation e2e; dashboard KPI values kept dark on pastel tiles; reports-insights fixtures made date-independent (they aged out of the 90-day window on Aug 31); comment hygiene (~200 lines of review-narration stripped); test:refunds restored to the test chain; allowScripts field declared for local npm install scripts.
d148bc3 to
940570b
Compare
|
Superseded by #563 (same commit, reopened from an in-repo branch so CI runs without the fork workflow-approval gate). |
Summary
Implements #513 — end-to-end Light/Dark/System theme support across the renderer and Electron main process, with no new dependencies.
theme_mode(light|dark|system, defaultsystem) registered in both settings allowlists (ALLOWED_IPC_KEYS,ALLOWED_WILDCARD_KEYS) and value-validated in both write paths before persist. No migration, no seeding; absent/invalid resolves tosystem.useThemeModestore +ThemeSyncclient component (HtmlLangSync pattern) — resolvessystemviamatchMedia, toggles.darkon<html>, mirrors the resolved palette to localStorage, and pushes the effective theme to main. Follower windows (KDS/popup/browser) boot via?theme=param → mirror → authenticated settings fetch → OS; mirror writes are ownership-gated so OS guesses never clobber the owner's value.prefers-color-scheme, try/catch-wrapped); precedence matrix covered by a new vm-based test suite.set-theme-effectiveIPC (sender-validated) →applyTitleBarOverlayTheme+setBackgroundColoron the main window;createWindow()reads the persisted theme via directgetDatabase()so initial overlay colors are correct on every platform (crash-recovery re-creation included). Windows/macOS re-color live; Linux picks up a theme change on next launch (documented platform contract); KDS windows get?theme=at open.docs/title-bar-phase1.mddark-theme deferral updated; appended "Dark mode ([Feature] Implement End-to-End Dark Theme Support and Title Bar Synchronization #513)" section todocs/title-bar-platform-matrix.md.Test Plan
npm run lint(0 errors),npm run build,npm run i18n:checknpm run test:titlebar-window-options— extended: theme-mode helpers (resolve/validate/URL-param rewrite)npm run test:electron-api-contract—setThemeEffectivetyped on both sidesnpm run test:theme-mode-settings(new) —theme_modewrite-path validation, negative + persistence, both IPC and HTTPnpm run test:theme-fouc-script(new) — FOUC precedence matrix (10 cases) run against the extracted production scriptnpm run test:e2e:electron(newtheme.electron.spec.ts) — Dark toggle →.dark+getStatus().effectiveTheme; System mode driven by realnativeTheme.themeSourceoverrides; full relaunch persistence (SQLite round-trip); evidence screenshots viaFLO_E2E_EVIDENCE_DIROffline-first
Theme resolution and persistence use only local SQLite + localStorage; zero network calls in the theme path.