Skip to content

test(config): pin the accepted configuration surface - #373

Merged
liuedcson merged 1 commit into
mainfrom
test/config-surface-guard
Nov 27, 2026
Merged

liuedcson merged 1 commit into
mainfrom
test/config-surface-guard

Conversation

@liuedcson

Copy link
Copy Markdown
Collaborator

What

Three tests that pin the accepted configuration surface, so a field cannot
disappear from the schema by accident.

Why

check:config-schema compares the generated files against the definitions they
are generated from. That catches a schema that was forgotten, but not a field
that was deleted: the schema is rendered from the same TypeBox objects, so
removing a field there removes it from the schema in the same commit and the
check still passes.

That gap has already cost something. Replacing model-config.ts while syncing a
branch that carries extra fields silently dropped one of them, and the only
thing that noticed was a person reading the generated diff.

What the guards check

  • models.json field lists. provider, model and modelOverride are
    written down independently of the schema and compared against what the
    generated schema contains.
  • Hand-written interfaces. StepMcpServerConfig is declared next to the
    loader, not derived from the schema. Every field it declares has to exist in
    the schema, or the editor rejects a server the loader accepts.
  • Named reads. readGlobalStepDefaults, the search tool and MCP discovery
    read the config document by name rather than through the settings schema.
    Every document.<key> a loader reads has to be a top-level key.

Each guard was verified by deleting a field and confirming the test fails:
removing samplingParams reports
expected [...9] to deeply equal [...10].

Scope

The lists describe what this build accepts. A branch with extra fields extends
its own lists, which is the point: a sync that drops one of those fields fails
in the branch that owns it, not after it lands.

Validation

  • pnpm run check passes.
  • ./test.sh passes: 5675 passed / 59 skipped in packages/coding-agent, 762 in
    apps/cli, no failures in any package.

The schema is generated from the TypeBox definitions, so deleting a field
there removes it from the schema in the same commit and
`check:config-schema` still passes. That makes an accidental removal look
like an intentional one: replacing `model-config.ts` during a branch sync once
dropped a branch-specific field, and nothing failed until the generated schema
was compared by hand.

Three guards, each verified by deleting a field and watching it fail:

- the field lists for `provider`, `model` and `modelOverride` in
  `models.json` are written down independently of the schema;
- the hand-written `StepMcpServerConfig` interface may not declare a field the
  schema lacks;
- every top-level key a loader reads through `document.` has to be in the
  schema.

The lists describe what this build accepts. A branch that adds a field extends
them there, so a sync that drops the field fails in the branch that owns it
rather than here.
@liuedcson
liuedcson merged commit a89ef72 into main Nov 27, 2026
2 checks passed
@liuedcson
liuedcson deleted the test/config-surface-guard branch November 27, 2026 03:17
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