VALIDATION-PLANES-03: Constrain section order
What it demonstrates
Section titled “What it demonstrates”sections({order:‘strict’}) makes out-of-order headings a positioned structure/section-order finding.
Builds on: VALIDATION-PLANES-02: The smallest contract: one required section
How it’s done
Section titled “How it’s done”A TypeScript program against the library API; inline comments show the resulting values and behavior.
const c = contract({ body: sections({ order: "strict" }, [ section("Summary"), section("Details"),]) });c.validate("## Details\n\n## Summary\n", { path: "doc.md" }).findings;// [{ id: "structure/section-order", level: "error", pos: { line: 1 }, ... }]// (the finding pins at the out-of-order 'Details' heading on line 1)Surfaces exercised
Section titled “Surfaces exercised”sections() LevelOpts.order: 'strict' (src/core/grammar.ts)structure/section-order (src/core/structure.ts checkStrict)Finding.pos pinned at the out-of-order heading