Skip to content

Added compiler interchange contract and conformance suite - #1

Merged
konojunya merged 2 commits into
mainfrom
jj/add-conformance-contract
Sep 2, 2026
Merged

Added compiler interchange contract and conformance suite#1
konojunya merged 2 commits into
mainfrom
jj/add-conformance-contract

Conversation

@konojunya

@konojunya konojunya commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Background

stack-sh/specification needs to serve not only as the parser/AST implementation, but also as a source of truth to verify whether different compiler implementations can generate the same normalized IR and diagnostics. Duplicating fixtures in compiler repositories leads to drift from the specification, so the portable contract and canonical conformance suite will be managed on the specification side.

Implementation Details

  • Added JSON Schemas for normalized IR, diagnostics, and diagnostic expectations.
  • Defined the portable interchange contract, schema versioning, comparison rules, and runner requirements.
  • Added canonical fixtures to verify default normalization, all node/edge/layout semantics, and unknown endpoint diagnostics.
  • Added specification CI to validate the directory layout, meta-schemas, and fixture schemas.
  • Included schema validators and GitHub Actions updates in the scope for Dependabot.

Verification / Testing

  • uvx --from check-jsonschema==0.38.0 check-jsonschema --check-metaschema schemas/*.json
  • Verified valid fixtures' expected.ir.json against schemas/normalized-ir.schema.json
  • Verified valid/invalid fixtures' expected.diagnostics.json against schemas/diagnostic-expectations.schema.json
  • Parsed workflows and Dependabot YAML
  • Executed git diff --check

Review Points / Concerns

  • Making only the portable JSON contract normative while leaving the native compiler API unconstrained
  • Targeting the code, severity, and end-exclusive range for compatibility rather than the exact wording of diagnostic messages
  • Whether the policy of not silently ignoring unknown fields in schema major versions is appropriate
  • Compilers are expected to pin to this PR's commit when running the conformance suite. After the squash merge, the compiler-side pin will be updated to the final merge commit.

Standardize normalized IR and diagnostic JSON, add canonical valid and invalid fixtures, and validate the public suite in CI.
@konojunya konojunya changed the title Compiler interchange contract と conformance suite を追加 Added compiler interchange contract and conformance suite Sep 2, 2026
@konojunya
konojunya merged commit 8a720f0 into main Sep 2, 2026
1 check passed
@konojunya
konojunya deleted the jj/add-conformance-contract branch September 2, 2026 05:46
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