CodeNomad/dev-docs
Pascal André 6f8881d5ae
fix(stats): restore cached totals and refresh only while visible (#1041)
## Summary
Replace the renderer-only workspace-ID cache with bounded validated
display snapshots in backend-owned state.ui.serviceUsage. Cache survives
recreated renderer/backend/workspace identity, keyed by authenticated
service/discovery/execution-host/folder fingerprint and period/timezone.
Eight entries, 1 MiB maximum; no plaintext credentials or paths.
Preferences does not write the opener's client-state journal.

Show previous totals/charts immediately with a cached-state label while
revalidating; preserve them on error. Hidden/unmounted Stats starts no
reads, cancels trailing work and fences late results. Visibility resumes
one read; execution hints use the existing activity cooldown instead of
one native scan per descendant. Manual refresh, period, reconnect and
deletion/pruning paths retained.

## Validation
- Rebased on current dev 7a2ee897e, retaining #1037 shared fixture
cache/shutdown and token UI plus #1039 launcher changes.
- Server/UI typechecks pass; cache/scheduler units 8/8; browser
service-usage 5/5, usage-metrics 4/4, status-tokens 4/4, sequentially.
- Real renderer AND backend recreation with a two-second stats delay:
2098 ms cold / 68 ms restored, then fresh totals replace cached values.
- Hidden-start regression: base makes one unwanted read; fixed makes
zero. Tests cover hidden events, visibility, burst scheduling, identity
changes, retention/errors and malformed cache bounds.
- Isolated native fixture with four synthetic sessions passes; repeated
native reads ~15–19 ms. OpenCode still repeats aggregation; no claim to
optimize large-history scans.
- No app/shared daemon/user data touched. Live installed app and
non-Windows native acceptance not tested.

## Oversized touched files
http-server.ts ~2446 lines; api-client.ts ~817; 10 locale settings.ts
files ~735–749. No unrelated refactor.
2026-10-20 19:49:45 +02:00
..
architecture.md fix(sessions): wire finish, retry and usage signals to OpenCode V2 events (#1033) 2026-10-20 15:51:48 +02:00
BROWSER_AUTOMATION.md refactor(automation): unify native browser previews on the shared page engine (#1020) 2026-10-19 09:27:58 +02:00
BROWSER_DEVICE_EMULATION.md fix(layout): make desktop minimums zoom-aware and compact headers at 420px (#817) 2026-10-01 12:44:01 +02:00
CACHE_REFRESH_CONVENTIONS.md fix(stats): restore cached totals and refresh only while visible (#1041) 2026-10-20 19:49:45 +02:00
DESKTOP_DATA_PROFILES.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
DEVELOPER_MODE.md feat(remote-control): add Remote Control over OpenTunnel alongside direct access (#668) 2026-10-09 12:43:25 +02:00
FILES_PANEL.md fix(files): refresh Workspace with scoped, rate-limited invalidations (#1030) 2026-10-20 00:17:40 +02:00
HOTKEYS.md feat(settings): compact Settings, unified notification routing and autosaving Missions preferences (#1014) 2026-10-19 01:23:35 +02:00
INDEX.md docs(help): multilingual help site with in-app Help menu and palette entry (#859) 2026-10-14 22:44:56 +02:00
MISSIONS.md feat(missions): add a "Compare two models" Mission template (#1026) 2026-10-20 13:55:12 +02:00
MISSIONS_AUTONOMOUS_PLUGIN_REQUIREMENTS.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_CONTINUITY_CONTRACT.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_ENVIRONMENT_ADMISSION.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_FAMILY_AUTHORITY.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_HUMAN_ANSWER_RECEIPTS.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_NATIVE_PRODUCT_ACCEPTANCE.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_RECURRING_SIMPLE.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_RECURRING_SIMPLE_QUALIFICATION.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_REFACTOR_VALIDATION.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_SESSION_RECOVERY.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
MISSIONS_WATCHED_SOURCES.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
NATIVE_INTERRUPTION_UX.md fix(chat): keep request icons and show complete red badges (#871) 2026-10-07 14:22:55 +02:00
OPENCODE_V2_COMPATIBILITY.md chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
OPENCODE_V2_POST_BETA.md chore(opencode): retire adaptations for runtimes and events OpenCode V2 no longer produces (#1034) 2026-10-20 19:19:47 +02:00
PALETTE_SOURCES.md V2(ui): progressively harmonize the CodeNomad interface (#667) 2026-09-15 14:17:30 +01:00
PANEL_EXTENSIONS.md feat(ui): assign backgrounds by surface role and harmonize menus (#914) 2026-10-12 11:12:37 +02:00
PLUGIN_ACTIVATION_CONTROLS.md feat(plugins): add scoped V2 plugin activation controls (#726) 2026-09-25 01:29:14 +02:00
PROVIDER_ACCOUNTS_UX_PLAN.md fix(usage): explain the ChatGPT token-sharing quota limitation (#999) 2026-10-18 04:27:19 +02:00
REMOTE_CONTROL.md feat(remote-servers): pair a desktop window through a Remote Control link (#928) 2026-10-13 02:20:37 +02:00
RUNTIME_MAINTENANCE.md ci: refresh actions and monitor the bundled Node/npm runtime 2026-10-14 10:36:24 +02:00
SESSION_ENVIRONMENT.md feat(missions): native project coordination, briefings and tracking (#866) 2026-10-11 14:55:49 +02:00
SESSION_HISTORY_NAVIGATION.md refactor(chat): render the transcript header as Virtua's first row (#992) 2026-10-17 16:58:26 +02:00
SESSION_HISTORY_QUERIES.md feat(history): name the conversation and worktree of workspace search results (#993) 2026-10-17 16:02:16 +02:00
SESSION_PRUNING_RPC.md docs: prune obsolete specifications and development readouts 2026-10-08 00:42:53 +02:00
SESSION_PRUNING_SAFETY.md feat(pruning): restore opt-in selective deletion through native plugin RPC (#686) 2026-09-10 13:31:40 +02:00
solidjs-llms.txt update blank session cleanup code for now session store logic 2025-11-27 20:18:22 -05:00
TAURI_UPDATER.md build: ship the Linux deb from Electron and the Windows installer without a ZIP (#955) 2026-10-14 16:45:49 +02:00
TAURI_WINDOWS_RUNNER_REFCOUNT.md fix(tauri): prevent Windows event-loop refcount corruption (#996) 2026-10-18 02:07:17 +02:00
TEXT_DISPLAY_BOUNDS.md fix(transcript): reveal display-truncated text in place instead of a copy-only suffix (#1000) 2026-10-18 05:01:03 +02:00
USER_HELP.md docs(help): multilingual help site with in-app Help menu and palette entry (#859) 2026-10-14 22:44:56 +02:00
WORKTREE_SESSION_PLACEMENT.md docs: prune obsolete specifications and development readouts 2026-10-08 00:42:53 +02:00