mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
fix(plan-usage): make the usage chip per-device, not synced
The plan-usage header chip (5h/7d %) was a SYNCED setting, so enabling it on desktop turned it on for mobile too — even though the user never enabled it there. Make the chip's DISPLAY purely per-device (default OFF) like the response viewer / skin, while keeping telemetry COLLECTION server-side. Three leak sources fixed: - server.ts renderIndexHtml force-revealed the chip from the synced value (pre-paint), pushing the desktop choice onto every device. Removed — the chip now ships hidden and the client reveals it per-device via applyHeaderVisibilitySettings. - settings-ui.js load-merge let the server value win, writing desktop's `true` into the (separate) mobile settings blob. showPlanUsageLimits is now a displayKey AND is dropped from the server payload on load, so a stale server value is never seeded into a device that didn't enable it. It's also stripped from the save payload so a mobile "off" can't clobber the server. - Collection was gated on the same synced flag. Decoupled via a new `statusLineTelemetry` ACTION field (schema + system-routes): sent on ENABLE only and never persisted, so the exporter is injected when a device turns the chip on but is never yanked when another device has it off (it's shared across sibling sessions). Session-create already reads the per-device blob, so that path was already correct. One-time migration clears a stale synced `true` from the mobile blob so existing mobile installs default to OFF without a manual toggle. Verified end-to-end on an isolated server: with showPlanUsageLimits=true persisted, the rendered HTML ships the chip hidden; a fresh browser context (mobile case) keeps it hidden while a context that explicitly enabled it shows it; the PUT accepts statusLineTelemetry and does not persist it. tsc + frontend-syntax + system-routes/index tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -369,6 +369,12 @@ export const SettingsUpdateSchema = z
|
||||
showSubagents: z.boolean().optional(),
|
||||
showMultiMonitorButton: z.boolean().optional(),
|
||||
showPlanUsageLimits: z.boolean().optional(),
|
||||
// Action field (NOT persisted as a setting): when true, (re)injects the
|
||||
// plan-usage statusLine exporter into active Claude sessions so live usage %
|
||||
// starts flowing. Sent on ENABLE only — the chip's DISPLAY is per-device
|
||||
// (client-side), but telemetry COLLECTION is server-side, so the per-device
|
||||
// toggle signals it out-of-band here rather than via showPlanUsageLimits.
|
||||
statusLineTelemetry: z.boolean().optional(),
|
||||
// Input
|
||||
gestureControlEnabled: z.boolean().optional(),
|
||||
// Claude CLI settings
|
||||
|
||||
Reference in New Issue
Block a user