Skip to content

Universal PowerSync Diagnostics (POC) - #1094

Draft
khawarizmus wants to merge 17 commits into
mainfrom
diagnostics-poc
Draft

Universal PowerSync Diagnostics (POC)#1094
khawarizmus wants to merge 17 commits into
mainfrom
diagnostics-poc

Conversation

@khawarizmus

@khawarizmus khawarizmus commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This PR implements a live-attach diagnostics tool built once and reused across different hosts.

New packages

  • @powersync/diagnostics-ui — the shared UI (contains six tabs: Sync Status, Data, Buckets, Streams, Config, Logs).
  • @powersync/diagnostics-core — the host-side client and the PostMessageTransport.
  • tools/diagnostics-extension — a Chrome DevTools extension (using WXT).

@powersync/common

  • Add the diagnostics subpath: the protocol, the agent, and the state mappers.
  • Add schema serialization: Schema.serialize() and fromSerialized(), with tests.
  • Promote connector and connectionOptions to the public database interface.
  • Add the diagnostics sync option.

@powersync/web

  • Add the BroadcastChannel transport and event source.
  • Add enableDiagnostics(db).

shared-internals

  • Fix the connector getter to persist for the connection lifetime.
  • Wire the core diagnostics event stream (HandleDiagnostics) into the JS SDK.

@powersync/nuxt

  • Replace the old inspector with the shared UI over the protocol.
  • Delete the interceptor, the schema inference, and the dead inspector code.

Notes

  • Draft PR for review.
  • The extension ships here for review. We may move it to its own repository later.

Claude code was used to steer the discovery and development. The code was reviewed and modified manually.

…ream, UI components, and schema inspection features
…t and enhance connection handling in extension
…ostMessageTransport, enhance package metadata, and add Chrome types
…play and integrate virtual scrolling for upload queue
…t detail component, and improved data handling features
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8048c3a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@powersync/common Minor
@powersync/diagnostics-core Minor
@powersync/diagnostics-extension Minor
@powersync/nuxt Minor
@powersync/shared-internals Minor
@powersync/diagnostics-ui Minor
@powersync/web Minor
@powersync/node Patch
@powersync/react-native Patch
@powersync/tanstack-react-query Patch
@powersync/diagnostics-app Patch
@powersync/adapter-sql-js Patch
@powersync/capacitor Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@simolus3 simolus3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To share more context here (I've also shared that offline with more context @khawarizmus). I think the idea is awesome, my initial architectural complaints are:

  1. It's not clear whether we need a browser extension, so remove that from this PR which is already very big (you can open a follow-up PR for that separately).
  2. I think a JSON-based protocol over "any two way channel" is the wrong abstraction here. It e.g. forces us to re-invent an RPC protocol when some implementations we'll use (say the Dart VM service protocol) are already RPC based.
  3. None of this should require any changes to an existing SDK package (aside from forwarding core diagnostics events, but even that should likely be a separate PR to validate that the basic integration can work without SDK changes). We can likely inject an agent by writing a vite devtools package instead. Or initially, we could also expose it as a seperate package a user would depend on to expose the channel (e.g. a enablePowerSyncDiagnostics(port: MessagePort, db: BasePowerSyncDatabase)).
  4. Related to 2 and 3, the interface the diagnostics tool expects an SDK to provide should be an actual TypeScript interface with async methods and event listeners. It is the responsibility of each integration (vite, postMessage iframe, Dart) to figure out how to implement that interface by doing the serialization itself.

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