|
| 1 | +--- |
| 2 | +'@objectstack/spec': minor |
| 3 | +--- |
| 4 | + |
| 5 | +fix(spec): the published type `ViewMetadata` names a `view` body instead of being `unknown` (#19871) |
| 6 | + |
| 7 | +Clause-②: no (narrowing) |
| 8 | + |
| 9 | +**BREAKING for TypeScript code that annotates with `ViewMetadata`**: a narrowing of a published |
| 10 | +TYPE, landing in the launch window as `minor` (the lockstep convention: the bump level is not the |
| 11 | +carrier, this banner and the disposition below are). The runtime accept set does not move at all: |
| 12 | +`ViewMetadataSchema` is unchanged, and a 44-body parse probe answers byte-identically before and |
| 13 | +after. |
| 14 | + |
| 15 | +`ViewMetadata` was declared as `z.input<typeof ViewMetadataSchema>`. That schema is a |
| 16 | +`z.preprocess`, whose input type is `unknown`, so the name documented as "any persisted view |
| 17 | +metadata body: container | ViewItem record | flattened overlay" type-checked any value at all, |
| 18 | +including bodies the schema refuses. It is now the union of the input types of |
| 19 | +`VIEW_METADATA_MEMBERS`, the four members the schema's union runs, so `unknown`, a non-object and a |
| 20 | +key no member declares are compile errors, and a body of each member still type-checks. |
| 21 | + |
| 22 | +**What still differs from the runtime verdict.** The type is the members' declared shape, not the |
| 23 | +door's answer. The door still accepts bodies the type refuses (it removes the console's row `id`s |
| 24 | +and three members strip undeclared keys), and still refuses bodies the type admits (the identity |
| 25 | +precondition, the members' refinements, and a body mixing keys of different members, which |
| 26 | +TypeScript checks against the union as a whole). `ViewMetadataSchema.safeParse` remains the only |
| 27 | +judge. |
| 28 | + |
| 29 | +**If your code stops compiling.** A value you annotated as `ViewMetadata` is not one of the four |
| 30 | +member shapes. Correct the body, or type a value that is still unvalidated as `unknown` and let |
| 31 | +`ViewMetadataSchema.safeParse` decide. |
| 32 | + |
| 33 | +`ViewMetadataParsed` is not changed by this release: it is still `unknown`. |
| 34 | + |
| 35 | +<!-- adr-0087: not-required (no-migration-prescription) Nothing authorable is removed, renamed or re-typed at runtime: no spec key, no export, no stored row moves, and every view body parses byte-identically, so `objectstack migrate meta` has nothing to reach. The only thing that moved is a TypeScript annotation, whose channel is the consumer's compiler. `type-surface-only` does not apply because this diff touches `packages/spec/**` (its predicate 2). --> |
0 commit comments