Skip to content

Simplify debug report snapshots#285

Draft
soamdesai-tfh wants to merge 15 commits into
mainfrom
bridge_debugging
Draft

Simplify debug report snapshots#285
soamdesai-tfh wants to merge 15 commits into
mainfrom
bridge_debugging

Conversation

@soamdesai-tfh

Copy link
Copy Markdown
Contributor

Summary

  • Simplify debug reports to on-demand snapshots.
  • Remove the global/stateful debug update flow and bridge response payload capture.
  • Keep native response payload snapshots and transport-specific mini app metadata.

Validation

  • cargo fmt --all -- --check
  • cargo test -p idkit-core
  • cargo test -p idkit-core --features wasm-bindings --no-default-features --no-run
  • cargo clippy --all-targets --all-features -- -D warnings
  • ./node_modules/.bin/tsc --noEmit from js/packages/core
  • ./node_modules/.bin/vitest run from js/packages/core
  • git diff --check

Replaces fork PR #282 with an upstream branch PR for cleaner permissions/CI.

soamdesai-tfh and others added 13 commits June 15, 2026 00:49
Simplify the debug report and tighten its handling per review:

- Capture the bridge response (create + poll) alongside the request via a
  new debug_response_payload on BridgeConnection, exposed through WASM as
  debugResponsePayload and surfaced as report.response_payload.
- Stop threading the request payload into every bridge error: remove the
  Error::BridgeRequestFailed variant and the unconditional debugPayload
  attachment at the WASM boundary. The payload is now obtained at a single
  isDebug()-gated point (getBridgeDebugPayload), closing the off-state leak.
- Flatten IDKitDebugReport to the loose v1 shape (version, package_version,
  timestamps, transport: bridge|mini_app, request/response payloads, mini_app
  from window.WorldApp); drop sha256 fingerprinting and the curated native
  log helpers.
- Update the report on timeout/cancelled poll-loop exits for both bridge and
  invite-code paths.

Follow-up hardening:

- getDebugReport() short-circuits on !isDebug() so disabling debug stops
  stored-proof egress.
- "failed" poll status only stamps response_received_at when a poll response
  actually arrived (matches the exception path).
- Omit the rebuilt, non-correlatable proof_request.id from creation-error
  reports while keeping the real id on the live path.
- Fix cloneValue JSON fallback to use "null" instead of invalid "undefined".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Drop the curated `request` summary object (mode/app_id/action/environment/
  return_to/flags), the IDKitDebugRequestMode type, and requestModeFromConfig;
  every field is already carried by request_payload.
- Guard getWasmDebugPayload/getWasmDebugResponsePayload behind isDebug() so
  debugPayload()/debugResponsePayload() no longer run on the default-off path
  (previously fired once per poll for all users).
- Capture the HTTP status on a failed bridge poll instead of collapsing every
  non-2xx into connection_failed; surfaces at response_payload.poll.http_status.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A failed bridge POST /request previously folded the HTTP status and body into
an opaque error message string, leaving the report's response side unstructured
on the creation path (unlike the poll path, which now carries http_status).

Add an Error::BridgeRequestFailed { status, body } variant; the WASM boundary
attaches the namespaced { create: { http_status, body } } object as a single
debugResponsePayload property on the JS error, and request.ts lifts it as-is
into response_payload.create. This mirrors the existing create/poll namespacing
(bridge.rs success path + poll fix) and keeps the bridge-specific shape defined
in Rust rather than reconstructed in TS.

Raw body is stored (no "no error details" placeholder) so the structured field
is truthful: an empty body is reported as empty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Restore the three console.debug calls in the native transport to their
original full-payload form, per review feedback to avoid changing the
existing logging. The full request/response payloads remain available
through the structured debug report (getDebugReport), so no debug data
is lost.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
idkit-js-example Ready Ready Preview, Comment Jun 16, 2026 11:31pm

Request Review

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