Skip to content

Self-contained sync rules and sync streams sections - #655

Open
benitav wants to merge 3 commits into
sync-streams-navfrom
sync-rules-deprecation
Open

benitav wants to merge 3 commits into
sync-streams-navfrom
sync-rules-deprecation

Conversation

@benitav

@benitav benitav commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #640, merge that one first.

Sync Rules are deprecated, so this PR separates the two engines in the docs. The Sync Streams section reads as if Sync Rules never existed, and the Sync Rules (Legacy) section has everything a Sync Rules user still needs while they migrate.

  • Pages that showed Sync Streams and Sync Rules side by side in tabs are now two pages: a Sync Streams page and a Sync Rules version under sync/rules/. Sync Streams pages no longer mention Sync Rules anywhere.
  • Pages that apply to both engines (Type Mapping, Compatibility, Client ID and so on) are shared through snippets. They appear in both sections with their own URLs, so the sidebar behaves properly, without duplicating any content. Each shared or split page carries a comment at the top naming its counterpart, so future edits consider both sides.
  • Every Sync Rules page opens with a short deprecation notice that points to the Sync Streams version. The Sync Rules overview now says plainly that Sync Rules are deprecated and how to migrate. The link to the announcement follows once it is published.
  • The anchor link check in CI (pnpm check:links) now understands headings that live in snippets.
  • The agent instructions in .claude/ are updated: new docs cover Sync Streams, Sync Rules docs stay accurate without being prioritized, and the two are never shown side by side.

Worth a look on the preview: the shared pages in both sections (two of them import a nested snippet), and sidebar highlighting on those pages.

🤖 Generated with Claude Code

@benitav
benitav added this pull request to stack #656 September 18, 2026 16:18
@@ -0,0 +1,40 @@
{/* Shared body: rendered by sync/advanced/case-sensitivity.mdx (Sync Streams section) and sync/rules/case-sensitivity.mdx (Sync Rules (Legacy) section). Keep the content valid for both engines. */}

### Case in Sync Rules

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.

This snippet now renders on the Sync Streams page (sync/advanced/case-sensitivity.mdx) as well as the Sync Rules page, but the heading and prose still frame case-folding as a Sync Rules-only behavior: "Case in Sync Rules" here, "Sync Rule queries" on line 5, "case produced by Sync Rules" on line 15, and "this Sync Rule query" on line 28. A Sync Streams reader will see this unchanged and be pointed at a concept ("Sync Rules") that doesn't apply to them. Reword these to be engine-neutral (e.g. "Case in Sync Queries" / "sync queries") so the shared body actually reads as valid for both engines.

- Postgres, MySQL and SQL Server: use a UUID for `id`. Use the `uuid()` helper to generate a random UUID (v4) on the client.
- MongoDB: use an `ObjectId` for `_id`. Generate an `ObjectId()` in your app code and store it in the client's `id` column as a string; this will map to MongoDB's `_id`.

To use a different column/field from the server-side database as the record ID on the client, use a column/field alias in your [Sync Streams](/sync/streams/overview) query (or [Sync Rules](/sync/rules/overview) data query):

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.

This shared snippet renders on the Sync Streams page too, so the "(or Sync Rules data query)" aside puts Sync Rules content side by side with Sync Streams content on the Sync Streams page. The Note on line 15 has the same "...queries and Sync Rules ... data queries..." pairing. Drop the Sync Rules pointer here (state the Sync Streams query alias only) and split out the Sync Rules-specific phrasing into the Sync Rules wrapper page instead, or make both lines engine-neutral if the behavior is identical.


This is common when separate "services" use separate databases, but multiple tables across those databases need to be synced to the same users.

Use a single PowerSync Service instance, with a separate connection for each source database ([planned](https://roadmap.powersync.com/c/84-support-for-sharding-multiple-database-connections); this capability will be available in a future release). Use a unique [connection tag](/sync/advanced/schemas-and-connections) for each source database, allowing them to be distinguished in your [Sync Streams](/sync/streams/overview) or [Sync Rules](/sync/rules/overview).

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.

"...in your [Sync Streams] or [Sync Rules]" pairs both engines side by side in a snippet that now also renders on the Sync Streams wrapper page. Line 44 has the same pattern. Since this snippet is shared, state the connection-tag behavior once without naming both engines (e.g. "distinguished by connection tag in your sync definitions"), rather than listing "Sync Streams or Sync Rules" each time.


You should not add multiple connections to multiple replicas of the same database — this would cause data duplication. Only use this when the data on each connection does not overlap.

It will be possible for each connection to be configured with a "tag", to distinguish these connections in Sync Rules. The same tag may be used for multiple connections (if the schema is the same in each).

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.

This planned-feature description says connections will be distinguished "in Sync Rules" only, but this snippet also renders on the Sync Streams page, and the equivalent description in sharded-databases.mdx describes the same tag as applying to "Sync Streams or Sync Rules." Update this to cover both engines (or use engine-neutral wording) so it doesn't read as Sync Rules-only when shown on the Sync Streams wrapper.

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