refactor(server): import Effect services as namespaces - #14385
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…t, git, device, scheduling and relay modules Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…and remaining modules Covers the src/ root (ws.ts, server.ts and others), integration/, scripts/, and the remaining src directories whose only violations were tag imports of ServerConfig and ServerSettingsService. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This is a large but predominantly mechanical namespace-import refactor with no intended behavior or default changes. Human review is still required because the diff includes authentication/security-related production files, which are treated as sensitive regardless of the narrowness of the edits. You can add or adjust custom eligibility rules. Learn more. |
16d72f4
into
t3code/codex-turn-mapping
Local Effect service modules are imported as namespaces (
import * as ProjectService from "./ProjectService.ts", thenProjectService.ProjectService/ProjectService.layer/ProjectService.make), never as named or aliased tags and layers. This PR applies that rule toapps/serveroutsidesrc/orchestration-v2/:provider,mcp,project,persistence,pullRequest,scheduledTasks,device,scheduling,relay,git, thesrc/root (ws.ts,server.ts, …),integration/,scripts/, and the othersrc/directories that tookServerConfig/ServerSettingsServicetags by name.The change covers imports and call sites only, with no behavior change. It was done with a TypeScript-checker codemod, so every rewritten reference resolves to the same symbol. When a file needed the tag and also a helper, error or type from the same module, everything now goes through the one namespace, so no module is imported both ways.
config.tsbecomesServerConfigandserverSettings.tsbecomesServerSettings. Three files already bindServerSettingsto the contracts schema, so they useSettings, which follows the existing precedent instorageCleanup.ts. The deprecated staticServerConfig.layerTest/ServerSettingsService.layerTestaccessors are replaced with the module-levellayerTestin files this PR already touches.Audit counts (
ns-audit.py,apps/serverminussrc/orchestration-v2/)8297ccf85d)The 5 remaining files are left alone on purpose, because open PRs are changing them:
src/provider/Drivers/OpenCodeDriver.ts:{ ServerConfig },{ ServerSettingsService },{ OpenCodeRuntime }src/provider/Drivers/CodexManagedProvider.ts:{ ServerSettingsService }src/provider/Layers/OpenCodeProvider.ts:{ OpenCodeRuntime }src/provider/ModelManifest.ts:{ ServerConfig }src/provider/Layers/OpenCodeProvider.test.ts:{ ServerConfig },{ OpenCodeRuntime }. This file is not on the protected list, but the OpenCode 2 stack (feat(server): detect OpenCode 1.x or 2.x per instance and route by it #14239 and above) edits its import block.A grep for
layer as,make asandLive asin this area now finds nothing. The remaining named imports from service modules are pure helpers (for examplemakeLinuxCgroupControllerfromAcpSessionRuntime.ts, andmakeClaudeQueryOptionsin a script), which the convention allows.Follow-ups (not in this PR)
Non-canonical export names are still referenced through namespaces here. Renaming any of them touches files in open PRs (#5589, #9376, #9635 for the Cursor/Codex/Antigravity ones), so they are left for later:
provider/Layers/CursorSdkCatalog.ts:CursorSdkCatalogLive,makeCursorSdkCatalog,makeCursorSdkCatalogTestLayer(should belayer/make/ a test layer)provider/CodexInstallation.ts,provider/AntigravityInstallation.ts:makeCodexInstallation,makeAntigravityInstallation, and the layer exposed only as a staticTag.layerwith no module-levellayer, so call sites readCodexInstallation.CodexInstallation.layerprovider/acp/AcpRegistryRuntimeCoordinator.ts: the layer is module-private and exposed only throughstatic get layer()provider/acp/AcpRegistrySupport.ts:makeAcpRegistryCatalog. TheAcpRegistryCatalogtag lives in a support module and is not named for it.provider/opencodeRuntime.ts(protected):OpenCodeRuntimeLivepersistence/Layers/Sqlite.ts:layerConfig,makeSqlitePersistenceLive,SqlitePersistenceMemorydevice/DeviceService.ts:makeWithHostsclaudeAgentSdkQueryRunnerLiveLayer,codexAppServerClientFactoryFromSettingsLayer,cursorAgentSdkRunnerLiveLayer,UsageLimitRecoveryWorker.workerLive,ProviderAdapterRegistry.makeLayer/layerFromProviderInstanceRegistry*Live/*Layernames without a service tag (runtimeLayer.ts,http.tsroute layers,ProviderRegistry.ts/ProviderInstanceRegistryHydration.ts/AcpRegistryCatalog.tsunderprovider/Layers/, MCP toolkit*HandlersLive). The audit doesn't cover these, and they belong with the export-rename follow-up.provider/Services/*hold the tags whileprovider/Layers/*hold the implementations, andpersistence/Services+persistence/Layersare split the same way. So one service is spread over two modules, against the one-module-per-service convention.layerTestaccessors onServerConfigandServerSettingsServiceare still used by files outside this PR (assets,checkpointing,telemetry,textGeneration,workspacetests).Verification
cd apps/server && vp exec tsc --noEmit -p .: exit 0, noerror TS/warning TS.vp test runon the tests for every touched file, plusProviderRegistry.test.ts,ProviderInstanceRegistryLive.test.ts, allsrc/mcp/**tests,ws.test.ts,cli/project.test.ts, and theserverRuntimeStartup/serverLifecycleEvents/serverRuntimeState/serverSettingstests: 103 files, 1359 tests passed. Noserver.test.tsexists on V2.server.tslayer wiring is covered by tsc, since a missing provide fails the requirements type.vp linton the 139 touched files: exit 0. The warning set is identical to base (16 pre-existing, 0 new).vp run knip:check: exit 0.vp check,-rtest/typecheck, live provider tests (*.live.test.ts).Model: Claude Opus 5.5 (Claude Code)
🤖 Generated with Claude Code