Skip to content

docs: schema contracts guide + contract attribution on write-failure output#269

Merged
themightychris merged 2 commits into
developfrom
docs/contracts
Jul 18, 2026
Merged

docs: schema contracts guide + contract attribution on write-failure output#269
themightychris merged 2 commits into
developfrom
docs/contracts

Conversation

@themightychris

Copy link
Copy Markdown
Member

What

Consumer-facing documentation for the schema-contracts feature that just landed (PRs #265/#267/#268) — the docs site had zero coverage.

  • New docs/contracts.md — the full tour: contract documents and naming, adopt + implements (producer side), composed write-time enforcement, the two-rung consumer verification ladder (openSheet({ contract })), canonicalContractHash, evolution patterns (additive multi-implements, breaking-change bridges), and housekeeping (sync/export/prune). Every command output is pasted from a live run against the built CLI in a scratch repo, not invented.
  • Touch-ups: docs/cli.md (gitsheets contracts command group + exit code 67), docs/api.md (module surface, openSheet contract option, ContractError row, canonicalContractHash utility), docs/concepts.md (Contract entry), mkdocs.yml nav.

Plus one small fix the live run surfaced

fix(cli): the write-failure printer dropped the contract attribution the core provides — an upsert rejected by a contract looked identical to one rejected by the local schema, contradicting the spec's "a failing write says which obligation it violated." Issue lines now append [<contract-name>] when present (the ContractError printer already did this; ValidationError's didn't).

Verified: npm test -w gitsheets 388/388, type-check clean, live CLI run confirms the tag renders.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KJCxogamrSUZ7etFGsnoD1

themightychris and others added 2 commits July 18, 2026 18:51
New docs/contracts.md — the full producer→consumer tour (declare + adopt,
composed enforcement, the two-rung verification ladder, evolution patterns,
housekeeping), with every command output pasted from a live run against the
shipped CLI. Touch-ups: cli.md command group + exit 67, api.md surface/errors/
canonicalContractHash, concepts.md Contract entry, mkdocs nav.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJCxogamrSUZ7etFGsnoD1
The core tags a failing allOf branch with its contract name
(specs/behaviors/contracts.md "a failing write says which obligation it
violated") and the ContractError printer already rendered it, but the
ValidationError printer dropped it — an upsert rejected by a contract looked
identical to one rejected by the local schema. Append the [contract-name] tag
when present; verified live against a declaring sheet.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KJCxogamrSUZ7etFGsnoD1
@themightychris
themightychris merged commit 6fc2f66 into develop Jul 18, 2026
2 checks passed
@themightychris
themightychris deleted the docs/contracts branch July 18, 2026 22:53
@themightychris themightychris mentioned this pull request Jul 18, 2026
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