Repository navigation
feat(v0.4): interchange contracts — plasma diff + pinned wire formats - #51
Merged
Merged
Conversation
The before/after verification protocol for agent claims: `plasma facts . > before.json`, let the agent run, snapshot again, `plasma diff before.json after.json` shows exactly what changed. - plasma-engine/src/diff.rs: pure diff(FactSet, FactSet) -> FactsDiff — files added/removed, SPDX header transitions (common files only; added/removed are implied by the file lists), metadata changes, git state; deterministically ordered, byte-identical JSON for identical inputs - plasma diff CLI with diff(1) exit semantics: 0 identical, 1 differ, 2 error - main.rs: usage/IO errors now exit 2 uniformly (previously anyhow's default exit 1 collided with "violations found"/"snapshots differ") — caught by the new garbage-snapshot test - docs/interchange-contracts.adoc: pins the four wire contracts (facts snapshot, facts diff, findings JSON, SARIF plasma/<rule-id> namespace) for did-you-actually-do-that and somethings-fishy; additive-only evolution within a major version - tests/diff_selftest.rs: identical→0, agent-run diff shape, determinism, garbage input→2 - versions unified at 0.4.0 (Cargo manifests, Justfile, STATE.a2ml, CITATION.cff, codemeta.json — the latter three had lagged at 0.2.0) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Top item on the roadmap after v0.3: the interchange contracts the sibling tools (
did-you-actually-do-that,somethings-fishy) build against. This PR delivers the half that lives entirely in this repo — the verification protocol and the pinned wire formats.The verification protocol
An agent's claim "I only added SPDX headers" verifies as:
files_added/files_removed/metadata_changed/git_changedempty, everyheaders_changedentry hasbefore: null.Changes
plasma-engine/src/diff.rs— purediff(before, after) → FactsDiff: files added/removed, SPDX header transitions (on common files; added/removed files are implied by the file lists), metadata changes, git state. Deterministically ordered; identical inputs give byte-identical JSON.plasma diffCLI — human or JSON output, exit semantics perdiff(1): 0 identical, 1 differ, 2 error — scriptable without parsing.anyhowerrors frommainpreviously exited 1, colliding with "violations found"/"snapshots differ". Usage/IO errors now exit 2 uniformly, matching the long-documented table indocs/cli-design.adoc. Caught by the new garbage-snapshot test.docs/interchange-contracts.adoc— pins all four wire contracts (facts snapshot, facts diff, findings JSON, SARIFplasma/<rule-id>namespace) with an additive-only evolution rule within a major version.STATE.a2ml,CITATION.cff,codemeta.json, and the Justfile, which had lagged at 0.2.0.Verification
cargo test --workspace— 88 tests pass (12 integration across check/fix/diff suites, 33 engine, 42 parser, 1 root)cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkcleanplasma fix --apply→ snapshot → diff cycle and asserts the diff shapeplasma check .self-check: 0 violations, 110 rules satisfiedOut of scope (remaining v0.4 / v0.3 items)
Git hooks, reference CI action,
.plasma.tomlpolicy pinning, release facts, overlay modify/override algebra, content facts — all tracked inROADMAP.adoc.🤖 Generated with Claude Code
https://claude.ai/code/session_01JSVSF9HhKUhDrEV4xkMEXq
Generated by Claude Code