Skip to content

Define actionable diagnostic expectations - #5

Merged
konojunya merged 1 commit into
mainfrom
jj/actionable-diagnostic-contract
Sep 3, 2026
Merged

Define actionable diagnostic expectations#5
konojunya merged 1 commit into
mainfrom
jj/actionable-diagnostic-contract

Conversation

@konojunya

Copy link
Copy Markdown
Member

背景

Stack consumers need portable diagnostics to explain valid replacements without duplicating compiler semantics in each UI. The existing interchange contract carries location and prose but no structured expected values.

実装方法

  • Require an ordered expected array in portable diagnostics, using an empty array when no useful candidate exists.
  • Define deterministic closed-set and identifier-suggestion ordering and matching rules.
  • Allow conformance fixtures to opt into exact expected assertions.
  • Add canonical cases for an unknown layout direction, a near unknown endpoint, unexpected diagram syntax, and a diagnostic with no candidate.

テスト方法

  • uvx --from check-jsonschema==0.38.0 check-jsonschema --check-metaschema schemas/*.json
  • find conformance -name expected.diagnostics.json -print0 | xargs -0 uvx --from check-jsonschema==0.38.0 check-jsonschema --schemafile schemas/diagnostic-expectations.schema.json
  • uvx --from check-jsonschema==0.38.0 check-jsonschema --schemafile schemas/normalized-ir.schema.json conformance/valid/*/expected.ir.json conformance/formatter/*/expected.ir.json
  • python scripts/validate-compiler-diagnostics.py
  • python scripts/validate-formatter-fixtures.py

Review 視点 / 懸念点

The required field changes the draft portable diagnostic shape. Human-readable message, help, and related wording remain outside compatibility; only fixtures that include expected require exact values and ordering.

@konojunya
konojunya merged commit 7f9154d into main Sep 3, 2026
1 check passed
@konojunya
konojunya deleted the jj/actionable-diagnostic-contract branch September 3, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant