3.0 KiB
3.0 KiB
AST Diagnostics, Recovery, and Gate Evidence Decision
Status: Accepted
Date: 2026-03-05
Related Agenda: docs/pbs/agendas/11.4. AST Workshop 4 - Diagnostics, Recovery, and Gate Evidence.md
Context
After closing AST contract, declaration surfaces, and statement/expression surfaces, PBS needed to close AST-facing diagnostics and parser-recovery policy plus the minimum Gate U evidence baseline.
Additionally, localization policy needed explicit alignment: diagnostics wording is locale-dependent and should be keyed by stable message tokens/template ids.
Decision
PBS adopts the following AST diagnostics/recovery/evidence policy:
- AST must preserve diagnostic fidelity:
- required syntax diagnostics remain stable in
code,severity,phase,primary file, andprimary span.
- required syntax diagnostics remain stable in
- Human-readable message text is locale/rendering-dependent and not a conformance identity key.
- Stable diagnostics identity for i18n is carried by:
diagnostic code,phase,message template id(token),- and primary attribution.
- Parser recovery is allowed to continue diagnostics, but recovered AST must remain structurally coherent and attribution-consistent.
- Recovery must not fabricate permissive valid shapes that hide real syntax failures.
- Gate U AST evidence must include:
- representative valid AST fixtures,
- malformed/recovery fixtures,
- deterministic diagnostics assertions,
- and attribution assertions (
file/start/end) on required nodes.
- Minimum mandatory negative fixture families include:
- unexpected token in declaration context,
- missing required closer (
),}, or;) as applicable, - non-associative forbidden chain forms,
- unsupported form outside the active syntax slice with deterministic rejection.
Invariants
- Diagnostics identity is token-based and locale-agnostic.
- Recovery cannot downgrade a required rejection into accepted semantics.
- AST attribution quality remains sufficient for
12diagnostics contract and13lowering preconditions. - Gate U fixtures must lock rejection stability for required AST-facing failures.
Explicit Non-Decisions
- This decision does not define transport-specific wire schemas.
- This decision does not define static type-checking rules.
- This decision does not define backend/runtime/verifier algorithms.
- This decision does not require one exact localized wording set.
Spec Impact
docs/pbs/specs/11. AST Specification.mdmust encode recovery integrity and AST-facing rejection/recovery invariants.docs/pbs/specs/12. Diagnostics Specification.mdremains authority for diagnostics identity fields, including template/token identity.docs/general/specs/13. Conformance Test Specification.mdprovides Gate U evidence obligations referenced here.
Validation Notes
Gate U validation should assert:
- stable diagnostic identity keys (
code,phase, template/token id, primary attribution), - recovery integrity without semantic masking,
- deterministic results for the mandatory negative fixture families above.