feat(cli): alchemy sync — reconcile state drift via read+reconcile - #766
Merged
Conversation
…cile Syncs every resource persisted under a stack/stage back to its last-deployed desired state: observe live cloud state via provider.read, deep-compare against persisted attributes, and on drift run provider.reconcile with the observed attributes as output. Missing resources reconcile greenfield under the same instance id so deterministic physical names converge. --dry-run reports drifted/missing without repairing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/a356a75@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/a356a75@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/a356a75 |
…53b4 # Conflicts: # packages/alchemy/test/test.resources.ts
Sync.plan projects the detection pass onto the engine's Plan shape (drifted → update, missing → create, unchanged/skipped → noop) so the sync command reuses displayPlan / approvePlan / startApplySession — ink TUI when interactive, plain logging fallback otherwise. Skipped resources settle with a terminal 'skipped' status and a reason note. Adds --yes; drops the bespoke printSync formatter. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
alchemy sync: reconcile out-of-band cloud drift back to the last-deployed state recorded in the state store. Unlikedeploy, it needs no re-plan of the stack program — per resource it runs observe → compare → converge:provider.readobserves the live cloud stateunchanged)provider.reconcileruns with persisted props asnewsand the observed attributes asoutput; a missing resource reconciles greenfield under the same instance id so deterministic physical names regenerate identicallyapply.read, and rows in non-terminal statuses (creating,replacing,replaced, …) — those belong todeploy's recovery machinery. Action rows are ignored.Unowned-branded reads are stripped and handled as ordinary tag drift; the brand never persists.DriftResource+TestCloudfixture (an inspectable in-memory cloud) so suites mutate/delete live state out-of-band and assert convergence — 21 cases covering repair, recreation, dry-run, skip reasons, partial-failure isolation, ownership, and binding-derived attribute repair.🤖 Generated with Claude Code