Skip to content

feat(contract): v1 envelope and kind schemas, OpenAPI document, conformance kit (AFDEV-9) - #1

Merged
foae merged 2 commits into
mainfrom
feat/AFDEV-9-contract
Sep 28, 2026
Merged

foae merged 2 commits into
mainfrom
feat/AFDEV-9-contract

Conversation

@foae

@foae foae commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

What

The v1 contract as repository files, before any Go code reads them:

  • schemas/envelope.v1.json, schemas/kinds/friction.v1.json, schemas/kinds/review.v1.json: JSON Schema 2020-12 with the custom x- keywords (x-max-bytes, x-trim, x-normalize, x-recommended, x-unique-by, x-on-violation).
  • docs/openapi.yaml: OpenAPI 3.1.1 for every v1 route, both auth schemes, the error and warning shapes; response types $ref the schema files.
  • conformance/: the executable contract. 19 decode fixtures (one per inference rule), 29 interaction fixtures, 23 canonical-JSON/content_hash vectors, the closed warning list, and a standard-library Python reference implementation of the write path that every fixture is checked against. README.md inside documents the format and comparison rules.
  • scripts/contract-check.py (PEP 723 deps, uv run --locked --script): validates the schemas against the 2020-12 metaschema, lints the x- keywords, validates every example in the schemas and the OpenAPI document, and runs the fixtures through the reference. @redocly/cli lints the OpenAPI document.
  • New Go-free CI job contract; just contract; docs/develop.md Layout, Commands, rules and Verification; .gitattributes keeps fixture bytes exact.

Notes for review

  • Fixtures are hand-authored from the contract and then checked against the reference; they were not generated from it. Disagreements were settled by reading the contract.
  • The contract describes the API of the next major release. The running service still implements docs/api.md; that document is rewritten in a later change.
  • identity/, export/ and import/ fixture sets are a follow-up.
  • Gates run locally: just check, race tests, e2e 55/55, shellcheck, skill tests 124/124, just contract.

…rmance kit (AFDEV-9)

JSON Schema 2020-12 files for the submission envelope and the friction and
review kinds; an OpenAPI 3.1.1 document for every v1 route; a conformance
kit (decode fixtures, hash vectors, warning list) with a standard-library
Python reference implementation that CI checks every fixture against; a
Go-free CI job, `just contract`, and the develop.md entries.
… relocation, public write-path rules (AFDEV-9)

A body nested deeper than 512 levels is rejected; schema_version spellings longer than 16 digits default without conversion; the RFC 3339 parser takes ASCII digits only, matches the whole string and keeps four-digit years; warnings follow content that inference moved, collapse onto coerced members and are dropped with discarded duplicates; the envelope schema states the schema_version maximum and no longer constrains context.git_dirty; kind schemas may use format: date-time and the guide checks every keyword at load. conformance/README.md now states the write-path rules, and manifest.json lists every fixture. The contract check validates examples under components.responses, discovers schema files, compares keyword_codes and the /meta limits with the reference. OpenAPI: create example without processing fields, byte limits as x-max-bytes, import warnings, MCP 202 and event-stream responses, Cache-Control on errors.
@foae
foae merged commit d5f0e45 into main Sep 28, 2026
4 checks passed
@foae
foae deleted the feat/AFDEV-9-contract branch September 28, 2026 10:54
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