[codex] Normalize server core Effect service modules#3187
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🚀 Expo continuous deployment is ready!
|
8c70ad6 to
8c5895c
Compare
ApprovabilityVerdict: Approved Mechanical refactoring that normalizes Effect service module import patterns and type definitions across the server codebase. No runtime behavior changes - only code organization and import styles are updated. You can customize Macroscope's approvability policy. Learn more. |
Co-authored-by: codex <codex@users.noreply.github.com>
8c5895c to
f5e74d0
Compare
Dismissing prior approval to re-evaluate f5e74d0
Summary
config,keybindings, lifecycle events, runtime startup, and server settings around inlineContext.Serviceinterfaces plus colocatedmake/layerexportsLayer.effectonly for genuinely effectful service construction; the externally constructedServerConfignow has a pure valuemake(config)andLayer.succeedfactoryService["Service"]references across affected consumersServerRuntimeStartupErroras a structuredSchema.TaggedErrorClasswhose message is derived from its startup stageOrchestration modules and excluded MCP service files are intentionally unchanged because orchestration is being reworked in #2829.
Impact
This standardizes the server core services on the Effect module layout already used by newer infrastructure. Runtime behavior is unchanged except for the intentionally structured startup error shape and derived message. Each layer now reflects whether construction is pure or effectful instead of wrapping pure service values in synthetic effects.
No test cases were added solely for this structural refactor; existing tests were updated only where their imports or structured error construction changed.
Validation
vp check(pass; 20 unrelated existing warnings)vp run typecheckContext.Servicemodules, zerolayer asaliases, zero standalone*ShapereferencesNote
Low Risk
Mechanical refactor with tests updated; the only intentional behavior change is structured
ServerRuntimeStartupErrorshape/message, andServerSettingssecret-store wiring moved to an explicit parent layer.Overview
Refactors server core Effect services (
ServerConfig,Keybindings,ServerLifecycleEvents,ServerRuntimeStartup,ServerSettings) to match the newer module pattern: service APIs live onContext.Serviceclasses (no separate*Shapetypes), with colocatedmake/layerexports replacing*Liveand ad-hocLayer.succeedwiring.ServerConfiggains puremake(config)andlayer(config)factories; tests uselayerTestas a module export (staticServerConfig.layerTestkept as deprecated shim). Call sites switch to namespace imports andService["Service"]for config typing.ServerRuntimeStartupErrorbecomes aSchema.TaggedErrorClasswith astagefield (e.g."command-readiness") and a derived message; tests assert the new wording.ServerSettings.layerno longer embedsServerSecretStore—server.tsprovides it at the composition root alongside other runtime layers.Touched files are mostly import/layer/test updates across CLI, auth tests, provider tests, and HTTP server wiring; orchestration modules are out of scope per the PR description.
Reviewed by Cursor Bugbot for commit f5e74d0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Normalize Effect service modules in server core to use namespace imports and inlined service shapes
* as Moduleimports across server core modules, tests, and CLI code, so service tags and types are accessed asModule.ServiceName(e.g.ServerConfig.ServerConfig,Keybindings.Keybindings).*Shapeinterfaces (e.g.ServerConfigShape,KeybindingsShape,ServerLifecycleEventsShape) and inlines service contracts directly into theContext.Servicegeneric.layerconvention (e.g.KeybindingsLive→Keybindings.layer,ServerSettingsLive→ServerSettings.layer,ServerRuntimeStartupLive→ServerRuntimeStartup.layer).Layer.succeed(ServerConfig, config)call sites withServerConfig.layer(config), meaning layer acquisition/release logic now runs wherever config is provided.ServerRuntimeStartupErroras aSchema.TaggedErrorClasswith a structuredstagefield; the error message is now always'Server runtime startup failed before command readiness.'instead of a caller-supplied string.ServerSettings.layerno longer internally providesServerSecretStore.layer; callers must now composeServerSecretStore.layerexplicitly.Macroscope summarized f5e74d0.