Summary
Local apps/api and apps/store development currently do not share seeded manifest data the way we want.
I tried to make setup-dev seed data visible to both apps by sharing Wrangler local persistence, but the result still does not work:
apps/api manifest route still returns 404
apps/store /.ucd-store.lock returns an empty versions map
apps/store /:version/snapshot.json still returns 404
apps/store file access still works, because it delegates to the API service binding
What was attempted
- Add the same shared
--persist-to ../../.wrangler/state/apps-shared path to:
apps/api dev
apps/store dev
- Keep
dev:setup on API only.
- Update
packages/ucdjs-scripts/src/commands/setup-dev.ts so the temporary API worker started via unstable_startWorker() also uses the shared persistence path.
What we observed
Default local state is isolated per app
By default, Wrangler local state is stored under each app's own .wrangler/state, so API/store local R2 state is isolated.
Shared persistence did not make seeded manifests visible
Even after updating both app dev scripts to use the same shared --persist-to path, local manifest data still was not visible to the running app workers.
setup-dev uploads succeeded, but not into the state the running workers used
The setup-dev run clearly succeeded and uploaded manifests:
manifest/17.0.0/manifest.json
manifest/16.0.0/manifest.json
manifest/15.1.0/manifest.json
manifest/15.0.0/manifest.json
manifest/4.1.0/manifest.json
manifest/4.0.0/manifest.json
But after the run:
- the shared SQLite file at
.wrangler/state/apps-shared/.../miniflare-R2BucketObject/...sqlite had no objects
- the seeded manifest objects were present in
apps/api/.wrangler/state/.../miniflare-R2BucketObject/...sqlite
So the practical outcome was:
setup-dev seeded the API app's default local state
- the app dev workers using
--persist-to ../../.wrangler/state/apps-shared did not see those manifests
Runtime evidence
During pnpm run dev:apps:
@ucdjs/api#dev:setup completed successfully and logged uploaded manifests
@ucdjs/api#dev still returned 404 for /.well-known/ucd-store/17.0.0.json
@ucdjs/store#dev returned 200 for /.ucd-store.lock, but with an empty versions object
@ucdjs/store#dev returned 404 for /17.0.0/snapshot.json
@ucdjs/store#dev returned 200 for /17.0.0/Blocks.txt
Likely follow-up directions
One of these probably needs to happen:
- Confirm the correct way to make
unstable_startWorker() seed into the same persisted local state used by wrangler dev --persist-to
- Stop relying on shared persistence and instead generalize
setup-dev so it can explicitly target multiple local worker data paths
- Rethink the store dev flow so it does not require local direct-R2 manifest seeding in the same way
Relevant files
apps/api/package.json
apps/store/package.json
packages/ucdjs-scripts/src/commands/setup-dev.ts
apps/store/src/routes/lockfile.ts
apps/store/src/routes/snapshot.ts
apps/store/src/routes/files.ts
Summary
Local
apps/apiandapps/storedevelopment currently do not share seeded manifest data the way we want.I tried to make
setup-devseed data visible to both apps by sharing Wrangler local persistence, but the result still does not work:apps/apimanifest route still returns404apps/store/.ucd-store.lockreturns an emptyversionsmapapps/store/:version/snapshot.jsonstill returns404apps/storefile access still works, because it delegates to the API service bindingWhat was attempted
--persist-to ../../.wrangler/state/apps-sharedpath to:apps/apidevapps/storedevdev:setupon API only.packages/ucdjs-scripts/src/commands/setup-dev.tsso the temporary API worker started viaunstable_startWorker()also uses the shared persistence path.What we observed
Default local state is isolated per app
By default, Wrangler local state is stored under each app's own
.wrangler/state, so API/store local R2 state is isolated.Shared persistence did not make seeded manifests visible
Even after updating both app
devscripts to use the same shared--persist-topath, local manifest data still was not visible to the running app workers.setup-devuploads succeeded, but not into the state the running workers usedThe
setup-devrun clearly succeeded and uploaded manifests:manifest/17.0.0/manifest.jsonmanifest/16.0.0/manifest.jsonmanifest/15.1.0/manifest.jsonmanifest/15.0.0/manifest.jsonmanifest/4.1.0/manifest.jsonmanifest/4.0.0/manifest.jsonBut after the run:
.wrangler/state/apps-shared/.../miniflare-R2BucketObject/...sqlitehad no objectsapps/api/.wrangler/state/.../miniflare-R2BucketObject/...sqliteSo the practical outcome was:
setup-devseeded the API app's default local state--persist-to ../../.wrangler/state/apps-shareddid not see those manifestsRuntime evidence
During
pnpm run dev:apps:@ucdjs/api#dev:setupcompleted successfully and logged uploaded manifests@ucdjs/api#devstill returned404for/.well-known/ucd-store/17.0.0.json@ucdjs/store#devreturned200for/.ucd-store.lock, but with an emptyversionsobject@ucdjs/store#devreturned404for/17.0.0/snapshot.json@ucdjs/store#devreturned200for/17.0.0/Blocks.txtLikely follow-up directions
One of these probably needs to happen:
unstable_startWorker()seed into the same persisted local state used bywrangler dev --persist-tosetup-devso it can explicitly target multiple local worker data pathsRelevant files
apps/api/package.jsonapps/store/package.jsonpackages/ucdjs-scripts/src/commands/setup-dev.tsapps/store/src/routes/lockfile.tsapps/store/src/routes/snapshot.tsapps/store/src/routes/files.ts