Repository navigation
refactor(config): avoid evaluating type-only configuration modules - #133604
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:01 PM ET / 23:01 UTC. ClawSweeper reviewWhat this changesThe PR changes the configuration barrel so 36 type-only modules are erased from runtime imports while preserving the runtime exports from the models, secrets, and tools modules, with a fresh-import regression test. Merge readinessKeep this maintainer-owned PR open for normal exact-head CI and maintainer handling; the introduced change is a focused, source-supported refactor with no blocking correctness finding. Priority: P3 Review scores
Verification
How this fits togetherThe configuration barrel supplies shared configuration types and a small set of runtime helpers to config loading and validation callers. Making type-only re-exports erasable prevents source imports from evaluating modules that cannot contribute runtime values. flowchart LR
A[Configuration callers] --> B[Configuration barrel]
B --> C{Export kind}
C -->|Type only| D[Erased from runtime]
C -->|Runtime value| E[Models secrets and tools]
D --> F[Config validation and setup]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +26. Total +26 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the erased type-only barrel exports after the exact-head checks complete, retaining the three modules that own runtime configuration values. Do we have a high-confidence way to reproduce the issue? Yes—current main’s value re-exports make type-only modules runtime dependencies, and the added fresh-import scenario directly targets that behavior; this read-only review did not execute the test. Is this the best way to solve the issue? Yes—the barrel is the canonical owner of these import edges, and static inspection shows the only runtime-exporting modules remain ordinary value exports. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 94f6cebc617a. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #130706 (Gateway metadata ownership and performance)
Additional instructions
Keep Allow edits from maintainers enabled.
What Problem This Solves
Source-based config entrypoints do unnecessary module-loading work when importing shared configuration helpers. This is a maintainer-requested, independently landable slice of the broader metadata work.
Why This Change Was Made
The config barrel now uses
export type *for 36 modules that emit no runtime code. It preserves the existing value exports fromtypes.models.ts,types.secrets.ts, andtypes.tools.ts, with no metadata selection, caching, or lifecycle changes. A regression in the existing cold-import suite exercises the real barrel and checks the retained runtime exports against their real owner modules.User Impact
No user-visible behavior change. Configuration types, runtime values, defaults, and public SDK names remain compatible. This removes unnecessary source import edges; no startup-time or memory improvement is claimed.
Evidence
The new regression failed on unchanged main because the type-only channels module was evaluated once. With this change, all 20 tests across the cold-import, schema-startup, and secret-helper suites pass. The full changed-file gate passes, including production/test typechecks, targeted lint, unused-export scans, and import-cycle checks.
Validated with Node 24.19.0 and pnpm 12.1.0:
The full declaration-enabled build passed on
7330b8a587bb4d6f235c7dcad15bd3ac18a7baa7, including SDK export validation. Build metadata names that commit; tracked source and lockfile hashes remain unchanged. No ineffective dynamic-import warnings occurred; four dependencyevalwarnings remain. Codex autoreview reported no findings at its default P0 scope.Production LOC: +36/-36 (net 0). Tests: +29/-3 (net +26). Only two files change.