Skip to content

fix(wb): migrate local D1 with the selected mechanism everywhere and allow isolated instances - #1696

Merged
exKAZUu merged 46 commits into
mainfrom
fix/wb-local-d1-migrations
Nov 26, 2026
Merged

exKAZUu merged 46 commits into
mainfrom
fix/wb-local-d1-migrations

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Close #1688
Close #1691

Why

Converting Workers from wrangler to the cf CLI hit three gaps in wb:

  1. wb db deploy|migrate|reset chose the migration tool from the ORM dependency alone. A Drizzle package whose D1 binding cf migrates (wb.d1Migrations) therefore ran drizzle-kit migrate on the same local D1, applying the SQL a second time under another journal (fix(wb): make wb db follow the cf-native D1 migration mechanism #1688). A package without an ORM could not use wb db at all.
  2. A development start (wb start, --mode dev) and the *-dev e2e modes applied only cf-native migrations, so a drizzle-kit Worker served no such table on fresh state (fix(wb): apply the selected D1 migration mechanism on every local launch #1691).
  3. The local state directory was fixed per mode, so a test helper could neither start several isolated Workers at once (each on its own port and fresh state, read back with cf d1 raw --persist-to) nor migrate a local D1 into a directory it chose without starting a server. A test-mode start also wiped the mode's directory, which would destroy the state of any other instance of that mode.

Requirements

  • required: wb must apply the migration mechanism it selects (selectD1Migrations) in wb db and on every local launch.
  • required: wbfy must not generate a script that runs the mechanism wb did not select.
  • required: a caller can choose the local state directory and migrate a local D1 without starting a server.
  • required: concurrent instances with distinct state directories must not wipe or overwrite each other's files.
  • required: development starts must not wipe local state; only the modes that already reset it do.
  • chosen: the caller chooses the directory by exporting an absolute WB_CLOUDFLARE_STATE_DIR, the variable wb already hands to Vite, rather than a new CLI option. It is one name for one concept, nested commands inherit it, and wb db already takes its mode from the environment.
  • chosen: the chosen path is limited to letters, digits and _.@+-/ and resolved lexically. wb embeds it in shell scripts that it also normalizes, and a mangled path could make a reset delete another directory.
  • chosen: wb never wipes or seeds a caller-chosen directory on start, and never writes .dev.vars.<mode> for such an instance. The directory belongs to the caller, and concurrent instances must not write shared files.
  • chosen: wbfy keeps generating db-migrate (wb db migrate --check-idempotency), because that command now runs the selected mechanism.

Customer Summary

  • wb db migrate, deploy and reset apply cf-native D1 migrations with cf d1 migrations apply --local when wb selects them, also in packages without an ORM. They run drizzle-kit only for a D1 that drizzle-kit migrates, or for a database other than D1. migrate and reset run the seed of a Drizzle package whose config targets that D1.

  • Every local launch, including the development start and the *-dev e2e modes, applies drizzle-kit D1 migrations. A development start does not run the seed; production-style starts and the test startup check do, as before.

  • To run an isolated instance or to migrate a local D1 into a directory you choose, export an absolute WB_CLOUDFLARE_STATE_DIR (plus a PORT):

    WB_CLOUDFLARE_STATE_DIR=/tmp/instance-1 WB_ENV=test PORT=20001 bun wb start --mode test -- --inspector-port 20002
    WB_CLOUDFLARE_STATE_DIR=/tmp/instance-1 WB_ENV=test bun wb db migrate
    • wb does not wipe, seed or publish such an instance.
    • It does not write .dev.vars.<mode>: the server reads the mode's file when a regular start generated it, and its own environment otherwise.
    • wb db stops when one chosen directory would serve several packages.

Technical Summary

  1. src/scripts/localD1Scripts.ts holds three builders:

    • selectLocalD1Migrations: the selection.
    • buildLocalD1MigrationCommands: the start-time migration, either cf-native apply or drizzle-kit migrate/deploy wrapped with the local D1 URL, with a seeds flag.
    • buildCfNativeD1DatabaseCommands: the cf-native commands of wb db. A reset refuses to run while another binding has no migration mechanism, and the seed is refused when there are several cf-native bindings.

    buildCloudflareDevCommands, buildCloudflareBuiltStartCommands and the custom-start branches of startProductionProtected all call the start-time builder.

  2. Seeding. ScriptArgv.seedsLocalD1 carries the intent to seed. The built start and the test startup check set it; development and *-dev starts do not.

  3. BaseScripts.buildMigrationCommands no longer migrates a drizzle-kit D1 (the Worker commands do). drizzleScripts.migrateForStart lost its D1 branch, which nothing reaches any more. drizzleScripts.reset takes its D1 branch only when the drizzle config targets D1.

  4. commands/prisma.ts buildMigrationScript runs the ORM command first, then the cf-native commands. It skips drizzle-kit when its config targets a D1 that cf migrates or when there is no drizzle config. It gives drizzle-kit the local D1 URL only when its config targets D1.

  5. wrapWithLocalD1DatabaseUrl:

    • It runs in a subshell, so its environment changes don't reach the server.
    • It unsets CLOUDFLARE_D1_DATABASE_ID, which wb sets only for remote drizzle-kit migrations, so a local command cannot reach a remote D1.
    • It excludes only miniflare's metadata.sqlite by basename.
  6. getLocalStateDir(project, mode) returns the validated WB_CLOUDFLARE_STATE_DIR when it is set. With a chosen directory, wb skips the test wipe, the seed, the URL publication (publishLocalServerUrl) and the .dev.vars.<mode> generation. wb gen-dev-vars now rewrites that file atomically and only when its content changes.

What to check hardest: the secret path of an isolated instance.

  • When no .dev.vars.<mode> (or leftover .dev.vars) exists, the runtime reads the declared secrets from the process environment.
  • Wrangler then also lets an exported variable replace a text or JSON binding of the same name, which the README states.
  • A design that dropped the file for every start was tried and reverted, because Wrangler then overrides such bindings for all Workers.

Testing

  • bun run verify passes. CI passed on each recent reviewed head.
  • Two tests added to cloudflareWorker.test.ts; both fail against main:
    • Two concurrent wb start --mode test instances, each with its own chosen directory, port and arguments after --, each serve their own migrated D1. A file in .cloudflare/state-test survives.
    • wb db migrate on a Drizzle package whose D1 is cf-native migrates the chosen directory with cf. drizzle-kit is not installed there, so running it would fail the test.
  • Manual checks in a throwaway Worker with drizzle-kit 0.31:
    • Dry runs and real starts on fresh state serve the drizzle tables.
    • wb db migrate|reset|deploy run the expected commands for drizzle-kit, cf-native and ORM-free packages.
    • A chosen directory with WB_ENV=development MISE_ENV=test uses the test mode.
    • Monorepo-root guards and path validation work as described.
  • Not exercised:
    • A real Vite-bundled Worker with a chosen directory. It receives the directory through WB_CLOUDFLARE_STATE_DIR as before; the Vite plugin's secret fallback was checked in its source.
    • Prisma packages with a D1 binding, which no repository has.

Notes

  • Concurrent wb start --mode test instances are documented as Wrangler-only, because a Vite-bundled Worker's --mode test start builds into the package's shared Build Output.
  • A config that derives a binding from an exported variable of the same name cannot be served exactly by an isolated Wrangler instance without .dev.vars.<mode>, because Wrangler overlays the raw variable. No WillBooster config does this.

…allow isolated instances

wb db deploy/migrate/reset now apply cf-native D1 migrations instead of
drizzle-kit when selectD1Migrations selects them, also for packages without
an ORM. Every local launch, including the development start and the *-dev
e2e modes, applies drizzle-kit D1 migrations too. An exported absolute
WB_CLOUDFLARE_STATE_DIR replaces the mode's state directory for wb start and
wb db; wb never wipes it nor publishes that server's URL, and gen-dev-vars
rewrites .dev.vars.<mode> only atomically and only when it changes, so
concurrent instances do not disturb each other.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu

exKAZUu commented Nov 26, 2026 •

Copy link
Copy Markdown
Member Author

ReviewFixLoop run summary

Run 2da421f66d75-2 ended completed at 4896db18f13d.

Run page: https://reviewfixloop.com/runs/2da421f66d75-2

Fixed (44)

  • r1 major packages/wb/src/commands/genDevVars.ts:50 Isolate secrets files for concurrent instances
    • Fix (7d9636b03a1a): the counter-evidence (two instances both finding no .dev.vars.<mode> and replacing each other with atomic renames) held against the existence check; an instance on a chosen directory now publishes the file with a hard link that fails with EEXIST when another instance published first, then requires equal values, so it can neither replace an existing file nor race a concurrent creator. Re-run: three rounds of two concurrent gen-dev-vars processes (TOKEN=a and TOKEN=b, absent file) each left one winner and one failure, the file holding the winner's value.
  • r3 major packages/wb/src/utils/cloudflare.ts:40 Shell-escape the chosen state directory
    • Fix (319f215ee268): wb embeds the caller-chosen WB_CLOUDFLARE_STATE_DIR into shell scripts (double-quoted persist-to, rm -Rf, ls) that normalizeScript also rewrites, so any metacharacter or repeated space changed the directory; getChosenLocalStateDir now accepts only absolute paths of [A-Za-z0-9_./@+-], so no chosen path can be altered at any interpolation site. Re-run: WB_CLOUDFLARE_STATE_DIR=/tmp/staging$2, /tmp/a"b and "/tmp/a b" with wb db migrate each fail with the new message before any command runs; a plain absolute path still migrates.
  • r5 minor packages/wb/test/unit/cloudflareWorker.test.ts:73 Verify that concurrent Workers use separate D1 state
    • Fix (760855a74d69): the concurrent-instance test asserted only per-instance --var values and the sentinel, which two servers sharing one directory would also satisfy; it now asserts that each chosen directory holds its own migrated D1 (v3/d1/miniflare-D1DatabaseObject), which fails if both instances used one directory or the default. Re-run: cloudflareWorker.test.ts passes (5 pass).
  • r7 major packages/wb/src/commands/prisma.ts:412 An unrelated Drizzle database can block cf-native D1 migration
    • Fix (813107e32832): buildMigrationScript passed every Drizzle command through withLocalD1IfNeeded, which wraps whenever any D1 binding exists, and drizzleScripts.reset took its D1 branch on the same test; both now key on usesDrizzleKitForD1, so a Drizzle config for another database runs drizzle-kit with its own DATABASE_URL in deploy/migrate/reset while the cf-native D1 is applied after it, matching the start commands. Re-run of the mixed configuration (postgresql drizzle config plus cf-native D1) with wb db migrate/deploy --dry-run: drizzle-kit migrate runs without the D1 URL export, followed by cf d1 migration…
  • r8 major packages/wb/src/utils/cloudflare.ts:71 Drizzle cannot find D1 in a state path containing metadata
    • Fix (11c8fb1a856b): wrapWithLocalD1DatabaseUrl filtered the ls output with grep -v metadata over the whole absolute path, so any state directory path containing 'metadata' dropped the real database too; it now excludes only lines ending in /metadata.sqlite, so the path above the file no longer matters. Re-run: wb db migrate with WB_CLOUDFLARE_STATE_DIR=/tmp/rfl-metadata-case exported DATABASE_URL=file:/tmp/rfl-metadata-case/v3/d1/miniflare-D1DatabaseObject/<hash>.sqlite to the seed.
  • r9 major packages/wb/src/commands/genDevVars.ts:51 Isolated instances starting on an absent .dev.vars.<mode> still overwrite each other's values
    • Fix (b80d7c59fcac): the r1 guard checked existence and then wrote with an atomic rename, which replaces a file another instance created in between; an instance on a chosen directory now writes a temp file and hard-links it into place, which fails with EEXIST when another instance published first, and only then compares values and stops when they differ, so no isolated instance can replace another's file whether it existed or not. Re-run: three rounds of two concurrent gen-dev-vars processes on an absent .dev.vars.test with TOKEN=a and TOKEN=b each left exactly one winner (exit 0) and one failure (exit 1), the fi…
  • r12 major packages/wb/src/commands/genDevVars.ts:56 The suggested --var retry still fails secret generation
    • Fix (7d9636b03a1a): the r1 error text and docs told callers to fix a mismatch with --var, which reaches only the server while gen-dev-vars compares environment values first; the message, README and rules doc now say to give every instance the same environment values of the declared secrets and pass an instance's own value to its server with --var after --, which is the path that lets startup complete. Re-run: gen-dev-vars with matching TOKEN values under two chosen directories succeeds and the server receives --var overrides (cloudflareWorker.test.ts concurrent case, 5 pass).
  • r17 major packages/wb/README.md:171 The documented per-instance --var override is invalid for Vite Workers
    • Fix (e92c941da679): the r12 wording offered --var to every isolated instance, but only cf dev (Wrangler) accepts it and Vite rejects the option; the README, the rules doc, and the gen-dev-vars error now scope --var to a Wrangler-bundled Worker and say Vite has no such option, matching the rules doc that limits concurrent --mode test instances to Wrangler-bundled Workers. Re-run: the three texts now name the Wrangler scope; verify passes.
  • r18 minor packages/wb/README.md:169 The README incorrectly says unit test runs wipe Worker state
    • Fix (11a4c4433fb6): the README attributed the test-state wipe to whole test runs; it now names wb start --mode test and the servers wb test starts, except in the *-dev e2e modes, which are the paths that call buildMigrationCommands. Re-run: the sentence matches baseScripts.ts testStart/startProductionProtected, the only callers of the wipe.
  • r19 major packages/wb/src/scripts/localD1Scripts.ts:42 The cf-native seed can receive a different D1 database from the one wb materialized
    • Fix (11a4c4433fb6): buildCfNativeD1DatabaseCommands wrapped the seed with wrapWithLocalD1DatabaseUrl, which picks the first hash-named SQLite file and cannot tell bindings apart, even when several cf-native bindings were applied; it now throws before any command runs when a seed would run for more than one cf-native binding, so the seed only ever receives the single D1 there is. Re-run: a fixture with DB and DB2 both cf-native and a seed script makes wb db migrate fail with the new message, while wb db deploy (no seed) still applies both.
  • r20 major packages/wb/src/commands/genDevVars.ts:75 The suggested per-instance secret override prints credentials in wb logs
    • Fix (cbc8b88b5fdf): the r12/r17 guidance routed a per-instance secret through --var, which lands in the start command wb prints; the gen-dev-vars error, README, and rules doc now only require every instance of a mode to get the same values of the declared secrets (or a regenerated file), and no longer suggest --var for a secret, so the documented path keeps secrets in .dev.vars. Re-run: grep finds no --var advice left in those three places; verify passes.
  • r24 major packages/wb/src/commands/genDevVars.ts:75 The shared-secrets recovery command can regenerate the wrong mode
    • Fix (62b0e7fe7a2c): the recovery command in the shared-file error omitted the mode, so without an exported WB_ENV it regenerated .dev.vars.development; the error now prints WB_ENV=<resolved mode> wb gen-dev-vars, the mode whose file conflicted. Re-run: with .dev.vars.test holding TOKEN=a, an isolated TOKEN=b generation fails naming WB_ENV=test; running that command and retrying the isolated generation succeeds.
  • r25 minor packages/wb/README.md:174 The isolated Worker example still gives Vite callers Wrangler-only flags
    • Fix (f8dd8665d612): the README example passed cf dev options under a sentence that also named Vite; it now says Vite takes neither of the example's cf dev options and introduces the example as starting Wrangler-bundled Workers, matching the rules doc that limits concurrent test instances to them. Re-run: README.md:171 reads with the Wrangler scope.
  • r26 major packages/wb/src/commands/genDevVars.ts:68 Protect the isolated launch's temporary secrets file
    • Fix (46e3e967257b): the r9 publisher always wrote a temp copy of the secrets with the default mode before linking; it now returns without writing when the shared file already holds the same values, and creates the temp file (which the hard link publishes) with mode 0600, so no secret copy is ever more readable than its owner. Re-run: under umask 022 a fresh isolated generation published .dev.vars.test as 0600, an identical retry wrote nothing, a differing one still failed, and no temp file remained.
  • r27 minor packages/wb/README.md:169 The state-wipe sentence still treats --mode test as sufficient
    • Fix (2909767bc5db): the sentence attributed the wipe to the --mode test flag, while it follows the effective mode (start.ts keeps an exported WB_ENV) and the default directory; it now says a start whose mode is test (wb start --mode test without another exported WB_ENV, and the servers wb test starts except in the *-dev e2e modes) wipes .cloudflare/state-test unless a state directory is chosen. Re-run: the wording matches buildMigrationCommands (mode === test, a Cloudflare config, no chosen directory) and the dry-run plans the finding observed.
  • r28 major packages/wb/src/commands/genDevVars.ts:78 The recovery command can still regenerate a different secrets file
    • Fix (ea1449cf1277): the recovery command existed only because isolated instances shared a generated .dev.vars.<mode>; the checkpoint rebuild (796f7684) removed wb gen-dev-vars and the generated file altogether, so each server reads its declared secrets from its own environment and no recovery command or output path remains to get wrong. Re-run: cloudflareWorker.test.ts passes with two concurrent instances each receiving its own exported AUTH_SECRET.
  • r29 minor packages/wb/README.md:169 The wipe documentation still conflates Worker mode and startup path
    • Fix (ea1449cf1277): the sentence still tied the wipe to the --mode flag; it now states both conditions buildMigrationCommands checks: a start that migrates before serving (wb start --mode test|staging and the wb test servers except *-dev) and a Worker mode resolving to test from WB_ENV or MISE_ENV, unless a state directory is chosen. Re-run: matches the finding's three dry runs (--mode dev: no rm; --mode staging with WB_ENV=test and --mode test with MISE_ENV=test: rm).
  • r31 major packages/wb/src/scripts/execution/cloudflareCommands.ts:54 An inherited environment value can override a configured Worker text binding
    • Fix (465f950f7e61): the counter-evidence held: WB_ENV=development with MISE_ENV=test resolves the mode to test while the exported WB_ENV overrode the WB_ENV text binding, because the runtime lets the process environment override config values once secrets come from it. The start commands now set every text value of the evaluated config into the server environment (and remove JSON keys), so the environment can only repeat the config, while declared secrets still come from it. Re-run of the counter-evidence: WB_ENV=development MISE_ENV=test wb start --mode test with a chosen directory now returns wbEnv=test and th…
  • r32 major packages/wb/src/scripts/execution/cloudflareCommands.ts:82 A Worker text binding can replace the caller’s listen port
    • Fix (aca50a9a6787): the r31 repair wrote the config's text values into project.env, which wb itself reads afterwards for PORT, the state directory and migrations; the values now go only to the server command as an env prefix (assignments for exported keys whose value differs, -u for JSON keys), and project.env is untouched, so no binding can change what wb resolves. Re-run of the finding: PORT=28444 with a text binding PORT=20066 and WB_ENV=development MISE_ENV=test listens on 28444 and the Worker returns port=20066, wbEnv=test and its exported TOKEN; cloudflareWorker.test.ts passes.
  • r33 major packages/wb/src/scripts/execution/cloudflareCommands.ts:89 Configured text bindings lose significant whitespace during launch
    • Fix (488eba6ffad4): the r32 repair put config values into the script text, which normalizeScript rewrites (newlines, repeated spaces); the server now runs under env -u for each exported key whose value differs from the config, so no value enters the script and the runtime uses the config's bytes. Re-run: a text binding hello\\nworld x with MULTI=shell exported (plus differing WB_ENV and PORT) returns multi exactly as configured, port 20066 from the config, wbEnv=test and the exported TOKEN, while wb still listens on the exported PORT.
  • r34 major packages/wb/src/scripts/execution/cloudflareCommands.ts:85 Removing colliding environment keys changes the config the runtime evaluates
    • Fix (130e58c11003): the r33 repair unset differing keys, so a config deriving a binding from that key re-evaluated to its fallback; the server now receives the config's own evaluated value for each differing key (a fixed point for configs that normalize the input), passed as KEY="$WB_CLOUDFLARE_VAR_KEY" from a variable wb sets, so normalizeScript never sees the value and wb's own PORT stays. Re-run: URL=http://x.example/ with a config trimming the slash returns url=http://x.example, a multiline/double-space text binding stays exact, PORT binding 20066 while wb listens on 28444, wbEnv=test, exported TOKEN kept.
  • r35 major packages/wb/src/commands/prisma.ts:406 A runtime-only Drizzle dependency blocks selected cf-native D1 migrations
    • Fix (e2e516c5dff9): the r7 gate treated a Drizzle package without a drizzle config like one whose config targets another database, so drizzle-kit ran (and failed) before the cf-native apply; beside cf-native D1 migrations Drizzle now runs only when a drizzle config exists and does not target D1, matching the start path. Re-run: a package with drizzle-orm, flat cf-native migrations and no drizzle config makes wb db migrate run only cf d1 migrations apply.
  • r36 major packages/wb/src/scripts/execution/baseScripts.ts:143 Custom Worker starts wipe test D1 state and then serve without migrations
    • Fix (6d3ad42ce2ba): moving the drizzle-kit D1 migration into the Worker start commands left the custom-start branches of startProductionProtected (scripts/start-production.sh, ecosystem.config.cjs), which bypass those commands, without it; both branches now prepend the same buildLocalD1MigrationCommands for a package with cloudflare.config.ts, so every launch path applies the selected mechanism once. Re-run: wb start --mode test --dry-run in a drizzle-kit D1 Worker with scripts/start-production.sh prints the state-test wipe, the D1 materialization and drizzle-kit migrate before the custom script.
  • r37 major packages/wb/src/scripts/execution/cloudflareCommands.ts:88 Binding overrides still change the inputs cf uses to evaluate the Worker config
    • Fix (087a24727a6a): the counter-evidence held for Vite: the Cloudflare Vite plugin (miniflare resolveLocalBindings) takes only declared secrets from the environment, so replacing an exported key with the evaluated binding there only fed the config a transformed input (https://caller.example/v1/v1). The replacement now applies only to cf dev, whose Wrangler getVarsForDev does override config values with the environment; Vite dev and preview get the exported environment unchanged. For Wrangler a config that transforms a same-named input cannot be served exactly either way, because Wrangler itself replaces that bin…
  • r38 critical packages/wb/src/scripts/localD1Scripts.ts:20 Development starts run seed scripts against existing local D1 data
    • Fix (029f65b0e01a): buildLocalD1MigrationCommands ran drizzleScripts.migrate (migration plus seed) on every launch, so the new development-start migration also ran a seed that may delete rows; it now takes seeds, which only production-style starts (built start, Wrangler production path, custom start) pass, and development, *-dev and startup-check starts run drizzle-kit migrate alone. Re-run: wb start --dry-run prints drizzle-kit migrate without the seed, while wb start --mode test still prints drizzle-kit migrate && bun run seed.
  • r39 major packages/wb/src/scripts/execution/cloudflareCommands.ts:62 An isolated test start can delete data from the caller’s prepared D1
    • Fix (65e05fb53a22): the r38 repair tied seeding to the launcher alone, so a production-style start on a caller-chosen directory still ran the seed over the caller's data; buildLocalD1MigrationCommands now seeds only when no state directory is chosen (the caller seeds its own with wb db migrate, as the README now says), for every launcher including the Vite preview. Re-run: wb start --mode test --dry-run with WB_CLOUDFLARE_STATE_DIR prints drizzle-kit migrate without the seed, and without it still prints the seed.
  • r40 major packages/wb/src/scripts/execution/cloudflareCommands.ts:91 Wrangler startup drops exported inputs needed by the Worker config
    • Fix (9916a98492ee): the Wrangler prefix replaced or removed exported keys named like bindings, which are also the inputs cf dev evaluates the config with (FEATURES removed made JSON.parse fail); the prefix is gone, so cf dev evaluates the config with the exported environment exactly as Wrangler run alone does, and only WB_ENV is set to the resolved mode (the realistic r31 case: WB_ENV=development with MISE_ENV=test). The README states that Wrangler lets an exported variable replace a same-named binding. Re-run: with WB_ENV=development MISE_ENV=test, the Worker returns wbEnv=test, the exported TOKEN, and the expo…
  • r41 major packages/wb/src/scripts/execution/cloudflareCommands.ts:55 Wrangler startup replaces evaluated bindings with raw environment strings
    • Fix (2b6376787de7): without a .dev.vars file Wrangler overlays every exported variable named like a config value (including NEXT_PUBLIC_BASE_URL, which wb exports), so dropping the file regressed every Wrangler Worker; regular starts generate .dev.vars.<mode> again (atomically, only when it changes), which Wrangler and the Vite plugin read instead of the process environment, so config text/JSON bindings stay as evaluated. Only an instance on a caller-chosen state directory skips the generation (never writing the shared file) and reads that file when present or its own environment otherwise, as the README and rul…
  • r42 major packages/wb/src/scripts/execution/cloudflareCommands.ts:55 Normalizing WB_ENV only for the server can select an unmigrated D1
    • Fix (ba7cc4bbaca9): the r40 repair set WB_ENV only on cf dev, so under WB_ENV=development MISE_ENV=test the config was evaluated with different inputs for migration and for serving and could bind another D1; the prefix is removed, so migration, materialization and cf dev evaluate the config with the same environment and the same --mode, as on base. Regular starts read declared secrets from .dev.vars.<mode>, so no exported WB_ENV overlays the binding there; for an isolated instance without that file, the README and rules doc state that Wrangler lets an exported variable replace a same-named binding. Re-run: cf de…
  • r44 major packages/wb/src/scripts/execution/baseScripts.ts:147 Preserve the Drizzle D1 seed in the CI startup phase
    • Fix (cdff48212666): the r38 repair limited seeding to production-style starts, but the test startup check (testStart, which prepares disposable test data) launches through startDevProtected and lost the seed it had on base; the seed intent now travels as ScriptArgv.seedsLocalD1, which testStart sets in the test environment and the built start sets, while plain development and *-dev starts leave it unset. Re-run: wb test-on-ci --dry-run in a drizzle-kit D1 Worker with a seed prints drizzle-kit migrate && bun run seed in both the startup and e2e phases, and wb start (development) still prints migrate alone.
  • r45 major packages/wb/src/scripts/execution/cloudflareCommands.ts:85 Account for legacy .dev.vars on isolated starts
    • Fix (463e869563e3): the docs and the launcher comment omitted that the runtime reads an unsuffixed .dev.vars after .dev.vars.<mode> and before the environment; the README, the rules doc (which already lists .dev.vars as generated and never hand-written) and the comment now state that order and tell a converted package to delete a leftover .dev.vars. Re-run: the finding's behavior (legacy .dev.vars value served) is now the documented precedence.
  • r46 critical packages/wb/src/scripts/localD1Scripts.ts:28 Keep development migrations off remote D1
    • Fix (11fc1f6bed43): wb routes drizzle-kit to a remote D1 only by setting CLOUDFLARE_D1_DATABASE_ID (deploy.ts applyD1Migrations), the variable a D1 drizzle config uses to pick d1-http; wrapWithLocalD1DatabaseUrl, which every local drizzle-kit and seed command goes through (start, wb db), now unsets it before exporting the local DATABASE_URL, and the rules doc states that a D1 drizzle config uses d1-http only while that variable is set. A config hard-coding remote credentials already ran on base test starts and is excluded by that rule. Re-run: wb start --dry-run with CLOUDFLARE_D1_DATABASE_ID exported prints uns…
  • r47 major packages/wb/src/scripts/localD1Scripts.ts:55 Preserve unmanaged local D1 data during reset
    • Fix (a5b554feb5a9): the cf-native reset removes the whole v3/d1 subtree but rebuilds only the bindings wb migrates; it now throws before any command when the mode has D1 bindings without a migration mechanism, naming them, so a reset can only delete databases it rebuilds. Re-run: a package with a cf-native DB and an unmanaged OTHER binding makes wb db reset fail with the message, while wb db migrate still applies DB.
  • r48 major packages/wb/src/utils/cloudflare.ts:74 Scope local Drizzle environment changes to the migration
    • Fix (6b1d3361ab15): wrapWithLocalD1DatabaseUrl unset CLOUDFLARE_D1_DATABASE_ID and exported DATABASE_URL in the shell that later starts cf dev or Vite, so a config reading either saw different values at launch than when wb selected and migrated the D1; the wrapper now runs as a subshell, so its changes end with the migration and seed. Re-run: a fresh development start serves __drizzle_migrations and items, wb db reset reseeds through the wrapper, and the relevant unit tests pass.
  • r49 major packages/wb/src/commands/prisma.ts:262 Reject a chosen D1 directory shared by workspace resets
    • Fix (3c0e03b64ddd): one exported WB_CLOUDFLARE_STATE_DIR reached every workspace of a monorepo-root wb db or wb start, so their resets removed each other's D1 subtree; wb db (all subcommands, via findDatabaseProjects) and wb start (over Cloudflare packages) now stop before any command when a chosen directory would serve more than one package, and the README says so. Re-run: a two-Worker monorepo root wb db reset with WB_CLOUDFLARE_STATE_DIR fails naming both packages, while the same command inside one package still runs.
  • r50 major packages/wb/src/commands/prisma.ts:599 Keep Litestream config generation independent of the runtime environment
    • Fix (27d902d369b8): the r49 guard read project.env of every project of every wb db subcommand, loading fnox even for secret-less create-litestream-config; it now runs only for deploy/migrate/reset (the commands that migrate or reset local D1) and only over packages with cloudflare.config.ts, so other subcommands and non-Worker packages never resolve their environment for it. Re-run: litestreamConfig and prisma unit tests pass; a two-Worker root reset with a chosen directory still stops.
  • r51 major packages/wb/src/commands/start.ts:41 Set the start mode before reading workspace environments
    • Fix (0ad006739e4e): the r49 guard in wb start read (and cached) every Worker project's environment before the handler sets WB_ENV for the chosen mode; it is removed from wb start (a start never resets or wipes a chosen directory, so several Workers sharing one only keep their own D1 ids apart), and remains in wb db deploy/migrate/reset, whose reset is the case that removed another package's state. start.ts is back to its base content. Re-run: wb start --mode test --dry-run resolves the test mode, wipe and state-test as on base.
  • r54 minor packages/wb/README.md:174 Pin the same Worker mode in both isolated-instance examples
    • Fix (0a0d271eec81): wb start --mode test sets WB_ENV only when it is unset, so the start example could resolve another mode than the companion migration example; the start example now also exports WB_ENV=test, so both select the same mode and D1 from any shell. Re-run: the README example lines both carry WB_ENV=test.
  • r55 minor packages/wb/src/scripts/localD1Scripts.ts:51 Give a usable recovery when a reset would remove an unmanaged D1
    • Fix (c9226b1cf289): the r47 refusal pointed to cf, which has no local reset; it now tells the caller to give the named bindings migration settings first or delete the state directory's v3/d1 themselves, both of which work. Re-run: the message text in localD1Scripts.ts names those two actions; verify passes.
  • r56 critical packages/wb/test/unit/cloudflareWorker.test.ts:36 Keep the regular-start test out of a caller's isolated state directory
    • Fix (057a59de3500): the fixture environment copied process.env, so an exported WB_CLOUDFLARE_STATE_DIR reached the regular-start test; workerEnv now drops it, and the concurrent test still sets it explicitly per instance. Re-run: WB_CLOUDFLARE_STATE_DIR=/tmp/rfl-outer bun wb test cloudflareWorker.test.ts passes (5 pass) and creates nothing under /tmp/rfl-outer.
  • r57 major packages/wb/src/scripts/localD1Scripts.ts:61 Resolve the chosen path consistently before deleting D1 state
    • Fix (77f898a3c0f6): wb passed the raw chosen path to rm, which follows a symlink before .., while cf resolves --persist-to lexically; getChosenLocalStateDir now returns path.resolve of the value, so every consumer (rm, cf --persist-to, the DATABASE_URL lookup, Vite) gets the same lexically resolved directory. Re-run: WB_CLOUDFLARE_STATE_DIR=/tmp/a/link/../inst wb db reset --dry-run prints rm -Rf "/tmp/a/inst/v3/d1", the directory cf migrates.
  • r58 major packages/wb/src/scripts/localD1Scripts.ts:51 Print the resolved D1 path in the manual-reset remedy
    • Fix (ad65c965ac42): the r55 remedy told the caller to delete "the state directory's v3/d1", leaving them to rebuild the path from a value wb resolves differently; the refusal now prints getAbsoluteLocalStateDir(project, mode)/v3/d1, the exact directory the reset and the migrations use (lexically resolved since r57). Re-run: verify passes; the message is built from the same resolver as the rm command.
  • r59 minor packages/wb/README.md:171 Supply the D1 database ID and SQL in the isolated-state inspection example
    • Fix (17986177151e): the README named cf d1 raw without its required database ID and query; it now shows cf d1 raw <D1 id> --mode test --local --persist-to <dir> --sql '<query>', the form wb itself uses to materialize a local D1. Re-run: the README line now carries every argument cf d1 raw --help requires.
  • r60 minor packages/wb/src/scripts/execution/cloudflareCommands.ts:74 Moving the drizzle-kit D1 migration here leaves vinextScripts' comment crediting buildProductionCommand false
    • Fix (4896db18f13d): the vinextScripts comment credited buildProductionCommand with drizzle migrations, which the D1 move made false for a drizzle-kit D1; the comment is deleted, since buildCloudflareBuiltStartCommands itself now shows the D1 migration it runs. Re-run: vinextScripts.ts holds no migration comment; verify passes.

Rejected (12)

  • r6 major packages/wb/src/commands/prisma.ts:265 Reset fails after selecting a valid D1 when test mode has no database
    • Reason: the premise needs a Worker whose code reads a D1 binding that its config drops in test mode; such a Worker cannot serve its own tests, and no WillBooster repository configures one, so the follow-up test pass always finds the package again. (Reason corrected: an earlier sentence compared with main inaccurately.)
  • r11 minor packages/wb/test/unit/cloudflareWorker.test.ts:86 Check the state the servers actually use
    • Reason: each test instance gets a fresh, never-migrated directory, so a server whose --persist-to diverged from the directory wb migrates would see an empty D1 and fail the tables assertion; the scenario needs both servers to share a third, already-migrated directory, which no code path produces.
  • r14 major packages/wb/src/utils/cloudflare.ts:147 Allow state directories under standard macOS paths
    • Reason: the restriction is the deliberate fix of r3/r4: wb embeds the path in shell scripts that normalizeScript rewrites, and a documented plain-path rule (README and rules doc) is simpler and safer than escaping every interpolation; callers of isolated instances create the directory themselves (e.g. under os.tmpdir(), which has no spaces on macOS or Linux), and the default mode directories are unaffected.
  • r15 major packages/wb/src/commands/prisma.ts:413 An independent PostgreSQL ORM prevents resetting a local cf-native D1
    • Reason: no worse than base: on main, wb db reset for a Drizzle package with a PostgreSQL config and a D1 binding ran drizzleScripts.reset, whose D1 branch (main drizzleScripts.ts:19-24, keyed on findLocalD1Database alone) removed the D1 and then ran drizzle-kit migrate for the PostgreSQL config against the local D1 URL, which fails, and never applied the cf-native migrations; Drizzle reset has never supported non-file databases. The head resets the D1 the selected mechanism migrates whenever the ORM part succeeds, and wb db migrate/deploy and every start migrate such a package correctly.
  • r16 major packages/wb/test/unit/cloudflareWorker.test.ts:294 Concurrent Worker test hands unreserved ports to a launcher that kills listeners
    • Reason: the test uses the repository's established pattern for giving wb an explicit PORT (maintenanceCommand.test.ts:87,151 takes a port from listen(0) and exports it the same way); an OS-assigned ephemeral port is not handed to a new listener in the milliseconds before wb starts unless something binds that exact number on purpose, and wb itself only kills a listener on an explicitly configured PORT, which is the contract the test exercises. No harm to the project's users or value follows.
  • r21 major packages/wb/src/utils/cloudflare.ts:71 A reused state directory can still send the seed to an old D1 database
    • Reason: no worse than base and outside the PR: main's wrapWithLocalD1DatabaseUrl (packages/wb/src/utils/cloudflare.ts:73 on main) already picks the first non-metadata SQLite file with ls | head -1, so a state directory that kept the file of a changed binding id sent drizzle-kit and the seed to the old file on main too, for the default directories as much as a chosen one; the PR changed only which metadata file is excluded. Changing a D1 id while keeping its local state is not a workflow any repository follows (ids are fixed placeholders in cloudflare.config.ts).
  • r22 major packages/wb/src/commands/genDevVars.ts:52 Protect isolated startup from a regular server's write
    • Reason: the documented rule (README and rules doc) is that every instance of a mode gets the same values of the declared secrets, and the regular server writes exactly the mode's values from fnox and the environment; under that rule its write is either skipped (unchanged content is never rewritten) or replaces the file with the values the isolated instance also has, so no instance receives another's credentials. Coordinating a regular start that deliberately exports different secrets would add a lock for a case the rule excludes, against the repository rule to prefer an operational rule over code.
  • r23 major packages/wb/src/commands/prisma.ts:405 An explicit Drizzle config can disagree with the D1 dispatch decision
    • Reason: the input is forwarding a different drizzle --config to wb db migrate/deploy in a package whose D1 cf migrates; no WillBooster package script or workflow forwards --config to wb db migrate or deploy (searched every checked-out WillBooster package.json), and wb deploy and wb start never forward one, so the classification by the package's own drizzle config is the one every real invocation uses. On main the same forwarded --config also ran drizzle-kit against the local D1 regardless of its target (prisma.ts withLocalD1IfNeeded), so the head is no worse.
  • r30 major packages/wb/src/scripts/execution/cloudflareCommands.ts:54 An inherited Wrangler loading switch drops every declared secret
    • Reason: the input is an exported CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV=false; no WillBooster repository, workflow, fnox.toml or wb command sets it (searched every checked-out WillBooster/WillBoosterLab repository; the current shared tree has no reference at all), and wb's rules keep environment values in fnox.toml, where a key that disables the runtime's secret loading would be visible in review. Adding an unset for a switch nobody exports adds a mechanism the repository rules tell us to omit.
  • r43 major packages/wb/src/scripts/execution/cloudflareCommands.ts:88 A regular start can replace an isolated test’s supplied secret
    • Reason: the behavior is the documented design (README and rules doc): an instance on a chosen state directory never writes .dev.vars.<mode> and reads the declared secrets from it when a regular start of the mode generated it, because without that file Wrangler replaces every config binding named like an exported variable (the regression r41 found). Per-instance secret values are not among the requirements, which ask for a per-instance port, fresh state directory and extra cf dev arguments; the mode's secrets come from its fnox profile, equal for every instance. The concurrent test no longer implies p…
  • r52 major packages/wb/src/scripts/localD1Scripts.ts:61 Preserve stored D1 data for bindings removed from config
    • Reason: a reset deletes the package's local D1 state by design, and main already removes the whole v3/d1 subtree on wb db reset (drizzleScripts.ts:24 on main, rm -Rf "<state dir>/v3/d1" for any Drizzle D1 package) without looking at which databases it holds; a database whose binding was removed from the config is no longer state of the package. The r47 guard covers what wb can know, the bindings the config still declares without a migration mechanism.
  • r53 major packages/wb/src/utils/cloudflare.ts:150 Preserve the chosen state path when normalizing commands
    • Reason: the input is a state directory whose path contains the segment dist/index.js; callers create these directories themselves (temp directories or a directory they name), and no one names a state directory like a build output file. normalizeScript rewrites every absolute path wb embeds the same way on main (e.g. the absolute local state path main exports as DATABASE_URL in wrapWithLocalD1DatabaseUrl, which contains the project path), so the head is no worse for such paths, and routing every path around normalization would be a new mechanism for a name nobody uses.

Where a human reviewer should look

  • No successful review session is recorded on the final revision.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the D1 database migration workflow in wb to resolve inconsistencies between development starts and database management commands. By centralizing the migration mechanism selection, it ensures that D1 bindings are migrated correctly regardless of the ORM used. Additionally, it adds support for isolated local development instances by enabling callers to define a custom state directory, which also prevents accidental data wiping during concurrent testing sessions.

Highlights

  • Unified D1 Migration Mechanism: Standardized the D1 migration selection process across all wb db commands and local startup paths to ensure consistency and prevent redundant SQL execution.
  • Isolated Local Instances: Introduced support for isolated local Workers by allowing callers to specify a custom state directory via the WB_CLOUDFLARE_STATE_DIR environment variable.
  • Improved File Atomicity: Implemented atomic file writing for .dev.vars generation to prevent race conditions during concurrent server startups.
  • Script Refactoring: Consolidated D1 migration logic into a new localD1Scripts.ts module to improve maintainability and simplify command building.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.


Migrations run in a steady stream, Local D1 now part of the dream. Isolated state, a directory choice, Giving the Workers a singular voice.

Footnotes

  1. Review the Generative AI Prohibited Use Policy, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for running isolated local Cloudflare Worker instances concurrently by allowing callers to specify a custom, absolute state directory via the WB_CLOUDFLARE_STATE_DIR environment variable. It refactors local D1 migration handling, ensures .dev.vars.<mode> is written atomically to prevent race conditions, and updates the documentation and tests accordingly. Feedback was provided to improve the findFreePort helper in tests to prevent potential port collisions and test flakiness by tracking allocated ports.

exKAZUu and others added 26 commits November 26, 2026 15:08
wb embeds WB_CLOUDFLARE_STATE_DIR in shell scripts, whose quoting and
normalization would turn a path with shell metacharacters or repeated spaces
into another directory, which a reset would then delete.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…dev vars

Instances of one mode share .dev.vars.<mode>, so an instance on a chosen
WB_CLOUDFLARE_STATE_DIR stops instead of replacing values another instance
wrote; per-instance values go through --var.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…rectory

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…fig targets D1

A Drizzle config for another database kept getting the local D1 URL from
wb db deploy/migrate/reset, and its reset removed the local D1; both now
follow whether the config targets D1, as the start commands do.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…local D1 URL

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Two instances on chosen state directories that both found no
.dev.vars.<mode> could still replace each other's values; such an instance
now publishes the file with a hard link, which fails when another instance
published first, and then requires equal values.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The --var argument reaches only the server, so the remedy is equal
environment values for every instance plus --var for an instance's own one.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The seed's database URL cannot tell D1 files apart, so wb db migrate|reset
stop before migrating instead of seeding an arbitrary one. The README also
names only the server starts that wipe the test state.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
… suggesting --var

Passing a secret through --var puts it in the command wb logs, so the
guidance now only requires every instance of a mode to get the same values.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…wner-readable

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
… environment

Isolated instances shared .dev.vars.<mode>, and every attempt to arbitrate
between its writers produced another defect. Both the Wrangler dev server
and the Cloudflare Vite plugin read declared secrets from the process
environment when no .dev.vars file exists, and the server already inherits
wb's effective environment, so wb no longer generates the file: it removes
wb gen-dev-vars and stops when a stale .dev.vars or .dev.vars.<mode> is left
beside the config. Each instance then gets the secrets of its own
environment.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…ronment

The runtime lets the process environment override the config's text values,
so an exported value (e.g. WB_ENV=development under MISE_ENV=test) replaced
the configured one; the server environment now holds the config's values
for those keys.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…n keys

Writing the config's values into wb's own environment let a text binding
named PORT replace the port wb listens on; the values now reach only the
server command, through env.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…e config

Values in the script text are altered by its normalization, so the local
server now runs without those keys and the runtime takes the config's
values as they are.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…of their own

Removing differing keys made a config that derives a value from that key
fall back to its default; the server now gets the config's evaluated value
for such a key, passed through a separate variable so the script's
normalization cannot alter it.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…own database

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
A scripts/start-production.sh or ecosystem.config.cjs start bypasses the
Worker start commands, which now own the local D1 migration.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The Cloudflare Vite plugin takes only declared secrets from the environment,
so replacing exported values there only fed the config transformed inputs.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
The seed may rewrite data, so only production-style starts, which seeded
before, run it after migrating a drizzle-kit D1.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Replacing or removing exported keys named like bindings changed the inputs
cf dev evaluates the config with. The server now gets the exported
environment, as Wrangler run alone does, except WB_ENV, which wb sets to the
mode it resolved.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
exKAZUu and others added 19 commits November 26, 2026 18:28
Without the file, Wrangler replaces any text or JSON binding named like an
exported variable (e.g. NEXT_PUBLIC_BASE_URL, which wb itself exports) with
that variable. Regular starts generate .dev.vars.<mode> again, atomically and
only when it changes; instances on a chosen state directory never write it
and read it when it exists, else their own environment.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Setting WB_ENV only for cf dev let a config that reads it bind another D1
than the one wb migrated.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Isolated instances read the mode's .dev.vars.<mode> when it exists, so the
test no longer expects a per-instance secret value from the environment.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
A drizzle config for D1 selects the d1-http driver from
CLOUDFLARE_D1_DATABASE_ID, which wb sets only for remote migrations; the
local D1 wrapper now unsets it, so an exported one cannot make a local start
migrate the remote database.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…l D1 data

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
It read workspace environments before wb start sets the mode, and a start
never resets the directory.

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
…ures

Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
@exKAZUu
exKAZUu merged commit 7d3d0ce into main Nov 26, 2026
4 checks passed
@exKAZUu
exKAZUu deleted the fix/wb-local-d1-migrations branch November 26, 2026 10:58
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.

fix(wb): apply the selected D1 migration mechanism on every local launch fix(wb): make wb db follow the cf-native D1 migration mechanism

1 participant