Skip to content

feat(devtools): provider-level console log capture with session preserve (0275) - #397

Merged
crs48 merged 6 commits into
mainfrom
claude/0275-devtools-log-persistence
Jul 6, 2026
Merged

feat(devtools): provider-level console log capture with session preserve (0275)#397
crs48 merged 6 commits into
mainfrom
claude/0275-devtools-log-persistence

Conversation

@crs48

@crs48 crs48 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Implements exploration 0275 — DevTools Log Persistence.

What

The Logs tab's console tap lived in a panel-scoped React effect, so navigating away restored console.* and dropped the buffer — logs only existed while you were looking at them.

  • Phase 1 (the fix): capture moves to the provider — ConsoleLogStore ring (1000 entries) + instrumentConsole tap live on XNetDevToolsProvider for the page lifetime; the Logs panel is now a pure view. The SQLite panel reads from the shared store instead of patching console.* a second time.
  • Phase 2: opt-in Preserve log toggle snapshots the ring to sessionStorage (scrubbed of tokens/emails/UUIDs/DIDs, byte-capped) on visibilitychange→hidden/pagehide + a lazy 5s dirty-flush; hydrated entries render dimmed behind a session divider. Off by default; sessionStorage is per-tab and dies on tab close.
  • Rider: crash reports gain recentLogs breadcrumbs (last 50 scrubbed lines) at consent tiers that share crashes.
  • Local-data wipe paths call setPreserve(false) so the snapshot can't survive (or be re-written mid-wipe by the dirty-flush — race caught during live validation).

Phase 3 (durable IndexedDB capture) is intentionally deferred per the exploration. No changeset: @xnetjs/devtools is private: true.

Validation

Live-verified in the running app (see checked Validation Checklist in the doc): capture before the tab is opened / while other panels are active / with the dock closed; preserve round-trip with divider after reload; scrubbed snapshot vs raw live view; no storage writes with preserve off; wipe removes the key; tap overhead ~8µs/line. 27 new unit tests; 205 devtools tests green.

🤖 Generated with Claude Code

xNet Test and others added 6 commits July 6, 2026 13:36
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…eserve

The Logs tab's console tap lived in a panel-scoped React effect, so
navigating away restored console.* and dropped the buffer. Capture now
lives on the provider (ConsoleLogStore ring + instrumentConsole) and the
panel is a pure view. Opt-in Preserve log snapshots the ring to
sessionStorage (scrubbed, byte-capped) so logs survive reloads and die
with the tab. Crash reports gain scrubbed recentLogs breadcrumbs at
consent tiers that share crashes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…local wipe

The 5s dirty-flush could re-create xnet:devtools:logs:v1 between
clearLogSnapshot() and the async OPFS wipe finishing. Wipe paths now call
setPreserve(false), which removes the flag and key and makes any later
snapshotNow a no-op. Caught by live browser validation. Also adds a
node23 launch.json entry (shell default node16 can't run pnpm/vite).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@crs48
crs48 temporarily deployed to pr-397 July 6, 2026 21:04 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Preview removed for PR #397.

github-actions Bot added a commit that referenced this pull request Jul 6, 2026
const fresh = consoleLogs
.getEntries()
.filter(
(e) =>
@crs48
crs48 merged commit b747ea4 into main Jul 6, 2026
14 of 16 checks passed
@crs48
crs48 deleted the claude/0275-devtools-log-persistence branch July 6, 2026 21:21
github-actions Bot added a commit that referenced this pull request Jul 6, 2026
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.

2 participants