Area
Multiple areas
What are you trying to accomplish?
Make provider configuration validation a small, reusable boundary shared by persisted config loading, provider CLI writes, and management API payload validation, without changing any accepted configuration or runtime behavior.
What prevents this today?
The pure provider validation helpers currently live inside the broad src/config.ts persistence module. Callers that need only one validation rule therefore import config storage, schema, migration, and filesystem dependencies as well. That obscures the single validation owner and makes isolated characterization difficult.
What should OpenCodex do?
- Move the pure provider payload helpers into
src/config/provider-validation.ts.
- Keep
src/config.ts as a compatibility facade that re-exports the existing public symbols.
- Let direct CLI and management callers import the leaf module when they need only validation.
- Preserve validation order, exact error strings, accepted and rejected shapes, Zod issue paths, canonical ChatGPT forward-provider restrictions, and wire-pinned model restrictions.
- Record the ownership boundary and rationale in
structure/02_config-and-codex-home.md.
Example usage or interface
import { providerBaseUrlConfigError } from "./config/provider-validation";
The refactor must remain behavior-preserving: existing imports from src/config.ts continue to work, and management requests and hand-edited config.json continue to accept and reject the same values with the same messages.
Acceptance criteria:
- Characterization tests cover every extracted helper, including inherited-property objects, sensitive headers, line breaks, contradictory reasoning-summary flags, canonical-forward overrides, and wire-pinned models.
- Focused config/management tests, strict typecheck, and the full Bun suite are evaluated on the exact PR head.
- No persisted schema, defaults, provider behavior, GUI text, or management response shape changes.
- There is one validation implementation; the compatibility facade does not duplicate it.
Alternatives or workarounds
- Keep the helpers in
src/config.ts: lowest churn, but preserves the broad dependency and unclear ownership.
- Duplicate validation in each caller: rejected because disk config and management writes could drift.
- Extract one shared leaf with compatibility re-exports: preferred because callers can migrate incrementally while preserving the public API.
Additional context
[Decision Log]
- Purpose: separate reusable provider validation from config persistence without changing behavior.
- Existing constraints: persisted config and management DTOs must reject the same payloads with the same messages.
- Chosen approach: one pure leaf module plus
src/config.ts facade re-exports and focused characterization tests.
- Tradeoff: the facade remains temporarily, but it avoids a flag-day import rewrite and keeps downstream compatibility.
This is a Bun-native TypeScript ownership change on the current dev runtime line. The retired dev2-go line has no integration obligation.
Checks
Area
Multiple areas
What are you trying to accomplish?
Make provider configuration validation a small, reusable boundary shared by persisted config loading, provider CLI writes, and management API payload validation, without changing any accepted configuration or runtime behavior.
What prevents this today?
The pure provider validation helpers currently live inside the broad
src/config.tspersistence module. Callers that need only one validation rule therefore import config storage, schema, migration, and filesystem dependencies as well. That obscures the single validation owner and makes isolated characterization difficult.What should OpenCodex do?
src/config/provider-validation.ts.src/config.tsas a compatibility facade that re-exports the existing public symbols.structure/02_config-and-codex-home.md.Example usage or interface
The refactor must remain behavior-preserving: existing imports from
src/config.tscontinue to work, and management requests and hand-editedconfig.jsoncontinue to accept and reject the same values with the same messages.Acceptance criteria:
Alternatives or workarounds
src/config.ts: lowest churn, but preserves the broad dependency and unclear ownership.Additional context
[Decision Log]
src/config.tsfacade re-exports and focused characterization tests.This is a Bun-native TypeScript ownership change on the current
devruntime line. The retireddev2-goline has no integration obligation.Checks