Skip to content

feat(sdk): add tailordb migration sync subcommand#1183

Draft
toiroakr wants to merge 1 commit into
mainfrom
feat/tailordb-migration-sync
Draft

feat(sdk): add tailordb migration sync subcommand#1183
toiroakr wants to merge 1 commit into
mainfrom
feat/tailordb-migration-sync

Conversation

@toiroakr
Copy link
Copy Markdown
Contributor

Summary

  • Add tailor-sdk tailordb migration sync <number>. The subcommand reconstructs the TailorDB schema snapshot at the given migration number (0 for the baseline, etc.) from the working tree's tailordb-migrations/<namespace>/{0000/schema.json + NNNN/diff.json...} and pushes it to the remote, then sets the sdk-migration: mNNNN label to that number.
  • Recovery use case: when an unintended deploy --no-schema-check leaves the remote schema out of sync with its migration label (a possibility this PR doesn't address; see PR fix(sdk): reconcile TailorDB migration label after deploy --no-schema-check #1179 for the prevention side), running sync <N> reconstructs and applies the snapshot for N without requiring a git checkout. A subsequent tailor-sdk deploy catches up the remaining migrations from the working tree.
  • Confirmation flow mirrors deploy: shows a Plan: X to create, Y to update, Z to delete preview and prompts unless --yes.
  • Docs: regenerated packages/sdk/docs/cli/tailordb.md + packages/sdk/docs/cli-reference.md via pnpm docs:update; the sync block sits under the existing tailordb migration section.
  • Tests: added syncCommand CLI shape tests in migrate/cli.test.ts (subcommand registration + args schema).

Notes

  • Scope intentionally narrow — no --catchup flag. The natural recovery flow is sync <N>deploy, which keeps both code paths simple.

Add `tailor-sdk tailordb migration sync <number>`. The new subcommand
reconstructs the TailorDB schema snapshot at the given migration number
(e.g. `0` for the baseline) and brings the remote in line with it without
requiring a `git checkout`. Useful for recovering from drift introduced
by an unintended `deploy --no-schema-check`. After syncing, run
`tailor-sdk deploy` to catch up the remaining migrations from the
working tree.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: 0123147

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

This PR includes changesets to release 2 packages
Name Type
@tailor-platform/sdk Minor
@tailor-platform/create-sdk Minor

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

⚡ pkg.pr.new

@tailor-platform/sdk

pnpm add https://pkg.pr.new/@tailor-platform/sdk@0123147
pnpm dlx https://pkg.pr.new/@tailor-platform/sdk@0123147 --help

@tailor-platform/create-sdk

pnpm add https://pkg.pr.new/@tailor-platform/create-sdk@0123147
pnpm dlx https://pkg.pr.new/@tailor-platform/create-sdk@0123147 my-app

commit: 0123147

@github-actions
Copy link
Copy Markdown

Code Metrics Report (packages/sdk)

main (0cee9fb) #1183 (fa6437f) +/-
Coverage 61.8% 61.4% -0.4%
Code to Test Ratio 1:0.4 1:0.4 -0.1
Details
  |                    | main (0cee9fb) | #1183 (fa6437f) |  +/-  |
  |--------------------|----------------|-----------------|-------|
- | Coverage           |          61.8% |           61.4% | -0.4% |
  |   Files            |            362 |             363 |    +1 |
  |   Lines            |          12638 |           12720 |   +82 |
+ |   Covered          |           7818 |            7819 |    +1 |
- | Code to Test Ratio |          1:0.4 |           1:0.4 |  -0.1 |
  |   Code             |          82717 |           82962 |  +245 |
+ |   Test             |          34475 |           34490 |   +15 |

Code coverage of files in pull request scope (100.0% → 2.4%)

Files Coverage +/- Status
packages/sdk/src/cli/commands/tailordb/migrate/index.ts 100.0% 0.0% modified
packages/sdk/src/cli/commands/tailordb/migrate/sync.ts 1.2% +1.2% added

SDK Configure Bundle Size

main (0cee9fb) #1183 (fa6437f) +/-
configure-index-size 17KB 17KB 0KB
dependency-chunks-size 34.43KB 34.43KB 0KB
total-bundle-size 51.43KB 51.43KB 0KB

Runtime Performance

main (0cee9fb) #1183 (fa6437f) +/-
Generate Median 2,566ms 2,062ms -504ms
Generate Max 2,735ms 2,305ms -430ms
Apply Build Median 2,603ms 2,060ms -543ms
Apply Build Max 2,623ms 2,085ms -538ms

Type Performance (instantiations)

main (0cee9fb) #1183 (fa6437f) +/-
tailordb-basic 35,130 35,130 0
tailordb-optional 3,841 3,841 0
tailordb-relation 7,428 7,428 0
tailordb-validate 2,566 2,566 0
tailordb-hooks 5,767 5,767 0
tailordb-object 12,136 12,136 0
tailordb-enum 2,462 2,462 0
resolver-basic 9,424 9,424 0
resolver-nested 26,111 26,111 0
resolver-array 18,187 18,187 0
executor-schedule 4,234 4,234 0
executor-webhook 873 873 0
executor-record 8,166 8,166 0
executor-resolver 4,369 4,369 0
executor-operation-function 869 869 0
executor-operation-gql 869 869 0
executor-operation-webhook 888 888 0
executor-operation-workflow 1,714 1,714 0

Reported by octocov

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