Repository navigation
Effect Service Conventions: 1 issue found
apps/server/src/usage/AccountLimitsService.test.ts — imports the service module's layer export under an alias (layer as accountLimitsLayer), which erases the module namespace at a service boundary. Import the module as a namespace (import * as AccountLimitsService from "./AccountLimitsService.ts") and use AccountLimitsService.AccountLimitsService / AccountLimitsService.layer / AccountLimitsService.planCodexTranscriptSeeds, as ProviderRuntimeIngestion.test.ts already does. An inline comment has been posted.
No other convention violations were found in the changed scope.
Details
Note
Your check run agent prompt is: .macroscope/check-run-agents/effect-service-conventions.md
More information about how Check Run Agents work can be found in our Help Center.
Files reviewed (in scope): apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.ts and its test, apps/server/src/usage/AccountLimitsService.ts and its new test, apps/server/src/usage/accountLimitsNormalize.ts and its test, apps/web/src/components/usage/AccountLimits.tsx, apps/web/src/state/accountLimits.ts and its new test, packages/contracts/src/accountLimits.ts.
Checks performed:
- Effect library imports: all touched files use subpath namespace imports (
effect/Effect,effect/Layer, ...); no consolidatedfrom "effect"imports were introduced. - Service definition:
AccountLimitsServicekeeps the canonical order (imports, schemas,Context.Servicetag with inline interface,make,layer); no standalone shape type, no renamedmake/layer. - Dependency acquisition: new dependency
HostProcessEnvironmentis acquired withyield*insidemake;configMappassed intomaybeSeedCodexFromTranscriptsis a pure derived value, not service injection.HostProcessEnvironmentis imported by name repo-wide, matching existing usage. - Runtime boundaries:
Layer.succeedoccurrences are test seams (layerTest, the recording layer inProviderRuntimeIngestion.test.ts);Effect.runPromiseappears only in test entry points, not in service code. - Errors: no new error classes, discriminators, or
catchTag/catchIfrecoveries were introduced; existingEffect.catchCausefallbacks are unchanged in kind. - File layout: no service/layer file moves or compatibility shims in this PR.
- Tests: new tests cover real behavior changes (per-instance slots, migration/eviction, transcript seed attribution, client-side merge), not a mechanical refactor.
🔍 Agent activity — 1 tool call
💭 I'm examining the changed files to identify Effect service convention violations, particularly looking at how modules are imported. The
AccountLimitsService.test.tsfile uses an alias that collapses the module namespace when importing the layer, which goes against the convention of importing service modules as a namespace at service boundaries—though this is in a test file, so the rule's applicability might differ. I should verify the actual files to confirm whether these are genuine violations and check how other imports likeHostProcessEnvironmentand helper functions are being used. I'm noticing the test is using an alias import that obscures the module namespace, which violates the naming convention. I should refactor it to use a namespace import instead, then access the layer through that namespace. Let me check how other test files in the repository handle similar imports to match the established pattern. The HostProcessEnvironment import follows the repo's convention, so that's fine. Now I need to check how the test file handles its alias imports and look at other AccountLimits-related tests to see if there's a consistent pattern. Let me search the codebase for thelayer asimport pattern to understand how prevalent it is. This is the only place in the codebase where this convention is violated, and it was introduced in this PR. Looking at the imports across the test files,AccountLimitsService.tsimportsServerConfigdirectly while its test file uses a namespace import — that's consistent. The test also usesEffect.runPromisein regular test cases, which is fine at the test boundary. I'm checking howderiveProviderInstanceConis handled... The helper function is imported cleanly, and while it's in a "Layers" directory, that file-layout rule only applies to moved modules, not this change. The test file properly importsACCOUNT_LIMITS_CONTRACT_VERSIONfrom contracts, and the web file uses named imports correctly. For the config handling,configMapis passed as a pure value andhostEnvironmentcomes from the environment — both good. The error handling withEffect.catchCauseis a pre-existing pattern, not acatchTagsissue. I need to verify the new test file importsAccountLimitsServiceas a namespace at the service boundary, which would be the fix needed. The only real issue is that aliasedlayer as accountLimitsLayerimport in the test file. Even though it's just a test, the rule explicitly calls out this pattern at service boundaries, so I should flag it with an inline comment and mark this as a failure.
1. modify_pr — One convention finding: the new service test aliases the service module's layer export instead of importing the module as a namespace. Everything else in the touched Effect code (subpath namespace imports, Context.Service shape, dependency acquisition via yield*, test-only Layer.succeed seams, runPromise confined to test boundaries) matches the conventions.
Agent Credits: 79 credits