open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-cross-binding/conformance/README.md
Transaction Science 4fcec26999 jouleclaw: wave-53 — Go verifiers (third leg of three-impl pattern)
Completes the JCR-1 v1 three-impl conformance pattern (Rust +
Python + Go byte-equal) for all six new schemas landed since
wave-46. Each Go verifier is independent — no JouleClaw imports,
no JouleClaw-Rust crate links — just Go stdlib + lukechampine.com/
blake3 (the canonical Go BLAKE3 module).

Six Go verifiers shipped, paired with their Python siblings:

  jouleclaw-jcr1/conformance/go/
    go.mod                                   (lukechampine.com/blake3 v1.3.0)
    verify_verified_code/main.go             (verified-code/1)
    verify_stream_window/main.go             (stream-window/1)
    verify_ui_output/main.go                 (ui-output/1)
    verify_coding_window/main.go             (coding-window/1)

  jouleclaw-cross-binding/conformance/go/
    go.mod
    verify_cross_binding/main.go             (cross-binding/1)
    verify_streaming_trace_binding/main.go   (streaming-trace-binding/1)

Each main.go:
  - reads the embedded *-vectors.json,
  - recanonicalises every payload via a from-scratch orderedMap
    JSON encoder (recursive key sort, no whitespace, no float
    coercion),
  - BLAKE3-hashes the canonical bytes via lukechampine.com/blake3,
  - asserts byte-equal hex against the vector's embedded hash field.

All six PASS — Rust, Python, and Go produce byte-identical canonical
encodings + BLAKE3 hashes for every shipped vector. The standard is
now operational, not theoretical: a fourth implementation in any
language is conformant iff it reproduces these PASS results.

Cross-binding README updated to reflect the complete 3×2 conformance
matrix.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-06-05 11:42:34 -04:00

62 lines
2.3 KiB
Markdown

# cross-binding conformance
Test vectors + multi-language verifiers for the two JouleClaw
cross-standards binding schemas:
- **`cross-binding/1`** (`cross-binding-vectors.json`) — the
per-request binding across JouleClaw + Sandbox + Joule-Code,
five invariants (trace-id equality, joule agreement, worst-
counter provenance, trusted stewards, sandbox grants ⊆ cascade
authorisation).
- **`streaming-trace-binding/1`**
(`streaming-trace-binding-vectors.json`) — the multi-window
streaming generalisation, seven invariants (sandbox/binding
trace-id, per-window stream-id consistency, window-id
monotonicity, joule-sum within tolerance, worst-counter
provenance across windows + sandbox, session_op_id accounted by
a window seal, trusted stewards).
## Canonical encoding
Both schemas seal under the same JCR-1-shaped canonical encoding:
- JSON with object keys recursively sorted (alphabetical).
- UTF-8.
- No whitespace.
- No float coercion (all numbers are integers).
`content_hash` is BLAKE3 hex of the canonical bytes.
## Implementations
Three byte-equal implementations are intended (Rust + Python + Go,
following the JCR-1 v1 pattern):
| | Rust | Python | Go |
|---|---|---|---|
| `cross-binding/1` | ✓ (`jouleclaw-cross-binding`) | ✓ (`verify_cross_binding.py`) | ✓ (`go/verify_cross_binding/main.go`) |
| `streaming-trace-binding/1` | ✓ (`jouleclaw-cross-binding::streaming`) | ✓ (`verify_streaming_trace_binding.py`) | ✓ (`go/verify_streaming_trace_binding/main.go`) |
Three byte-equal implementations across Rust + Python + Go, the
JCR-1 v1 three-impl pattern. A standard is conformant if a fourth
implementation in any language reproduces these PASS results.
## Running
```
# Rust (via cargo test, runs as part of the workspace)
cargo test -p jouleclaw-cross-binding
# Python (blake3 from pypi required)
pip install blake3
python3 verify_cross_binding.py
python3 verify_streaming_trace_binding.py
# Go (lukechampine.com/blake3 from the go module, resolved on first run)
cd go && go mod tidy
( cd verify_cross_binding && go run main.go )
( cd verify_streaming_trace_binding && go run main.go )
```
Either implementation MUST reproduce PASS on every vector. A
conformant alternate impl in any language MUST reproduce these
PASS results.