Skip to content

feat(t100): durable per-device client prefs#12

Merged
duongdev merged 1 commit into
mainfrom
feat/t100-durable-per-device-client-prefs
Jul 7, 2026
Merged

feat(t100): durable per-device client prefs#12
duongdev merged 1 commit into
mainfrom
feat/t100-durable-per-device-client-prefs

Conversation

@duongdev

@duongdev duongdev commented Jul 7, 2026

Copy link
Copy Markdown
Owner

What

Three web-only client prefs — qualityTier, inputTransport, latencyHud — moved off localStorage (which resets on the iPad PWA) into per-device server ui-state, keyed <base>_<deviceId> (same seam as webPush/notifMutes, t093/t095). Each web device now keeps its own values and they survive a PWA refresh/reinstall. Also kills a live drift bug where qualityTier was double-stored (localStorage vs the global the connector reads).

Spec + rationale: docs/tasks/done/100-durable-per-device-client-prefs.md.

How

  • New pure module src/lib/device-prefs.ts (TDD) — the single owner of the plain↔<base>_<deviceId> remap, defaults, parse-guards, and the qualityTier global-shadow rule: a tier write also mirrors the plain global key the shared-screencast connector reads, so the connecting device's tier applies to the one shared stream with core/remote-page-connector.js byte-unchanged.
  • core/settings-store.js DEVICE_KEY_PREFIXES gains the 3 prefixes; cdp-web-transport.ts resolves/remaps them in getUiState/setUiState and sources the transport mode from ui-state (boots auto, reconfigures once when ui-state lands).
  • settings-dialog.tsx / latency-hud.tsx / app.tsx read/write ui-state; the transport-selector's transient last-good probe cache intentionally stays in localStorage (not a durable pref).
  • Migration is implicit: a device with no qualityTier slot falls back to the existing global value → nothing resets on first load after ship.

Notes

  • A polish pass caught a regression: dropping the qualityTier localStorage key broke viewport.tsx's resize reissue (it read that key to preserve the tier on Page.startScreencast, t099). Fixed with a live in-memory tier mirror in quality-tier.ts, seeded from ui-state at boot + on picker change.
  • Electron is byte-unchanged (all three prefs are web-only).
  • No visual delta — pickers/switch/labels are identical; on-device restore-after-relaunch folds into the standard prod device check.

Tests

typecheck · 1014 unit (+device-prefs 17, quality-tier mirror 3, settings-store 1) · 49 e2e (+2 real-server ui-state round-trip proving persistence + device isolation) · build · biome clean on touched files.

https://claude.ai/code/session_01USyifc9ZK6Cy5hAmKKy2ok

@dokploy-2026-03-01-6ei3s7

dokploy-2026-03-01-6ei3s7 Bot commented Jul 7, 2026

Copy link
Copy Markdown

Dokploy Preview Deployment

Name Status Preview Updated (UTC)
cdp-browser-app ✅ Done Preview URL 2026-07-07T10:37:42.450Z

@duongdev duongdev merged commit 54717e1 into main Jul 7, 2026
3 checks passed
@duongdev duongdev deleted the feat/t100-durable-per-device-client-prefs branch July 7, 2026 10:38
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