Skip to content

Conversation

stevensJourney
Copy link
Collaborator

@stevensJourney stevensJourney commented Oct 20, 2025

Overview

The sync diagnostics tool creates a dynamic schema from the bucket operations received from the PowerSync service. This dynamic schema is used to populate the PowerSync SQLite views which are typically used in various SQL queries - such as in the SQL console page.

The Rust implementation currently intercepts the PowerSync service commands and correctly attempts to process the operations into a dynamic schema. Unfortunately, processing the bucket operations currently only marks the dynamic schema as dirty - we still need to actually update the schema with the PowerSync client in order for SQL queries to use the views.

This typically results in errors such as #736

This applies similar logic, as found in the RecordingStorageAdapter, for the RustClientInterceptor.

Additional improvement:

We currently seem to be manually implementing refreshSchema using a DBAdapter. This implementation does not trigger any schemaChanged listeners - which are used by watched queries. It is possible for an error condition as follows to occur:

  • User connects
  • User quickly navigates to the SQL Console page and uses a query for a PowerSync view, before the View was detected
  • The watched query evaluates the dependent tables, due to the current schema an error no such table ... is displayed
  • The table is eventually downloaded and the schema is applied (manually). The watched query is not informed of this change, it does not re-evaluate.
  • The error persists

We now use the AbstractPowerSyncDatabase refreshSchema method to notify all listeners when the schema has changed. The watched queries should reevaluate the dependent tables and update.

Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: cb0b144

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

This PR includes changesets to release 1 package
Name Type
@powersync/diagnostics-app 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 previously approved these changes Oct 20, 2025
Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

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

The changes look good to me 👍

@stevensJourney stevensJourney marked this pull request as ready for review October 20, 2025 12:39
@stevensJourney stevensJourney merged commit ac82680 into main Oct 20, 2025
9 checks passed
@stevensJourney stevensJourney deleted the diagnostics-app-schema branch October 20, 2025 12:54
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