Skip to content

fix(config): statically register built-in engine settings schemas at module init#983

Merged
zbigniewsobiecki merged 1 commit intodevfrom
fix/engine-settings-static-registration
Mar 23, 2026
Merged

fix(config): statically register built-in engine settings schemas at module init#983
zbigniewsobiecki merged 1 commit intodevfrom
fix/engine-settings-static-registration

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Root cause: EngineSettingsSchema validated engine settings against a runtime registry (ENGINE_SETTINGS_SCHEMAS Map) that was only populated when registerBuiltInEngines() was called at startup. The router was missing that call before loadConfig() ran during verifyTrelloWebhookSignature, so the map was empty and all claude-code engine settings were rejected with ZodError: Unsupported engine settings for "claude-code".
  • Fix: Pre-register the three built-in schemas (claude-code, codex, opencode) statically in engineSettings.ts at module initialization. Any process that imports EngineSettingsSchema now has the schemas available automatically — no explicit registerBuiltInEngines() call required for config validation.
  • Regression tests: Added claude-code engine settings acceptance tests in both ProjectConfigSchema and validateConfig describe blocks. These tests would fail if the static registration were accidentally removed.

Details

The existing registerBuiltInEngines() calls at entry points (router, dashboard, worker) are still needed for runtime engine dispatch (registerEngine()) and are now idempotently harmless for schema registration — Map.set() with the same key just overwrites.

The PR #899 fix (adding registerBuiltInEngines() to src/router/index.ts) stops the immediate production error. This PR makes the fix structural: schema validation can never silently break again due to a missing bootstrap call.

Test plan

  • npm test — all 6292 unit tests pass
  • npm run typecheck — no errors
  • npm run lint — no warnings
  • New tests cover claude-code engine settings in ProjectConfigSchema and validateConfig
  • Existing codex and opencode tests continue to pass (now also validated without registerBuiltInEngines() dependency)

🤖 Generated with Claude Code

…module init

Fixes a ZodError ("Unsupported engine settings for claude-code") that
occurred in the router when loadConfig() ran before registerBuiltInEngines()
was called. The engine settings registry was empty at validation time because
it relied entirely on a bootstrap call that some entry points were missing.

Pre-register the three built-in schemas (claude-code, codex, opencode) in
engineSettings.ts at module initialization. Any process that imports
EngineSettingsSchema now has the schemas available automatically — no
explicit registerBuiltInEngines() call is required for config validation.

The existing registerBuiltInEngines() calls are still needed for runtime
engine dispatch (registerEngine()) and are now harmlessly idempotent for
schema registration.

Adds regression tests for claude-code engine settings acceptance in both
ProjectConfigSchema and validateConfig to prevent silent regressions if
the static registration is accidentally removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit e44b0d5 into dev Mar 23, 2026
8 checks passed
@zbigniewsobiecki zbigniewsobiecki deleted the fix/engine-settings-static-registration branch March 23, 2026 11:20
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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