Skip to content

chore: upgrade to Effect 4.0.0 and Alchemy 2.0.0-beta.80 - #52

Merged
K-Mistele merged 2 commits into
mainfrom
effect-v4-stable
Oct 4, 2026
Merged

K-Mistele merged 2 commits into
mainfrom
effect-v4-stable

Conversation

@K-Mistele

@K-Mistele K-Mistele commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Moves fold from the Effect 4.0.0 release candidate (rc.112) to the stable 4.0.0 release. Alchemy beta.80 requires effect@^4.0.0, so it moves with it; @effect/tsgo goes to 0.48.0.

Versions

Package Before After
effect, @effect/platform-node, @effect/platform-bun, @effect/vitest 4.0.0-rc.112 4.0.0
alchemy 2.0.0-beta.76 2.0.0-beta.80
@effect/tsgo 0.47.0 0.48.0

What 4.0.0 required

  • Module paths: effect/unstable/* became effect/* (effect/http, effect/ai, effect/cli, ...). This is most of the diff.
  • Renames:
    • Config.string / Config.redacted → Config.String / Config.Redacted.
    • CLI Flag constructors became PascalCase, with choice → Literals and integer → Int.
    • Schema.isStartsWith → Schema.isStartingWith.
    • LanguageModel.Service → LanguageModel.LanguageModel.
    • FileSystem.Size → ByteSize.bytes.
    • effect/Encoding → Base64 / Base64Url from effect/encoding.
  • Vendored AI providers (effect-ai-openai, effect-ai-anthropic, effect-ai-openai-compat): upstream's rc.112 → 4.0.0 changes were applied with a three-way merge, keeping the HumanLayer delta listed in each UPSTREAM.md. Each UPSTREAM.md and the openai-compat checksums now pin 4.0.0. The openai-compat files in UPSTREAM.sha256 were checked to match the 4.0.0 tarball byte for byte.

Choices worth a look

  • unstableApiUsage is off in tsconfig.json and .oxlintrc.jsonc. 4.0.0 marks effect/ai, effect/http and the other moved modules as unstable. fold is built on them, and the new diagnostic produced about 1,500 warnings and failed the declaration build.

  • makeBrandedId has one type assertion. Schema.brand now accepts only a single literal brand name. makeBrandedId computes the name at runtime, from brand or the prefix, so it asserts the overload's literal type once, with a SAFETY: comment. Brands are type-only at runtime in 4.0.0, and the public API is unchanged.

  • AnyTool in ToolsetService.ts. In 4.0.0, a tool's parameter-encoding services reach streamText, and its handler services reach the handler's start. With Tool.Any both come out as unknown. AnyTool states that fold's tool schemas need no services and its handlers need only the per-call services. ToolsetService.handle now declares those services on the outer effect too; ToolRuntime already provides them there.

  • A flaky test, fixed. In 4.0.0, FileSystem.stat reads file times in nanoseconds and drops the fraction of a millisecond. The session-summary fast-path test reset a log's time from Node's statSync, and utimesSync can store that a hair early. Effect then read the previous millisecond, about half the time, and the cache missed. It failed 4 times in 10 here and 0 in 10 on main. The test now sets the time half a millisecond past the recorded one, and passed 20 of 20. Production code isn't affected, because the cache compares Effect's readings with each other.

Checks

bun run typecheck, bun run lint, bun run format:check and bun run test all pass locally:

  • fold-core: 331 tests
  • fold-agent: 273
  • fold-cli: 119
  • fold-codex: 44
  • examples and the other packages: the rest

🤖 Generated with Claude Code

K-Mistele and others added 2 commits October 3, 2026 14:16
Effect 4.0.0 is the first stable v4 release. Alchemy beta.80 requires
`effect@^4.0.0`, so both move together; @effect/tsgo goes to 0.48.0.

- Import paths move from `effect/unstable/*` to `effect/*`.
- Follow the 4.0.0 renames: PascalCase `Config` and CLI `Flag`
  constructors, `Schema.isStartingWith`, `LanguageModel.LanguageModel`,
  `ByteSize.bytes`, and `effect/encoding` `Base64`/`Base64Url`.
- Refresh the vendored @effect/ai-openai, ai-anthropic and
  ai-openai-compat sources from rc.112 to 4.0.0 with a three-way merge
  that keeps the HumanLayer delta; update UPSTREAM.md and checksums.
- `Schema.brand` now takes one literal name, so `makeBrandedId` asserts
  its runtime-computed name once (brands are type-only at runtime).
- Add `AnyTool` for fold's erased tools: with `Tool.Any`, 4.0.0's new
  parameter-encoding and handler-start requirements come out unknown and
  leak into every model request.
- Turn off the new `unstableApiUsage` diagnostic: 4.0.0 marks effect/ai,
  effect/http and the other moved modules unstable, and fold is built on
  them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a0f3fc-13b0-758f-a343-fae04e83a7a9
…path test

Effect 4.0.0 reads file times as nanoseconds and drops the fraction of a
millisecond. The test reset the log's time from Node's statSync Date, and
utimesSync can store that a hair early, so Effect read the previous
millisecond about half the time and the cache missed. Set the time half a
millisecond past the recorded one instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HumanLayer-Session: https://app.dev.codelayer.gg/sessions/01a0f3fc-13b0-758f-a343-fae04e83a7a9
@K-Mistele
K-Mistele merged commit ebc4889 into main Oct 4, 2026
5 checks passed
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.

1 participant