Skip to content

docs: specify calc evidence contracts and freeze its hash layouts (#211) - #226

Draft
shunsuke-shimomura wants to merge 3 commits into
mainfrom
docs/211-calc-evidence
Draft

shunsuke-shimomura wants to merge 3 commits into
mainfrom
docs/211-calc-evidence

Conversation

@shunsuke-shimomura

Copy link
Copy Markdown
Member

Description

Closes #211 (parent: #40).

  • Design document docs/{en,ja}/design/calc-evidence.md: responsibility boundary (producer adapter → capsula → inka, offline, Rust never parses Python), the evidence JSON, assumptions declared in producer node metadata (metadata={"inka": {"assumes": [...]}}) and unioned over the definition-level upstream subgraph, the interface hash preimage, the filled bind assumption slot, assumptions as implicit dependencies, load-time structure with check errors (unknown assumption ID, cycle through assumption edges), the pass condition (all leaves true ∧ valid ∧ ¬xfail), approval snapshots at approvals/snapshots/<view_hash>.json and the assumption-set diff, capsula delivery, and bind evaluation tables in the style of test-evidence.md.
  • Wire format schemas/calc-evidence-v1.schema.json: per target path, definitions[{path, kind, source}], assumes[] (fully-qualified inka IDs), leaves[{id, result}], valid, xfail; file-level provenance as for test evidence.
  • Spec updates (en/ja): veriq: → calc: in spec.md and formatting.md; calc: references are producer paths (veriq: Scope::?name); [evidence] tests / calcs in inka.toml; the bind hash's assumption slot holds the assumed nodes' normalized descriptions sorted bytewise; established for a bind additionally requires every assumed node established; blame gains "unestablished assumption"; a "Calc evidence provider" section. full-plan.md item 7 rewritten (no AST normalization; the argument is the registry). The open question "veriq contract-hash scope" is removed as settled, and the graphcal item now points at calc evidence.
  • Golden vectors: tests/golden/hash/calc-evidence-v1/ (minimal, upstream-sorted, CRLF-only normalization, non-ASCII) and tests/golden/hash/v1/bind-assumptions.toml (a bind with a non-empty assumption slot, listed unsorted and un-normalized). Existing vectors are untouched.
  • inka-core (minimal, so the vectors are replayed): new calc_evidence::interface_hash(target, definitions, leaf_ids) under domain tag inka:calc-evidence:v1; LocalView::bind takes the assumptions, normalizes and sorts them into the slot. LocalView::of_node and the two existing callers pass an empty slot, so no runtime behaviour changes; the wiring is calc evidence: load-time consumption, interface hash and assumption edges in check #208/calc evidence: evaluate calc binds and fill the bind hash's assumption slot #209.

Confirmed design decisions are listed in #211; this PR is where they become the source of truth.

Test results

  • cargo test -p inka-core: all pass, including the new calc_evidence replay test and the extended golden test (every_recorded_vector_still_hashes_to_its_recorded_value now also replays bind-assumptions.toml).
  • cargo test --workspace: all pass except inka-evidence-rust/tests/adapter.rs, which requires cargo-nextest and is not installed in my environment (fails with "these tests need cargo-nextest"); unrelated to this change.
  • Both new vector families were recomputed independently in Python from the documented preimage (field/list/entries framing) and match the recorded digests.
  • The schema was checked with jsonschema (Draft 2020-12): the documentation example validates; empty definitions, an assumption ID with whitespace, duplicate assumes, a missing valid and v: 2 are rejected.
  • cargo fmt --check, cargo clippy --workspace --all-targets: clean. prek (typos, markdownlint-cli2, tombi, json/toml checks) passes on the changed files.

Impact

Supplementary information

🤖 Generated with Claude Code

shunsuke-shimomura and others added 3 commits November 10, 2026 12:18
Add the calc evidence design document (en/ja) and the calc-evidence-v1
JSON Schema, rename the `veriq:` bind property to `calc:` across the
specs, describe the filled assumption slot and the implicit assumption
dependency, and record the settled open question.

Freeze the layouts with golden vectors: the calc-evidence interface hash
(new `tests/golden/hash/calc-evidence-v1/`) and a bind view hash with a
non-empty assumption slot. inka-core gains the minimal code that replays
them: `calc_evidence::interface_hash` and the assumption parameter on
`LocalView::bind`. Callers still pass an empty slot; wiring the evidence
in is #208/#209.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…d-only

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… and input errors

- `kind` is veriq's three node kinds; the contract is veriq-shaped, not producer-neutral
- a rename leaves the assumption slot alone but changes a veriq source that names the ID
- `@vq.assume` targets are upstream: their sources and assumptions enter the dependent target
- list the input errors, and pin "whitespace" to Unicode White_Space in the doc and the schema
- a test bind's assumption list is empty, not "currently" empty
@shunsuke-shimomura

Copy link
Copy Markdown
Member Author

Review follow-up (2026-11-10)

Rebased onto main (8708eba) and force-pushed. One commit was added on top of the original two.

1d4e228 — docs: say what the calc contract really promises about kinds, renames and input errors

  • kind is a required enum of veriq's three node kinds. The contract is veriq-shaped rather than producer-neutral, and the document now says so.
  • Renaming an assumed node leaves the bind hash's assumption slot alone (descriptions only, no IDs), but it does change a veriq source that names the ID, so the interface hash moves.
  • @vq.assume targets are upstream: their sources and assumptions enter the dependent target. This is intended, and is now stated.
  • The input errors are listed, and "whitespace" is pinned to Unicode White_Space in both the document and the schema.
  • A test bind's assumption list is empty, not "currently" empty.

Nothing from the review is left open on this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation 📓 Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calc evidence: design document, spec changes and wire format

1 participant