Skip to content

fix(usage): drop limit windows the provider has never metered

MacroscopeApp / Macroscope - Effect Service Conventions failed Aug 15, 2026 in 1m 21s

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 consolidated from "effect" imports were introduced.
  • Service definition: AccountLimitsService keeps the canonical order (imports, schemas, Context.Service tag with inline interface, make, layer); no standalone shape type, no renamed make/layer.
  • Dependency acquisition: new dependency HostProcessEnvironment is acquired with yield* inside make; configMap passed into maybeSeedCodexFromTranscripts is a pure derived value, not service injection. HostProcessEnvironment is imported by name repo-wide, matching existing usage.
  • Runtime boundaries: Layer.succeed occurrences are test seams (layerTest, the recording layer in ProviderRuntimeIngestion.test.ts); Effect.runPromise appears only in test entry points, not in service code.
  • Errors: no new error classes, discriminators, or catchTag/catchIf recoveries were introduced; existing Effect.catchCause fallbacks 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.ts file 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 like HostProcessEnvironment and 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 the layer as import 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.ts imports ServerConfig directly while its test file uses a namespace import — that's consistent. The test also uses Effect.runPromise in regular test cases, which is fine at the test boundary. I'm checking how deriveProviderInstanceCon is 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 imports ACCOUNT_LIMITS_CONTRACT_VERSION from contracts, and the web file uses named imports correctly. For the config handling, configMap is passed as a pure value and hostEnvironment comes from the environment — both good. The error handling with Effect.catchCause is a pre-existing pattern, not a catchTags issue. I need to verify the new test file imports AccountLimitsService as a namespace at the service boundary, which would be the fix needed. The only real issue is that aliased layer as accountLimitsLayer import 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