Skip to content

[WIP] Move the dashboard's diagnostics logic to diagnostics-core - #1109

Draft
bean1352 wants to merge 2 commits into
diagnostics-pocfrom
feat/diagnostics-core-dashboard-api
Draft

bean1352 wants to merge 2 commits into
diagnostics-pocfrom
feat/diagnostics-core-dashboard-api

Conversation

@bean1352

@bean1352 bean1352 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

The dashboard built a lot of diagnostics logic on top of the protocol. This moves it into @powersync/diagnostics-core so other hosts get it too.

What moved

Reading a Sync Config's parameters, rolling bucket stats up per stream, table and bucket stats over SQL, recovering a session from service logs, and inferring a schema from core events. It all works on plain data, so the main entry point still imports no SDK.

New ./web entry point

Opens a headless client and serves it as an SdkIntegration. @powersync/web is an optional peer, so hosts that only inspect an app's own client never load it.

Two bits answer review feedback on the PoC:

  • Defaults to OPFS. IndexedDB gets slow past a gigabyte.
  • Reset deletes the database files instead of clearing rows, and disconnects first so the client doesn't download it all again.

Protocol

unsubscribeStream gains mode: 'all', plus a new unsubscribeAllStreams. Releasing a subscription only starts a TTL, and diagnostics needs the stream to actually stop.

AI disclosure

I implemented this change using Claude (Fable 5.1), and reviewed and tested it myself.

@bean1352
bean1352 added this pull request to stack #1110 September 17, 2026 10:58
@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6a8ebdf

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

This PR includes changesets to release 4 packages
Name Type
@powersync/diagnostics-core Minor
@powersync/diagnostics Patch
@powersync/diagnostics-ui Patch
@powersync/nuxt 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

@bean1352 bean1352 changed the title feat/diagnostics core dashboard api [Feat] Move the dashboard's diagnostics logic to diagnostics-core Sep 17, 2026
@bean1352 bean1352 changed the title [Feat] Move the dashboard's diagnostics logic to diagnostics-core [WIP] Move the dashboard's diagnostics logic to diagnostics-core Sep 17, 2026

@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 show that this generalizes beyond what the dashboard needs, maybe good demo could be to update the diagnostics app to be based on diagnostics-core with a headless sdk (since that's basically what it already does).

I also feel like functionality that requires non-SDK service endpoints to work (like parsing log messages or analyzing a sync config for parameters) should likely not be here, unless we expect SDK diagnostics tooling to eventually make these requests too.


Add the logic a diagnostics host needs on top of the protocol, and a headless web test client.

The main entrypoint gains SDK-free helpers: `readSyncConfigParameters` (what a Sync Config expects of clients), `parseStreamBucketName` and `collectStreamStats` (buckets to streams), `readTableStats` / `readBucketStats` / `readStoredSubscriptions` (over `runQuery`), `collectImpersonationTarget` and `recoverSubscriptions` (a session recovered from service logs), `ObservedSchema` (a schema inferred from core `SchemaChange` events), and small token, log and SQL helpers. `./js` gains `BroadcastCoreEvents`.

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.

Is readSyncConfigParameters used anywhere outside the dashboard? I assume it requires the caller to invoke a service API to resolve config metadata first?

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