# iter drift-test-narrowing — design_schema_drift.rs scans §"Data model" only

**Date:** 2026-05-13
**Started from:** rustdoc-sweep working-tree state
**Status:** DONE

## Summary

`crates/ailang-core/tests/design_schema_drift.rs` is the
drift-detection layer between AST enum definitions in
`crates/ailang-core/src/ast.rs` and the canonical schema
documentation in `docs/DESIGN.md` §"Data model". Each AST variant
must have its JSON-schema anchor (e.g. `"t": "lit"`, `"k": "fn"`)
documented; the tests assert presence of each anchor.

Pre-iter, the assertion was `DESIGN_MD.contains(anchor)` —
substring search over the whole document. That was loose: an
anchor present only in §"Decision 11" (or any other discussion
section) was treated as documented even though §"Data model" —
the canonical schema reference section — was missing it. The
audit-form-a-precursor `[high]` drift report flagged this as the
silent-pass failure mode.

This iter narrows the scan. New helper `data_model_section()`
extracts the slice of `DESIGN_MD` from the `## Data model` header
to the next top-level `## ` header. The 7 existing anchor tests
now call `data_model_section().contains(anchor)` instead of
`DESIGN_MD.contains(anchor)`. All 38 anchors verified present in
§"Data model" pre-edit (no regressions). A new test
`data_model_section_is_bounded` pins the extractor itself
(starts-with `## Data model`, does not bleed past `\n## Pipeline`,
length > 1 KB) so a future refactor cannot silently regress the
extractor to whole-document scanning.

## Files touched

- `crates/ailang-core/tests/design_schema_drift.rs` (M)

## Verification

- `cargo test -p ailang-core --test design_schema_drift` →
  8 passed (was 7; +1 for the bounded-section pin), 0 failed.
- `cargo test --workspace` → 563 passed (was 562; +1 from the
  new pin), 0 failed.

## Concerns

- (none)

## Known debt

- (none)
