Skip to content

effectify Config service#19139

Open
kitlangton wants to merge 14 commits intodevfrom
kit/effectify-config
Open

effectify Config service#19139
kitlangton wants to merge 14 commits intodevfrom
kit/effectify-config

Conversation

@kitlangton
Copy link
Contributor

Summary

  • move Config onto an Effect service runtime and back the per-instance resolved config with InstanceState
  • keep global config caching and invalidation behind the service so Config.global() and Config.global.reset() still work
  • update the TUI worker reload path to await the async global reset before disposing instances

Testing

  • bun typecheck
  • bun run test test/config/config.test.ts test/config/tui.test.ts

Move all config operations (loadFile, loadConfig, loadState,
loadGlobal, update, updateGlobal, invalidate) inside the Effect
layer as Effect.fnUntraced closures over AppFileSystem.Service.
Facade functions are thin runPromise wrappers matching the
Account/Worktree pattern.
- Schema write-back: restore silent failure (was .catch(() => {}),
  accidentally changed to Effect.orDie which would crash on
  read-only config files)
- Legacy TOML migration: move write+unlink back inside .then()
  so they only run on successful import (old behavior)
- Account config: route through loadConfig instead of bypassing
  it, preserving TUI key normalization
- readConfigFile: use typed Effect.catchIf instead of (e as any) cast
- Remove dead readFile re-export (no callers)
- Remove inaccurate comments
- updateGlobal: replace unnecessary Effect.suspend with plain if/else
- Replace module-level _cachedGlobal with Effect.cached inside
  the layer — concurrent getGlobal() callers share the same fiber
  instead of racing
- Remove resetGlobal() facade — tests use invalidate() instead
- Document Effect.cached pattern in AGENTS.md and effect-migration.md
- Mark Config as done in migration checklist
@kitlangton kitlangton force-pushed the kit/effectify-config branch 2 times, most recently from 2fec853 to d9cefe2 Compare March 25, 2026 20:00
@kitlangton
Copy link
Contributor Author

/review

opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
@github-actions
Copy link
Contributor

lgtm

opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
@opencode-agent
Copy link
Contributor

⚠️ Blocking Beta Release

This PR cannot be merged into the beta branch due to: Merge conflicts with dev branch

Please resolve this issue to include this PR in the next beta release.

opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
opencode-agent bot added a commit that referenced this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant