docs: ADR-0042 — continue H1a parse-error pedagogy on the grammar tree

ADR-0020/0021 specified a chumsky-based H1a; ADR-0024 replaced chumsky
with the scannerless walker, leaving both obsolete. Mark them superseded
(kept as institutional memory) and add ADR-0042, which restates H1a
against the architecture as built.

ADR-0042 records that H1a is substantially shipped already — per-command
usage block, available-commands fallback, source-derived ident slot
labels, curated parse.custom.* near-miss messages, and schema-aware
[ERR] diagnostics — and defines the remaining work: a verified
per-command near-miss matrix (the definition of done), friendlier
literal expectation labels that add role context while keeping the
exact literal visible, and advanced-mode SQL parse parity (RETURNING
scope, CROSS JOIN ON, INSERT…SELECT count), kept distinct from
ADR-0019 §OOS-2 engine-error sanitisation.

- docs/adr/0020,0021: superseded notes + README entries
- docs/adr/0042: new ADR
- docs/adr/README.md: index upkeep (ADR-0000 rule)
This commit is contained in:
claude@clouddev1
2026-06-03 14:05:09 +00:00
parent a8d0138d8b
commit 0e6f767848
4 changed files with 355 additions and 4 deletions
@@ -2,7 +2,37 @@
## Status
Accepted.
**Mechanism superseded by ADR-0024; H1a scope continued in ADR-0042.**
Accepted then superseded.
> **Superseding note (2026-06-03).** The *intent* of this ADR — surface
> the grammar of the command at the point of error, not just the next
> token — survived and is largely delivered. The *mechanism* did not.
> This ADR specifies a `chumsky`-based design: a separate `UsageEntry`
> registry in `src/dsl/usage.rs`, `parse.token.*` catalog keys driven
> by chumsky's `RichPattern<Token>` expected sets, and a renderer over
> chumsky output. ADR-0024 (unified grammar tree) replaced chumsky with
> a scannerless walker and **folded usage info onto the grammar nodes
> themselves**: `usage_ids` live on each `CommandNode`, the per-command
> `parse.usage.*` templates and the `parse.available_commands` fallback
> ship as designed here, and the expected-set vocabulary
> (`format_expectation` in `parser.rs`) renders directly from walker
> `Expectation` variants — no `UsageEntry` registry, no `parse.token.*`
> keys, no `src/dsl/usage.rs`.
>
> So: the §1 usage registry, §3 "deepest consumed keyword" mechanism,
> §4 `parse.token.*` catalog, and §7 validator details below describe
> code that does not exist. What shipped equivalently: §1's per-command
> templates (as `usage_ids` + `parse.usage.*`), §2's three-block render
> (echo+caret / structural error / usage), and §5's available-commands
> fallback. **ADR-0042 picks up H1a from here** — it records what is
> actually shipped and defines the remaining systematic-pass scope
> against the grammar-tree architecture. Read ADR-0042 for the live
> plan; this ADR remains as the design rationale for the pedagogy goal.
---
*Original status (historical):* Accepted.
Builds on ADR-0020 (tokenization layer). Addresses H1a from
`requirements.md` — the parse-error pedagogy gap that