chore: rename alchemy-effect → alchemy@2.0.0-beta.20#16
Conversation
Upstream renamed `alchemy-effect` to `alchemy` (v2.x). Migrates the
workspace to the new package and v2 API.
Imports
- `alchemy-effect/X` → `alchemy/X` across 10 source files
- Top-level `{ Cloudflare, Output, Stage }` no longer re-exported in v2 →
switch to namespace imports (`import * as Cloudflare from "alchemy/Cloudflare"`)
and `Alchemy.Stage` from `import * as Alchemy from "alchemy"`
Stack API
- v2 `Stack` is a 3-arg constructor `Alchemy.Stack(name, opts, effect)`
with required `state` layer. All 5 deploy scripts (apps/{web,docs,api},
packages/db, packages/infra/src/docs.stack.ts) now use
`Cloudflare.state()` (Cloudflare-hosted state store)
Package.json
- 4 simple workspaces: `"alchemy-effect": "catalog:"` →
`"alchemy": "catalog:"`
- `packages/infra`: drops dead `"alchemy": "^0.81.2"` (classic API not
used in src/), switches catalog ref to v2
Cleanup
- Deletes `packages/infra/gen/` — stale duplicate of `packages/gen/*`
workspaces (1 commit / 90d vs 44, no external references)
- Deletes vendored OpenNext asset overlay
(`vendor/alchemy-effect-opennext-overlay/`,
`scripts/apply-alchemy-effect-opennext-assets.ts`,
`scripts/ALCHEMY_EFFECT_OPENNEXT_UPSTREAM.md`,
root `postinstall` hook). The overlay was tied to the
`alchemy-effect@0.12.x` file structure and is incompatible with v2.
`apps/docs/alchemy.run.ts` `assets.sources` field commented out with
a TODO referencing the follow-up — until alchemy@2 ships native
`AssetsProps.sources`, OpenNext incremental cache misses for
`cdn-cgi/_next_cache` paths fall back to ISR revalidation (cache
hit-rate regression, not a hard breakage)
Behavior change to flag
- All 5 stacks now use `Cloudflare.state()` instead of the previous
filesystem-only LocalState. First deploy from each environment will
prompt to deploy the `alchemy-state-store` worker; CI runs require
the store to exist or they die with `AuthError`. The existing
`actions/cache@v4` of `apps/{web,docs}/.alchemy/` in the workflows
is now a no-op and can be removed in a follow-up
Verification
- `bun install` succeeds (lockfile regenerated, the original
stackpanel-r7g blocker is gone)
- `tsc --noEmit` clean for all 5 affected workspaces — no alchemy
errors remain. Pre-existing unrelated errors (third-party plugin
type errors, root tsconfig empty `files`, unused `dotenv` import)
are untouched
PR SummaryCursor Bugbot is generating a summary for commit b35d8c7. Configure here. |
… follow-ups stackpanel-r7g closed by PR #16 (alchemy-effect → alchemy@2 rename). Follow-ups discovered while shipping the migration: - stackpanel-49t — restore .open-next/cache asset overlay once alchemy@2 ships AssetsProps.sources (vendored overlay was deleted as incompatible with v2's restructured Worker.ts/Assets.ts) - stackpanel-zhq — remove now-obsolete actions/cache@v4 of apps/{web,docs}/.alchemy from deploy workflows (Cloudflare.state() replaces filesystem LocalState)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b35d8c7013
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| )( | ||
| { | ||
| providers: allProviders, | ||
| state: Cloudflare.state(), |
There was a problem hiding this comment.
Keep DB stack on local state by default
Switching this stack to Cloudflare.state() makes bun run db:up depend on deploy-scope Cloudflare state credentials, but this entrypoint still only calls loadAppEnv("web", "dev"), which does not load the deploy scope where ALCHEMY_STATE_TOKEN/Cloudflare deploy vars are defined (packages/gen/env/src/embedded-data.ts). That regresses the previous local behavior (filesystem state) and can fail local Docker/Neon provisioning unless users manually inject deploy secrets. Use local state here or load deploy env before selecting the Cloudflare state backend.
Useful? React with 👍 / 👎.
apps/docs/alchemy.run.ts imports from `effect/Effect` directly but the package wasn't declared as a dep, so bun's per-workspace resolution inside `apps/docs/` (where the deploy step runs) couldn't find it. Surfaced as `ResolveMessage: Cannot find module 'effect/Effect' from apps/docs/alchemy.run.ts` in the Deploy Docs CI job for PR #16.
…e for staging/prod Addresses PR #16 review: switching every stack to Cloudflare.state() broke local entrypoints that don't load deploy-scope creds (notably `bun run db:up`, which only loads `loadAppEnv("web", "dev")` — see packages/gen/env/src/embedded-data.ts) and required CI deploys to first bootstrap the Cloudflare state-store Worker, which alchemy v2 explicitly won't do under CI=true. Add `selectStateBackend(appEnv)` helper in @stackpanel/infra/lib/deploy: - dev → localState() (filesystem; cached across CI runs via actions/cache; no Cloudflare creds required for PR previews or `bun run db:up`) - staging → Cloudflare.state() (durable, team-shared) - prod → Cloudflare.state() (durable, team-shared) Wire it through apps/{web,docs,api}/alchemy.run.ts. Use localState() directly in packages/db/alchemy.run.ts since it's local-only and has no stage variable — this is the regression the reviewer flagged. Unblocks the PR-16 preview deploys (which were failing with "Unauthorized: Authentication error" from Cloudflare.state()'s first getScriptSetting call) without requiring a token-scope change. Staging/prod still need the state-store Worker bootstrapped interactively before their first deploy, but that's a one-time, account-wide setup.
|
Docs preview |
|
Preview |
Summary
Upstream renamed
alchemy-effecttoalchemy(v2.x). Migrates the workspace to the new package + v2 API. Unblocks thebun installfailure tracked instackpanel-r7g.Imports
alchemy-effect/X→alchemy/Xacross 10 source filesCloudflare,Output,Stage→ switch to namespace imports (import * as Cloudflare from \"alchemy/Cloudflare\") andAlchemy.Stagefromimport * as Alchemy from \"alchemy\"Stack API
v2 uses a 3-arg constructor with required
statelayer. All 5 deploy scripts (apps/{web,docs,api},packages/db,packages/infra/src/docs.stack.ts) updated:```ts
// v0.12.x (alchemy-effect)
export default Stack.make(name, providers)(program);
// v2 (alchemy)
export default Alchemy.Stack(
name,
{ providers, state: Cloudflare.state() },
program,
);
```
Package.json
\"alchemy-effect\": \"catalog:\"→\"alchemy\": \"catalog:\"packages/infra: drops dead\"alchemy\": \"^0.81.2\"(classic API not used in src/), switches catalog ref to v2Cleanup
packages/infra/gen/— stale duplicate ofpackages/gen/*workspaces (1 commit / 90d vs 44, zero external references)vendor/alchemy-effect-opennext-overlay/,scripts/apply-alchemy-effect-opennext-assets.ts,scripts/ALCHEMY_EFFECT_OPENNEXT_UPSTREAM.md, rootpostinstallhook). The overlay was tied toalchemy-effect@0.12.x's file structure and is incompatible with v2Behavior changes to flag
State backend: All 5 stacks now use
Cloudflare.state()instead of filesystemLocalState. First deploy from each environment will prompt to deploy thealchemy-state-storeworker; CI runs require the store to exist or they die withAuthError. Theactions/cache@v4ofapps/{web,docs}/.alchemy/in the workflows is now a no-op and can be removed in a follow-upOpenNext cache overlay:
apps/docs/alchemy.run.tsassets.sourcesfield commented out with a TODO. Untilalchemy@2ships nativeAssetsProps.sources, OpenNext incremental cache misses forcdn-cgi/_next_cachepaths fall back to ISR revalidation (cache hit-rate regression, not a hard breakage)Verification
bun installsucceeds; lockfile regenerated cleanlytsc --noEmitclean for all 5 affected workspaces — no alchemy errors remain@distilled.cloud/cloudflare-rolldown-plugin, roottsconfig.jsonemptyfiles, unuseddotenvimport inpackages/db/drizzle.config.ts)Test plan
apps/webdeploy against a preview branch (Cloudflare state-store first-time bootstrap)apps/docsdeployapps/docscache hit-rate before vs after (acceptable regression)actions/cache@v4of.alchemy/in workflowsCloses the install-side of stackpanel-r7g.
Follow-ups filed:
.open-next/cacheasset overlay oncealchemy@2supportsAssetsProps.sources(or vendor a v2-compatible patch)actions/cache@v4ofapps/{web,docs}/.alchemy/from deploy workflows