Repository navigation
fix(engine): never persist unresolved Output exprs in resource state - #835
Merged
Merged
Conversation
Early state commits (`creating`/`replacing`) snapshot plan props that can
still hold live Output proxies. Durable JSON stores drop them silently, but
the in-memory scratch store used by tests kept them — so after an
interrupted apply, a later destroy plan fed live proxies back into
`provider.read` as `olds`, exploding on first string coercion inside
distilled's path-parameter builder ("Cannot coerce Output<...>").
Strip unresolved exprs at the state-commit boundary so both store kinds
honor the provider contract that `olds` is resolved Props.
Also fix the Planetscale Hyperdrive fixture's `migrationsDir`, which was
repo-root-relative and ENOENT'd when running vitest from packages/alchemy —
the real deploy failure the coercion defect had been masking.
Co-Authored-By: Claude Fable 5 <[email protected]>
sam-goodwin
marked this pull request as ready for review
July 15, 2026 21:07
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/3876830@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/3876830@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/3876830 |
Module-scope constant with an honest comment: the guard exists because Stack.ts is bundled into the worker, not to defer execution. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Both
test/Planetscale/Postgres/Hyperdrive.test.tstests died with a defect thrown from distilled's path-parameter builder:Two bugs stacked:
1. Engine: interrupted creates persisted live Output proxies
The first
creating/replacingcommits snapshot plan props, where upstream references are still liveResourceExpr/PropExprproxies. Durable JSON stores drop them silently (proxies are function-typed), but the in-memory scratch store used bytest.providerkept them. After a mid-deploy failure, the destroy plan handed those props back toprovider.readasolds, andresolveDatabase(olds.database).organizationreachedgetBranchas an unresolved proxy — the defect above, which also masked the real deploy error (the destroy runs insideEffect.ensuring, and defects escapeEffect.ignore).Fix: strip unresolved exprs at the state-commit boundary, keeping both store kinds consistent with the provider contract that
oldsis resolvedProps:stripUnresolved(Diff.ts) deep-replacesExpr/Effectleaves withundefined, preservingRedacted/Duration. Regression test inapply.test.tscovers interrupted-create → state hygiene → destroy convergence.2. Fixture:
migrationsDirwas repo-root-relativeThe masked failure:
ENOENT: FileSystem.readDirectory('./packages/alchemy/test/...'). Tests run frompackages/alchemy, so the branch reconcile failed right after the branch became ready and cascaded every dependent tofail. Now resolved cwd-independently:Note: with destroy actually working now, each test really deletes and recreates the fixed-name
alchemy-postgres-hyperdrivedatabase — it previously survived only because the destroy plan died before deleting anything.🤖 Generated with Claude Code