Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add: tabId + frameId on debug-trace records (JSONL + CDP)#225

Merged
twschiller merged 2 commits into
mainfrom
add-tab-frame-id-to-trace-export
Jun 9, 2026
Merged

Add: tabId + frameId on debug-trace records (JSONL + CDP)#225
twschiller merged 2 commits into
mainfrom
add-tab-frame-id-to-trace-export

Conversation

@twschiller

@twschiller twschiller commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add tabId and frameId to every record in the popup's JSONL export and the window.__abs_dumpTrace() CDP response. Today the JSONL drops both (tabId only appears in the filename, frameId is lost entirely); the CDP path returned them via an envelope. The two surfaces now share one flat shape: DebugTraceEntry + tabId + frameId. addedAt is internal IDB bookkeeping and is not exposed (each entry carries its own timestamp stamped at content-script emit time).
  • Update extension/data/debug-trace.schema.json to put tabId / frameId on each entry variant (segment / rule-application / navigation) so the public schema covers both surfaces with no envelope.
  • New lib/debug-trace-export.ts exports toExportedRecord + buildJsonl. The popup hook and the background's CDP handler both call into it so the wire shape lives in one place.
  • New schema-conformance test (lib/__tests__/debug-trace-export.test.ts) reads the actual schema file from disk and runs each emitted line through @cfworker/json-schema. Adding a field to a DebugTraceEntry variant without bumping the schema fails the test (additionalProperties: false + a negative-control case that drops tabId).
  • Docs (docs/src/content/docs/debug-trace.md) updated: the prose that previously said "the three top-level entry types are" now describes records as type-discriminated with tabId / frameId on every record.

Test plan

  • bun run check (biome + eslint) — clean
  • bun run typecheck — clean
  • bun run test — 1910 tests pass (4 new in debug-trace-export.test.ts)
  • bun run knip — clean
  • pre-commit run on changed files — passes mdformat, biome, eslint, copyright headers
  • Manual: load the unpacked extension, enable the popup's debug trace, click Export — confirm each JSONL line has top-level type, tabId, frameId.
  • Manual: in a CDP-driven harness, call await window.__abs_dumpTrace() and confirm each element is the flat shape (no entry / addedAt envelope).

🤖 Generated with Claude Code

Each JSONL line now wraps the entry with the recording context so a single
file (or a concatenation of files across tabs) keeps per-frame attribution.
Matches the shape `window.__abs_dumpTrace()` already returns. `addedAt` is
omitted — the entry's own `timestamp` is what callers correlate against.

Schema-conformance test reads `extension/data/debug-trace.schema.json`
directly and validates every exported line with @cfworker/json-schema, so
adding a field to a `DebugTraceEntry` variant without bumping the schema
fails CI.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser-shield-demo-site Ready Ready Preview, Comment Jun 9, 2026 11:57am

Request Review

Previous revision wrapped each exported record as `{tabId, frameId, entry}`.
Flatten to `entry + tabId + frameId` so the public shape has no envelope.
Applies to both the popup JSONL export and the `__abs_dumpTrace()` CDP path
so they continue to share a single schema.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@twschiller twschiller changed the title Add: tabId + frameId to debug-trace JSONL export Add: tabId + frameId on debug-trace records (JSONL + CDP) Jun 9, 2026
@twschiller twschiller merged commit edf90ce into main Jun 9, 2026
7 checks passed
@twschiller twschiller deleted the add-tab-frame-id-to-trace-export branch June 9, 2026 12:00
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