Skip to content
Source
Sign inSign up
pingdotgg/t3code

refactor(server): import service modules as namespaces, not aliased layers #16267

Mergedjuliusmarmingemerged 1 commit intomain fromrefs/pull/16267/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

docs/internals/effect-services.md says consumers import a service module as a namespace (import * as Foo from "./Foo.ts", then Foo.layer) and never import { layer as fooLayer }. Three files in apps/server/src/orchestration-v2 still used aliased imports.

This switches them to namespace imports and updates every use site:

  • runtimeLayer.ts: 39 aliased imports from 37 modules → namespace imports (layer, plus layerFromStores, layerFromApplicationReceipts, layerFromOrchestrationEventStore, layerFromProviderInstanceRegistry, layerWithLegacyImporter, executorLayer, pruneWorkerLive, workerLive).
  • Orchestrator.ts: ThreadCommandExecutor + layer as threadCommandExecutorLayer → import * as ThreadCommandExecutor (ThreadCommandExecutor.ThreadCommandExecutor, ThreadCommandExecutor.layer).
  • CheckpointRestoreSafety.test.ts: layer as rollbackLayer and layer as idAllocatorLayer → CheckpointRollbackService.layer, IdAllocator.layer.

Behavior-neutral: same layers, same composition order, only the import style and identifiers change.

Verified:

  • vp run typecheck in apps/server: passes
  • vp test run src/orchestration-v2/CheckpointRestoreSafety.test.ts src/orchestration-v2/runtimeLayer.test.ts: 81/81 pass
  • vp lint / vp fmt on the changed files: clean (one pre-existing unused-var warning on layerUnavailable in Orchestrator.ts, untouched)
  • Grep for layer… as / make as aliases across apps, packages, infra: only comments, type casts, and third-party @effect imports remain

🤖 Generated with Claude Code


Devin Review
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. juliusmarminge added labelsmacroscope-review

    3. Approvability

      Verdict: Approved at 97f83a7

      Macroscope's review found this PR approvable — This is a mechanical import normalization: production layer wiring and the test continue to use the same service, layer, and worker exports as before. No product defaults or runtime behavior are changed.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge merged this6302d66

    5. juliusmarminge closed this

    6. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiB✅
      CodexLive turn messages220 (0.0%)8✅
      ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
      ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
      ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
      ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiB✅
      ClaudeLive turn messages220 (0.0%)8✅

      Baseline: 7a047d0 · PR result: 97f83a7 · Source CI: success

      Scenario and decoded snapshot size

      10 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.

      • Codex decoded thread snapshot: 108.5 KiB
      • Claude decoded thread snapshot: 108.8 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Sign in to join this conversation.