Skip to content

refactor(config): avoid evaluating type-only configuration modules - #133604

Merged
steipete merged 1 commit into
mainfrom
codex/130706-config-type-barrel
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/130706-config-type-barrel

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 from types.models.ts, types.secrets.ts, and types.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:

OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/run-vitest.mjs src/config/validation.cold-imports.test.ts src/config/zod-schema.startup-import.test.ts src/config/types.secrets.test.ts src/config/types.secrets.resolution.test.ts
OPENCLAW_VITEST_MAX_WORKERS=4 node scripts/check-changed.mjs -- src/config/types.ts src/config/validation.cold-imports.test.ts
env -u OPENCLAW_RUN_NODE_SKIP_DTS_BUILD pnpm build

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 dependency eval warnings 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.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 7:01 PM ET / 23:01 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 1 item remains

Keep 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
Reviewed head: 7330b8a587bb4d6f235c7dcad15bd3ac18a7baa7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-neutral refactor with source-supported runtime preservation and a targeted regression scenario.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-owned, behavior-neutral configuration refactor does not require external contributor proof; its changed owner is the configuration barrel, and the added Vitest scenario fresh-imports that barrel with a type-only module probe.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-owned, behavior-neutral configuration refactor does not require external contributor proof; its changed owner is the configuration barrel, and the added Vitest scenario fresh-imports that barrel with a type-only module probe.
Evidence reviewed 6 items Introduced runtime boundary: The PR converts the type-only barrel entries to export type * while leaving the three runtime-owning modules as value re-exports.
Runtime-export audit: A scan of every converted module finds exported runtime declarations only in types.models.ts, types.secrets.ts, and types.tools.ts, all of which remain value exports.
Public config facade caller: The public config facade re-exports this barrel, so retaining the three value modules preserves its runtime helper surface while the other entries remain type-visible only.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

  • Complete next step (P2) - No narrow repair is needed; this maintainer-owned PR needs normal exact-head validation rather than an automated fix lane.
Agent review details

Security

None.

PR surface

Source 0, Tests +26. Total +26 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 36 36 0
Tests 1 29 3 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 65 39 +26

Review metrics

Metric Value Why it matters
Production versus test delta production +36/-36 (net 0); tests +29/-3 (net +26) The production change is a net-neutral export-kind conversion, while the added test covers the preserved runtime boundary.

Technical review

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

Labels

Label changes:

  • add P3: This is a small internal import-boundary refactor with no claimed user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-owned, behavior-neutral configuration refactor does not require external contributor proof; its changed owner is the configuration barrel, and the added Vitest scenario fresh-imports that barrel with a type-only module probe.

Label justifications:

  • P3: This is a small internal import-boundary refactor with no claimed user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-owned, behavior-neutral configuration refactor does not require external contributor proof; its changed owner is the configuration barrel, and the added Vitest scenario fresh-imports that barrel with a type-only module probe.

Evidence

What I checked:

  • Introduced runtime boundary: The PR converts the type-only barrel entries to export type * while leaving the three runtime-owning modules as value re-exports. (src/config/types.ts:3, 7330b8a587bb)
  • Runtime-export audit: A scan of every converted module finds exported runtime declarations only in types.models.ts, types.secrets.ts, and types.tools.ts, all of which remain value exports. (src/config/types.ts:23, 7330b8a587bb)
  • Public config facade caller: The public config facade re-exports this barrel, so retaining the three value modules preserves its runtime helper surface while the other entries remain type-visible only. (src/config/config.ts:82, 7330b8a587bb)
  • Regression coverage: The new test fresh-imports the barrel with a mocked type-only channel module and compares the resulting runtime surface with the three retained owner modules. (src/config/validation.cold-imports.test.ts:11, 7330b8a587bb)
  • Current-main necessity: Fetched current main still uses ordinary value re-exports for the same type-only entries, so the central refactor is not already implemented. (src/config/types.ts:13, 94f6cebc617a)
  • Feature-history routing: History identifies Vincent Koc’s earlier config cold-import validation work; earlier file contents could not be fetched from the promisor remote, so this is routing context rather than an introduction claim. (src/config/validation.cold-imports.test.ts:36, 22044af066e7)

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 557b301 into main Aug 30, 2026
426 of 428 checks passed
@steipete
steipete deleted the codex/130706-config-type-barrel branch August 30, 2026 23:52
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant