Skip to content

[codex] Normalize mode configuration - #29

Merged
k-kinzal merged 2 commits into
mainfrom
codex/normalize-mode-config
Jul 4, 2026
Merged

[codex] Normalize mode configuration#29
k-kinzal merged 2 commits into
mainfrom
codex/normalize-mode-config

Conversation

@k-kinzal

@k-kinzal k-kinzal commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What changed

  • Converted Mode from a string parser into a normalized value object while keeping Mode::FAKE, Mode::RECORD, and Mode::REPLAY constants for existing withMode(Mode::RECORD) usage.
  • Updated Server, Interceptor, and ServerRegistry so they store and branch on Mode instances rather than raw strings.
  • Kept string input at API boundaries (withMode() and Interceptor::__construct()), but normalize immediately and reject invalid values at the boundary.
  • Updated tests, docs, and the VCR recording example for Mode::fromString()->value().

Why

The previous design allowed fluent mode values to bypass Mode::fromString(), so values like Record or invalid strings could sit inside the server until runtime. This moves normalization into the type used by the runtime pipeline so the invalid state is not representable internally.

Impact

Mode constants remain strings for configuration convenience. Parser methods now return Mode instances; callers that need the string value should use value().

Validation

  • composer test
  • composer lint

@k-kinzal
k-kinzal marked this pull request as ready for review July 4, 2026 13:18
@k-kinzal
k-kinzal merged commit e152d1b into main Jul 4, 2026
57 checks passed
@k-kinzal
k-kinzal deleted the codex/normalize-mode-config branch July 4, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant