Repository navigation
fix(engine): destroy robustness — aggregated GC failures + fatal zombie rows - #899
Merged
Merged
Conversation
…+ deterministic sid order
A no-change redeploy could mark every bound resource "update" forever:
- Binding rows were persisted without stripping unresolved leaves. A
function-typed Effect in binding data (a tagged Worker/Function class in
env — the standard circular-binding pattern) passes through plan/apply
resolution untouched, and durable (JSON) state stores persist it via its
toJSON as an {"_id":"Effect",...} relic. The next plan's diffBindings then
compares that relic against the live class stripped to undefined — a
phantom binding "update" on every deploy. Apply now strips binding rows at
every commit boundary (lifecycle commits, converge, GC), the same
invariant #835/#874/#890 established for props.
- Binding registration order is not stable across deploys (capability
layers do real IO concurrently before host.bind), so provider
diff/reconcile inputs and persisted rows could flip order and churn any
consumer that hashes or deep-compares the array. dedupeBindings and
diffBindings now return sid-sorted rows, and Plan normalizes oldBindings
through dedupeBindings too.
New offline engine suite test/binding-stability.test.ts pins no-change
redeploys to all-noop plans across nine binding-data shapes on both the
in-memory store and a JSON round-tripping store, plus the ordering and
plain-data invariants.
Co-Authored-By: Claude Fable 5 <[email protected]>
… tolerance Destroy (and the GC phase of a deploy) previously failed fast: - One failing provider `delete` interrupted every sibling deletion mid-flight, leaving their physical resources AND state rows behind. collectGarbage now records per-resource failures, keeps deleting everything it can, and raises the combined cause at the end. An upstream whose dependent failed skips its own physical delete (state retained) via an internal DependentDeletionFailed marker, without double-recording. - A "zombie" state row — resourceType with no registered provider (type removed from the program, or renamed without an alias) — killed the ENTIRE plan via `findProviderByType`'s die, blocking both deploy and destroy. Plan/GC now fall back to a stub provider whose lifecycle fails with a typed `MissingProviderError`, so everything else applies/destroys and the zombie surfaces in the aggregated failure with a remediation message. The row is retained so re-registering the provider (or aliasing) reclaims the physical resource. - The replaced-chain drain loop stops after a failed pass instead of spinning forever on rows that cannot make progress. New offline suite test/destroy-robustness.test.ts covers: sibling non-interruption, dependent-failure skip, failing attr-less read recovery, and zombie rows on both destroy and deploy; plan.test.ts pins that zombie rows still plan. Co-Authored-By: Claude Fable 5 <[email protected]>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/23e8174@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/23e8174@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/23e8174 |
Review feedback: a state row whose resource type has no registered provider means the program and state fundamentally disagree, and without the provider the physical resource cannot be deleted anyway — falling back to a stub that fails one row while everything else proceeds just strands the zombie silently. The plan now dies up front with MissingProviderError (resourceType + fqn + remediation) and nothing is deployed or destroyed. missingProviderStub is gone; tests assert the fatal behavior and the clear-the-row remediation path. Co-Authored-By: Claude Fable 5 <[email protected]>
This was referenced Jul 21, 2026
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.
Engine hardening 2/3 — based on
claude/engine-binding-diff-stability; merge in order B1→B2→B3. Destroy (and the GC phase of a deploy) previously failed fast; now it deletes everything it can and aggregates every failure.deleteinterrupted every sibling deletion mid-flight, leaving their physical resources and state rows behind.collectGarbagenow records per-resource failures, keeps deleting, and raises the combined cause at the end. An upstream whose dependent failed skips its own physical delete (state retained) via an internalDependentDeletionFailedmarker, without double-recording the cause.resourceTypewith no registered provider (type removed from the program, or renamed without an alias) — is fatal at plan time. The program and state fundamentally disagree, and without the provider the row's physical resource cannot be deleted anyway, so nothing is deployed or destroyed. Previously this died deep insidefindProviderByTypewith a bare string; the plan now dies up front with a typed error naming the row and the remediation:New offline suite
test/destroy-robustness.test.ts: sibling non-interruption, dependent-failure skip, failing attr-lessreadrecovery, and zombie fatality on both destroy and deploy — including the remediation path (clear the row → destroy proceeds);plan.test.tspins that a zombie row fails the plan withresourceType/fqn/remediation intact.🤖 Generated with Claude Code