feat(desktop): improve hot CPU diagnostics workflow#308
Open
huntharo wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hot CPU diagnostics are now easier to hand off and safer to operate after a capture. The copied profile text keeps the exact artifact paths, calls out sidecar files, and frames the capture as troubleshooting evidence rather than proof that a bug is still active.
Developer troubleshooting actions now go through
diagnostics:*command-bus verbs. The banner can reveal the captured session, Settings can reveal the diagnostics root, and cleanup only targets hot CPU session-shaped direct children under the current hot CPU diagnostics root.The cleanup path is hardened after review: it uses the same env-aware output root as capture writes, skips active in-process sessions at the main-process command boundary, disables conflicting Settings actions while cleanup is pending, and ignores stale banner reveal failures after a newer profile arrives. Hot CPU sessions also have bounded retention plus a durable runbook for opening
.cpuprofileand.heapsnapshotartifacts in Chrome DevTools.Screenshots
Not included. This is a developer-only diagnostics surface, and the important runtime evidence is the built-app profiling artifact smoke below.
Screen recording
Not included.
How was this tested?
pnpm exec vitest run --config vitest.workspace.ts apps/desktop/src/main/handlers/__tests__/diagnostics-handlers.test.ts apps/desktop/src/main/diagnostics/__tests__/hot-cpu-profile-retention.test.ts apps/desktop/src/main/diagnostics/__tests__/hot-cpu-profile-session.test.ts apps/desktop/src/renderer/src/features/settings/pages/__tests__/DeveloperPage.test.tsx apps/desktop/src/renderer/src/features/library/__tests__/HotCpuProfileBanner.test.tsx— 28 passingpnpm typecheckpnpm test— 259 files, 3060 passing, 1 skippedpnpm buildpnpm lintBuilt-app smoke from the first commit:
apps/desktopfrom the builtout/files through Electron withPWRSNAP_E2E=1and a temporaryPWRSNAP_USER_DATA.session.json,samples.ndjson,events.ndjson,renderer-hot-0001.cpuprofile, andrenderer-hot-0001-start.heapsnapshot..cpuprofileJSON and verified it had non-emptynodesandsamplesarrays.Review:
compound-engineering:ce-code-review; it found cleanup/root/race hardening gaps. Fixed them infix(desktop): harden hot CPU diagnostics cleanupand reran the full local gates above.Post-Deploy Monitoring & Validation
hot CPU diagnostics,retention-pruned,hot_cpu_diagnostics_reveal_failed,SESSION_CREATE_FAILED,diagnostics:clearHotCpuSessions,handler_threw diagnostics.session.json,samples.ndjson,events.ndjson,.cpuprofile, and optional.heapsnapshot; repeated sessions stay bounded to the latest retained set.PWRSNAP_HOT_CPU_PROFILING; if artifact creation/regression is confirmed, revert this PR before the next desktop release.Checklist
type(scope): descriptionpnpm test,pnpm typecheck)THIRD_PARTY_LICENSESunchanged; no dependency changes