Skip to content

[finding] reference-doc tables render .default()-bearing fields as required (✅) for every output-shape def — authors read "must write" where the schema means "may omit" #8703

Description

@os-zhuang

Observation-class, found while landing #8586 (PR #8702) — filed, not fixed there (out of scope).

What

packages/spec/scripts/build-schemas.ts emits each def's JSON Schema as the output (post-parse) shape by default, falling back to the input shape only when output emission throws (transforms etc.). In the output shape a .default()-bearing field is required (the parse always produces it), so build-docs.ts renders it with ✅ in the reference table's Required column — but an author may omit it, which is exactly what the reference table's Required column is read as answering.

Measured

  • The additionalTypes on MetadataPluginConfig is authorable, documented as THE way a plugin declares a metadata type, and has no reader — a plugin cannot declare a kind at all #8586 retirement flipped kernel/MetadataPluginConfig from input-shape fallback to output-shape emission (the old additionalTypes value schema embedded ActionSchema, whose output emission throws). The regenerated content/docs/references/kernel/metadata-plugin.mdx now shows enableEvents / validateOnWrite / enableVersioning / cacheMaxItems / bootstrap — all .default()-bearing, all author-omittable — as ✅ required. Before the flip the same fields rendered optional (input shape).
  • gen:schema reports Generated: 1589 (125 as input shape) — so ~1464 defs render the output shape, and every .default() field in them carries the same misleading ✅. Only the 125 input-shape defs (flagged x-io: input) show author-time optionality.

Why it matters

The reference tables are the author-facing contract (very often read by an AI author, ADR-0033). "Required" on a field the author may omit teaches over-specification at best; at worst an author treats a wall of ✅ as boilerplate and misses the genuinely-required fields among them. The two emission modes also make sibling pages inconsistent with each other, and a schema refactor can silently flip a page's whole Required column (as #8702's diff shows) without any semantic change to what authors must write.

Possible directions (not adjudicated here)

  • render doc tables from the input shape uniformly (authors write input), keeping output emission for the JSON-Schema artifacts that validate post-parse data; or
  • keep output emission but render .default()-bearing members as optional (default: …) in the table.

Relates to: #8586 / PR #8702 (where the flip was observed and explained), #7658 (a different build-docs rendering gap, closed).


Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions