Skip to content

Commit 02fd466

Browse files
committed
docs(changeset): enumerate the three newly-refused shapes the contract review named (#11984)
The isolated contract reviewer (comment 5507350669 §4) and the director's reconciliation adopt as required prose three refusals the changeset left under its generic "wrong type" bullet: an explicit `null` at a declared key (the cast-era `??` chain read it as absent and defaulted it; zod's `.default()` fills `undefined` only), a `crud.patterns` entry missing its required `path`, and a sub-object that is not an object at all. Every bullet is a measurement, not a transcription: a throwaway driver constructed the REAL `RestServer` with each shape and the refusal text quoted here is what it printed, with an empty config as the discriminating control (the driver is not committed). The partial-`operations` bullet and the Migration sentence now cite #14365, so the later `z.partialRecord` widening is traceable from the refusal it reverses. Changeset prose only — no source, test or other file changed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WXyGTWPbbreqXow7Z2pZCk
1 parent 741d9c2 commit 02fd466

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

.changeset/rest-sub-configs-parsed-not-cast.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,28 @@ schema** (a construction-time refusal, not an HTTP envelope):
3333
- A declared key of any of the four written with the wrong type:
3434
`crud.dataPrefix: 42`, `metadata.enableCache: 'yes'`,
3535
`routes.includeObjects: 'account'`, `batch.defaultAtomic: 'yes'`, ...
36+
- An explicit **`null`** at any declared key of the four —
37+
`batch: { maxBatchSize: null }`, `metadata: { cacheTtl: null }`,
38+
`crud: { dataPrefix: null }`. The cast-era `??` chain read `null` as absent
39+
and applied the default; the parse refuses it (`batch.maxBatchSize: Invalid
40+
input: expected number, received null`), because zod's `.default()` fills
41+
`undefined` only.
42+
- A sub-object that is not an object at all — `batch: 'x'`, `routes: []`
43+
refused at the sub-object root (`batch.(root): Invalid input: expected
44+
object, received string`), where the cast admitted it unchanged and every key
45+
read came back `undefined`, so every key silently took its default.
3646
- `crud.patterns` keyed by an operation outside the CRUD vocabulary
3747
(`patterns: { bogus: {...} }`), or a pattern whose `method` is not an HTTP
38-
method — `patterns` is an enum-keyed `z.record`, which zod validates key by key.
48+
method, or a pattern missing its required `path``patterns` is an
49+
enum-keyed `z.record`, which zod validates key by key, and
50+
`CrudEndpointPatternSchema.path` is a plain `z.string()`.
3951
- A **partial** `routes.overrides.<object>.operations`. That record is
4052
`z.record(CrudOperation, z.boolean())` with a non-optional value, which zod 4
4153
reads as exhaustive: all five operations must be present. The input TYPE
4254
already demanded all five at typed authoring sites; this is the day the
43-
runtime agrees with `tsc`.
55+
runtime agrees with `tsc`. #14365 proposes `z.partialRecord` for this record;
56+
when that lands the refusal reverses, and the §A pin for it in
57+
`rest-sub-config-parse-not-cast.test.ts` is deleted with it.
4458

4559
**Deliberately NOT refused** — the narrowing is exactly what the schemas
4660
declare, and no more:
@@ -80,7 +94,7 @@ sub-object, the key, the declared rule and the schema that declares it. A
8094
deployment that meant "no batch cap" wants `enableBatchEndpoint: false` or
8195
`api.enableBatch: false` (the cap's range is the declared policy), and a
8296
partial `routes.overrides.<object>.operations` wants all five operations
83-
spelled out.
97+
spelled out (until #14365 lands).
8498

8599
**In-repo blast radius, measured per sub-object on `origin/main` @ `08e49496f`.**
86100
140 files construct a REST server (`new RestServer(` or

0 commit comments

Comments
 (0)