Repository navigation
feat(engine): first-class local vs live provider modes - #963
Conversation
Persist which provider mode (local/live) reconciled each resource, plan mode switches as replacements, and resolve every delete with the provider variant of the mode that created the row. Adds local()/live() combinators, ProviderLayer.dual (lazy memoized variants, replaces select), and a standard LocalProvider runner for long-running dev processes that Command.Dev and LocalWorkerProvider are rebuilt on. Co-authored-by: Cursor <cursoragent@cursor.com>
7074898 to
400c9a1
Compare
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/fb3f49a@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/fb3f49a@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/fb3f49a |
Adds infrastructure-as-code/local-provider.mdx (provider modes, ProviderLayer.dual, LocalProvider.make, testing) with a sidebar entry and a cross-link from the Custom Provider guide, and a "Provider Modes & Local Providers" doctrine section in AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…detail) Co-authored-by: Cursor <cursoragent@cursor.com>
Drop local(): dev mode IS the local default, so the only user knob is live() — "run this live even in dev" (a no-op during deploy). Exported flat as Alchemy.live(); ProviderModePolicy reduces to a boolean. Tests simulate dev runs via an AlchemyContext.dev override (inDev helper). Co-authored-by: Cursor <cursoragent@cursor.com>
… only building providers Co-authored-by: Cursor <cursoragent@cursor.com>
Each test.provider test owns an isolated scratch stack (private in-memory state, physical names derived from the unique test name), so none can observe another's cloud resources. Wrapping them in describe.concurrent overlaps their workers.dev edge-propagation waits, cutting the file from ~450s serial (the whole Workers suite's critical path) to ~80s. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # packages/alchemy/src/Cloudflare/Workers/LocalWorkerProvider.ts
Exercises both self_url forms against local workerd (the suite runs with dev: true): the env sentinel (PUBLIC_URL on the async worker) and the Effect-native yield* Worker.URL accessor (new /url route on the effect worker). Covers the local path ported in the main merge, which had no suite coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
…e simulators Points the cloudflare-tools submodule at the local-bindings branch (alchemy-run/cloudflare-tools#85) and wires the new simulators into dev mode: - KV Namespace, R2 Bucket, and D1 Database get registry-free local providers registered via ProviderLayer.dual: under `alchemy dev` the resource is a `dev:`-identified state row with no cloud API calls. - toRuntimeBinding discriminates on the identity: a `dev:` id lowers onto the local simulator (KvNamespace.local / R2Bucket.local / D1.local), a real id keeps the remote proxy — so `Alchemy.live()`-opted resources still pass through to the cloud in dev. R2 has no opaque id, so the `dev:` marker rides on the bucket name. - Live providers gain Queue-style promotion guards: a `dev:` id diffs as update-not-replace (with the id dropped from stables for that update), observation skips the impossible by-id read, and delete is a no-op. - Cache API (`caches.default`) and `request.cf` need no alchemy wiring (always-on plugin / entry middleware); pinned by CacheCfLocal.test.ts. D1 migrations/imports are not applied locally (no Node-side query path into the simulator yet) — the local provider warns and skips. Co-authored-by: Cursor <cursoragent@cursor.com>
…rkerd gateway The D1 simulator is only reachable from inside workerd, but alchemy's migration runner is Node code in the deploy process. Bridge the two: - ApplyMigrations is refactored around a D1SqlExecutor — the same executor-agnostic flow (wrangler-compatible d1_migrations table, idempotent re-application, sequential ids) now runs against either backend. The cloud executor keeps distilled's d1.queryDatabase. - LocalD1Gateway boots a scoped, ephemeral workerd whose only module forwards POST bodies to the raw `d1` service (a plain service binding carrying the database id on the designator props), so Node speaks the full multi-statement D1 HTTP protocol into the simulator's DO SQLite. - The D1 local provider applies migrations in reconcile through that gateway, records migrationsHashes, and detects file/table drift in diff exactly like the live provider. importFiles remain cloud-only. The cloudflare-dev example's D1 database now uses a real migrationsDir and its /d1 route relies on the migrated schema (no runtime DDL). Co-authored-by: Cursor <cursoragent@cursor.com>
…)-in-dev coverage
Establishes the practice: every resource with a local provider gets a
co-located {Resource}.local.test.ts (Test.make({ dev: true })) covering
both the local-simulator roundtrip and the Alchemy.live() opt-out —
documented in the AGENTS.md provider-modes doctrine.
- Renames the new local suites to the convention (KV/Namespace.local,
R2/Bucket.local, D1/Database.local, Workers/CacheCf.local).
- Adds Alchemy.live()-in-dev tests for KV (mixed local + live namespaces
on one worker), R2, and D1: real (non-dev:) identities, remote-proxied
bindings verified out-of-band via distilled, and the stamped-live
delete on destroy verified gone from the cloud.
- KV fixture selects the binding under test via ?binding=; R2 fixture
gains a /seed route that writes without deleting.
Co-authored-by: Cursor <cursoragent@cursor.com>
…ist-optional providers - Provider.succeed/effect accept an optional `list` (safe [] default), removing the inference trap where the missing required member defaulted every *Req type param to never. Local providers drop their boilerplate empty list. - Inline `script:` workers now serve under the local provider (the string IS the module; changes restart via the hashed config) instead of silently hanging on a bundler watch that never emits. - Queue bindings carry an alchemy-only `queueId` (stripped before upload) so dev can discriminate: local queues use the broker; Alchemy.live() queues fail the deploy loudly — the runtime's remote queue producer (queue-remote translator, companion branch) has an unfinished capnweb RPC leg upstream, and a clear deploy error beats a guaranteed 500 on first send. - materializeWorkerBindings no longer double-emits resource-backed env entries as duplicate json bindings alongside their native binding. - Queue.local.test.ts pins end-to-end local delivery (producer + consumer + broker) and the loud live()-queue failure; readiness backoff in local tests is capped (uncapped exponential over 10 recurs summed to ~8.5 minutes). Co-authored-by: Cursor <cursoragent@cursor.com>
…motion test, runner hang fix
Closes out the local-provider gap list:
- QueryDatabaseLocal reaches the LOCAL simulator for `dev:` databases:
the D1 client is refactored around a query transport, and a per-call
ephemeral workerd gateway tunnels {sql, params} / batch bodies into
the simulator's DO SQLite (same storage the worker binding reads).
KV/R2 *Local capability layers fail `dev:` ids loudly with guidance
(the D1 gateway is the template for their follow-up).
- D1 importFiles apply locally (multi-statement SQL through the
gateway, hash-skip semantics matching the cloud import flow) with
drift detection in diff.
- Worker `dev: { cache, cf }`: Cache API opt-out (workers.dev parity)
and per-worker request.cf override, wired through the hashed config
to the runtime (companion: RuntimeWorker.cf + per-worker Globals).
- DevPromotion.test.ts: a dev-mode stack (KV/R2/D1 `dev:` rows) deploys
live — mode-switch replacements create real cloud resources, verified
out-of-band, and destroy removes them.
- alchemy-test: a timed-out body is now interrupted fire-and-forget
with a bounded 10s teardown grace, then abandoned — a hung finalizer
(e.g. a scratch destroy blocked on wedged dev machinery) can no
longer swallow the timeout report and stall the run to the wall.
- cloudflare-tools submodule bump: remote-queue scaffolding (marked
non-functional), RuntimeWorker.cf, WORKERD_DUMP_CONFIG debug dump.
Co-authored-by: Cursor <cursoragent@cursor.com>
The `*Local` KV and R2 capability layers (Action-side clients speaking the cloud REST API) can now reach `dev:` resources: each op boots an ephemeral workerd gateway that emulates the REST endpoints the client builders call over the native binding, and the op's HttpClient is rebased onto the gateway origin — same clients, same distilled ops, same typed error matchers (KeyNotFound 10009, NoSuchKey 404), local data plane. Shared scaffolding lives in Cloudflare/LocalGateway.ts; the D1 gateway is refactored onto it. - KV: values GET/PUT(multipart)/DELETE, metadata, keys list, bulk/get - R2: object GET/PUT/DELETE, bulk delete, list with cursor - Action-seeding tests prove the worker's native binding reads what the Node-side client wrote (KV + R2) Queue live() producers stay a loud deploy-time error, now citing the platform limitation: Cloudflare preview sessions do not support queue bindings at all (an edge preview with one serves 503 for every request; wrangler has the same gap — cloudflare/workers-sdk#9929). Also fix the cache-cf test fixture to use a per-run cache key (the local cache simulator persists across runs), and bump cloudflare-tools for the per-worker cf blob, the Bun-spawner workerd console output fix, and the process-wide port allocation fix that resolved rotating 120s hangs when many local dev stacks start concurrently. Co-authored-by: Cursor <cursoragent@cursor.com>
…latform limitation Co-authored-by: Cursor <cursoragent@cursor.com>
…ne-managed shim Producing to an Alchemy.live() queue from a locally-running worker now works. Cloudflare preview sessions reject queue bindings at the platform level (cloudflare/workers-sdk#9929), so the eval conditionally registers a REAL shim worker instead — an ordinary engine-managed Worker (+ Alchemy.Random bearer token) instantiated when a LOCAL host binds a LIVE queue, the same idiom as AccountApiToken and event-source mappings: local worker ── env.QUEUE.send() ──▶ forwarder (local workerd) wire protocol + bearer token ──▶ deployed shim (workers.dev) ──▶ real Cloudflare Queue The engine provides the whole lifecycle: Output-based ordering (shim deploys before the local worker serves), stable-name updates, deletion on destroy, and orphan GC on promotion (a live deploy stops registering the shim). Both binding spellings are covered — plain `env: { QUEUE: queue }` (WorkerAsyncBindings) and the WriteQueue capability layer. v8-serialized messages are rejected with a 422 explaining to pass an explicit contentType; the shim's queueId/shim metadata is stripped from the wire shape before upload. The e2e test deploys a live() queue + local worker in dev, sends single and batch messages through the binding, and pulls them back out of the REAL queue via an out-of-band http_pull consumer. Co-authored-by: Cursor <cursoragent@cursor.com>
Consuming an Alchemy.live() queue from a locally-running worker now
works, completing the dev-mode queue story (producers landed via the
deployed shim):
local worker ──▶ shim ──▶ real queue ──▶ pull loop ──▶ local broker
──▶ local queue() handler
- The Consumer's local provider, for a live queueId, observes the real
queue (name + consumers), ensures an http_pull consumer exists for
the pull loop to lease from, and records queueName/pullConsumerId on
the attributes; delete removes the pull consumer (idempotent).
- LocalWorkerProvider wires consumers of live queues with
`pull: { queueId, accountId }` so the runtime's Queue plugin drains
the real queue into the local broker — local batching/retry/DLQ
semantics apply from there.
- E2E test: live() queue + local worker + Consumer; a message produced
through the binding lands in the REAL queue and comes back to the
local queue() handler; destroy removes the queue, shim, and pull
consumer.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Conflict: main's assets-only Workers (#969) added its dev-mode support to LocalWorkerProvider's old runInstance structure, which this branch replaced with LocalProvider.make. Resolved by porting the feature into the new structure: an `assetsOnly` flag on the resolved (hashed) config and a runAssetsOnly branch in the start dispatch serving the ASSETS-delegating stub. Added AssetsOnly.local.test.ts to pin the dev-mode path (main only covered the live deploy). Co-authored-by: Cursor <cursoragent@cursor.com>
| // A `dev:` id means the live database doesn't exist yet — update | ||
| // (create) rather than replace, even if name/account changed. The dev | ||
| // id is about to be replaced by a real one, so it must not be | ||
| // advertised as stable for this update. | ||
| if (output?.databaseId && !isLiveId(output.databaseId)) { | ||
| return { action: "update", stables: ["accountId"] } as const; | ||
| } |
There was a problem hiding this comment.
I thought we wanted the engine to see these as distinct entities with a replace in between, orchestrated by the engine, so that way the isLiveId bit is no longer necessary. Did that not work out?
There was a problem hiding this comment.
You were right — it did work out; this was vestigial. The engine plans a replacement on any stamped-mode mismatch (without consulting the provider diff) and routes each generation's delete to the provider of the mode that created it, so a live provider can never actually see a dev: id. Removed every isLiveId branch from the KV/R2/D1/Queue live providers in 427b564 and replaced DevPromotion.test.ts with ModeCycle.test.ts — the full local → hybrid (live() within dev) → live → local cycle against the real cloud, including the previously-untested demotion leg. All green with zero promotion logic in the providers.
| export class ProviderModePolicy extends Context.Service< | ||
| ProviderModePolicy, | ||
| boolean | ||
| >()("ProviderModePolicy") {} |
There was a problem hiding this comment.
Have you considered using Context.Reference instead of Context.Service? This way the default value is returned automatically if not specified in context.
There was a problem hiding this comment.
Done in 427b564 — with one nuance: the some/none distinction was load-bearing (an explicit policy that disagrees with a prior registration dies with ConflictingProviderModeError; an absent one inherits). So it's a tri-state Context.Reference<boolean | undefined> defaulting to undefined, which keeps that distinction while collapsing the serviceOption/Option juggling at the consumers.
There was a problem hiding this comment.
This can probably be simplified using the platform proxy - implementation in that PR isn't perfect but can be adapted.
There was a problem hiding this comment.
Adopted — and it reached further than D1. I extracted the platform proxy from #74 into alchemy-run/cloudflare-tools#88 (adapted for post-#85 main; the main fix was a layer-lifetime bug where Effect.provide tore down the scoped services as soon as open() resolved), then migrated all three gateways in bccbdad:
- D1:
withLocalD1Queryopens a proxy with a rawd1service binding and POSTs the D1 HTTP protocol through the fetch passthrough — multi-statement migrations keep working, bespoke gateway worker gone. - KV/R2: the REST-API emulation gateways are deleted entirely; for
dev:ids the*Locallayers now reuse the*Bindingclient builders over proxied native bindings (R2 rich objects needed a newr2-objectprotocol tag in feat: dev mode for cloudflare workers #88 — body buffering + Node-side rehydration with bodyUsed semantics).
Co-authored-by: Cursor <cursoragent@cursor.com>
…mode switches are engine replacements Review feedback from #963 (john-royal): - Remove every isLiveId promotion branch from the KV/R2/D1/Queue live providers (diff update-with-narrowed-stables, reconcile/read dev-id skips, delete guards). The engine already plans a REPLACEMENT when a row's stamped providerMode differs from the resolved mode — without consulting the provider diff — and routes each generation's delete to the provider of the mode that created it, so a live provider can never see a dev: id. Queue's queueId returns to stables. - Replace DevPromotion.test.ts with ModeCycle.test.ts: the full local → hybrid (live() within dev) → live → local cycle against the real cloud, asserting replacement identities, no-churn for the already-live resource across promotion, and the previously-untested demotion leg (live → local with real cloud deletions). - ProviderModePolicy becomes a tri-state Context.Reference (undefined | true | false, default undefined), collapsing the serviceOption/Option juggling at its consumers while preserving the unset vs explicit distinction that conflict detection relies on. Co-authored-by: Cursor <cursoragent@cursor.com>
Review feedback from #963 (john-royal): replace the hand-rolled ephemeral-workerd gateways with the runtime's platform proxy (cloudflare-tools#88, extracted from #74). - D1: withLocalD1Query opens a proxy hosting a raw `d1` service binding and POSTs the full D1 HTTP protocol through the proxy's fetch passthrough — multi-statement migrations/imports keep working, minus the bespoke gateway worker. - KV/R2: the REST-API emulation gateways are gone entirely. For `dev:` ids the *Local layers now build the same native-binding clients the *Binding variants use (makeReadKVClient / makeRead / …) over per-operation proxied bindings; real ids keep the HTTP clients. A shared dispatchByMode builds the per-call dispatching client from the lazily-resolved id. R2 rich objects (R2ObjectBody bodies, metadata, writeHttpMetadata) ride the proxy's new "r2-object" encoding. - LocalGateway.ts shrinks to the shared runtime layer, gatewayName, and dispatchByMode; the REST-emulation scaffolding (withLocalGateway, rebaseHttpClient) is deleted. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…r-aggregating destroy Ports into the LocalProvider.make structure: - make-before-break serveWith (workerd scopes fork from rootScope, closed on cutover / closeWorkerd) from #863 - url/urls/domain Attributes + resolveLocalUrls wildcard-host handling from #977 (local urls no longer carry a trailing slash; tests updated to `${url}/path`) - ALCHEMY_WORKER_NAME env (#860), viteMain root-relative resolution (#796), toRuntimeBinding dev.remote param for send_email (#865) distilled bumped to main (0.30.2). Co-authored-by: Cursor <cursoragent@cursor.com>
"remote" matches the ecosystem vocabulary for dev-time real-cloud bindings (wrangler's remote bindings, cloudflare-runtime's *.remote constructors, the send_email dev.remote prop). The persisted ProviderMode enum stays "live" | "local" — only the user-facing decorator is renamed. Co-authored-by: Cursor <cursoragent@cursor.com>
Brings in 94 commits from main (local vs live provider modes #963, workersDev/domain props #977, Worker.URL self-binding #964, assets-only Workers #969, Prisma provider #416, version affinity #985, telemetry #860) while preserving this branch's SourceProvider architecture and Website framework integrations. - Worker providers take main's side wholesale; the SourceProvider integration is re-grafted as a dispatch: `props.source` routes through `resolveSource`/`loadSource` (build, hash slots, and local dev in both server and bundle modes via the make-before-break serve path), while script/vite/python/prebuilt/assets-only workers keep main's paths. - Apply.ts: both sides landed the resolved-bindings persistence fix (#874 / ef08f4c); merged as the union, keeping `providerMode` and `bindings` on replaced-state commits. - test Utils/Http.ts: keep main's generalized retryResponse machinery (expectUrlRedirect/expectUrlHeader) and re-add expectDirectStatus on top of it. - Website tests track main's API: `url`/`subdomain` props fold into `workersDev`; dev-mode R2 cleanup skips virtual `dev:` buckets. - cloudflare-tools submodule bumped to this branch's merge of its own upstream main (59c3861); distilled synced to main's pointer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…lt emulation (#963) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Responding to review: replace the providers({ dev }) override option with
the ProviderLayer.dual registration introduced in alchemy-run#963, matching the
Cloudflare providers.
Each Prisma resource module now exports its Provider() factory as a dual
layer: live = the Management API implementation, local = the dev stub
(Prisma.Database keeps its @prisma/dev-backed local implementation, Compute
keeps ComputeDevProvider as its local variant). The engine resolves the
variant per run and per resource, so alchemy dev picks local automatically
and Alchemy.remote() opts individual resources back into live.
- remove providers({ dev }), PrismaLocalProviders, and liveProviders();
embedders replacing implementations construct their own layer from the
exported per-resource Provider() factories, the Providers collection, and
managementApi()
- move the dev stub helpers to Prisma/Internal/DevStub.ts and each stub
into its resource module as the dual's local thunk
- providers() now always carries the (lazy) stack management-api layer; it
registers auth without resolving credentials, so dev needs no token
- tests: provide AlchemyContext where provider layers are built directly,
assert dual mode metadata, drop the dev-override test
Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Resolves conflicts between the dashboard work (deployment journal in apply, --ui deploy flow, delete-node pending reporting) and main's Plan.destroy + aggregated destroy failures (alchemy-run#973), destroy stack-state cleanup (alchemy-run#965), and local/live provider modes (alchemy-run#963): - apply: keep the journal exit-mapping; run state.deleteStack after the deployment journal closes on a successful destroy - collectGarbage: adopt main's outcome-based blocked/failed delete aggregation, keep the pending status report for queued deletions - deploy/destroy/test harness: Plan.destroy + apply command option - Cloudflare Workers ui: domains attr became singular domain
Make provider mode (local vs live) a first-class engine concept: the mode that reconciled a resource is persisted in state, switching modes plans a replacement, and every delete resolves the provider variant of the mode that created the row — so
alchemy deployright afteralchemy devcleanly replaces local instances instead of updating over them (and vice versa). On top of that engine, this PR brings the Cloudflare dev experience to parity: KV/R2/D1/Queues are emulated locally,Alchemy.remote()opts individual resources onto real Cloudflare — including queues, in both directions — and the Node-side capability clients reach the same local simulators the workers see.Mode resolution
providerMode: "live" | "local"; a mismatch with the resolved mode forces a replace (the provider diff is not consulted — diffing props across runtimes is meaningless)alchemy dev→ local,alchemy deploy→ live); the one user knob isAlchemy.remote()— "run this live even in dev", captured at registration likeadopt()(a no-op during deploy):ConflictingProviderModeErrorProviderLayer.dual(replacesselect)Registers both variants: the run-default eagerly, the other lazily (memoized via
Layer.fromBuildMemoagainst the build's MemoMap), so a live deploy only constructs workerd machinery when a local-mode row actually needs deleting.deleteOldGenerations, GC chain draining, orphan deletes,sync,tail, andlogsall resolve by the row's stamped mode.LocalProvider— standard long-running local providersGenerates
diff/reconcile/delete/listfrom the instance registry (per-id lock, config-hash comparison, instanceId-guarded delete for replacement safety,invalidatefor self-dying processes) and wrapsRpcProviderso the registry lives in the dev sidecar across user-code reloads.Command.DevandLocalWorkerProviderare rewritten on it.Local emulation for KV, R2, D1 (and inline-script workers)
Namespace,Bucket, andDatabaseare nowProviderLayer.dual: in dev they fabricatedev:-prefixed ids with no cloud calls, and the worker's bindings lower onto the local workerd simulators. The providers carry no promotion logic — mode transitions are engine-orchestrated replacements (a live provider never sees adev:id). D1 appliesmigrationsDirandimportFilesagainst the local simulator through the platform proxy (multi-statement SQL over the rawd1service). Workers defined with inlinescript:(nomain) bypass the bundler and serve/restart on script change; assets-only Workers serve locally through an ASSETS-delegating stub; newdev: { cache, cf }props control the local Cache API andrequest.cfblob.Node-side capability clients reach the local simulators
The
*LocalKV/R2 capability layers (andQueryDatabaseLocal) previously spoke only the cloud REST API. Fordev:resources they now drive the local simulators through the runtime's platform proxy (cloudflare-tools#88,getPlatformProxyextracted from cloudflare-tools#74): the*Locallayers reuse the same native-binding client builders the*Bindingvariants use, over per-operation proxied bindings — real ids keep the HTTP clients, dispatched per call from the lazily-resolved id. R2 rich objects (R2ObjectBodybodies, metadata) ride the proxy'sr2-objectencoding:Shared scaffolding in
Cloudflare/LocalGateway.ts(localGatewayRuntime+ the per-call mode dispatcher).Alchemy.remote()queues work from local dev — both directionsCloudflare's preview/remote-binding sessions reject queue bindings at the platform level (cloudflare/workers-sdk#9929), so:
Alchemy.Randombearer token) as ordinary engine-managed resources — the same idiom asAccountApiToken. The local binding relays workerd's queue wire protocol to the shim over HTTPS; the shim decodes it back intosend()/sendBatch()on its real queue binding. Output-based ordering, stable-name updates, deletion on destroy, and orphan GC on promotion all come from the engine. v8-serialized messages are rejected with guidance to pass an explicitcontentType.http_pullconsumer to the real queue, and the runtime's pull loop drains it into the local broker, which delivers to the localqueue()handler with the usual local batching/retry/DLQ semantics.The e2e test round-trips a message: produced through the binding, observed in the REAL queue, received by the local handler.
Also in this PR
Alchemy.remote()(matching wrangler's "remote bindings" vocabulary; the persisted mode enum stays"live" | "local")alchemy-testrunner: a timed-out test's hanging teardown no longer stalls the run — the body is interrupted with a bounded 10s grace period and abandoned (with a clear report) if it doesn't settle.local.test.tsconvention for dev-mode suites, plusModeCycle.test.ts: the full local → hybrid (remote()within dev) → live → local cycle against the real cloud, including the demotion leg (live → local with real cloud deletions)ProviderModePolicyis a tri-stateContext.Reference(unset /remote()/remote(false)), simplifying its consumers while keeping conflict detectionDurableObjectNamespacelive tests run concurrently (~450s → ~80s)Tests
23 plan/apply mode tests plus
LocalProvider.makelifecycle unit tests. The 8 dev-mode suites (KV/R2/D1/Queues/CacheCf/Script/AssetsOnly/ModeCycle, 19 tests incl.Alchemy.remote()and Action-gateway coverage) run green repeatedly with retries disabled; companioncloudflare-runtimesuite green (267 tests).