This repository preserves an early experimental scaffold for deterministic structural comparison of JSON decision objects.
It canonicalizes two inputs, computes SHA-256 hashes, and reports whether their canonical representations are identical.
It does not implement Guardian's current comparison semantics and must not be treated as a decision-equivalence verifier. In particular, it does not determine comparison basis, invariant-boundary equivalence, non-equivalence, or formal incomparability.
The current comparison-layer reference implementation is Decifact.
This verifier does NOT define equivalence as structural or hash equality. This repository is a minimal reference scaffold, not a complete implementation of Guardian v0.2.
Decision equivalence is determined by invariant boundary equality, as defined in Guardian v0.2.
Canonicalization is used only as a deterministic encoding step, not as a semantic equivalence criterion.
Historical / superseded scaffold
This repository predates the current Guardian responsibility model and the Decifact comparison implementation.
The executable API remains available as implementation history, but
its equivalent field means only that the two inputs produced the
same canonical JSON hash. It does not establish semantic or
cross-governance equivalence.
- Exposes
POST /verify - Accepts
decision_aanddecision_b - Performs deterministic canonicalization:
- Sorts dictionary keys
- Removes unnecessary whitespace
- Performs deterministic normalization (current implementation)
- Uses canonical hashing as its implemented structural-identity mechanism. No replacement implementation is planned in this repository unless its status is reconsidered separately.
- Returns:
equivalentcanonical_hash_acanonical_hash_b
The equivalent field is historical API terminology. In this
implementation, it means only that both inputs produced the same
canonical JSON hash.
The current implementation reports canonical-hash identity only. This behavior is preserved as historical implementation scope and must not be interpreted as semantic equivalence.
Guardian V0.2 defines the later invariant-boundary model, and the current comparison-layer implementation is maintained separately in Decifact. No further equivalence-model work is planned in this repository.
- No policy engine
- No DID / signature / receipt / attestation
- No runtime integration
- No database
This project is intentionally minimal and is preserved as a historical scaffold, not as an active reference implementation.
python -m venv .venv
. .venv/Scripts/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadRequest body:
{
"decision_a": {"id": "D-001", "result": "allow"},
"decision_b": {"result": "allow", "id": "D-001"}
}Response body:
{
"equivalent": true,
"canonical_hash_a": "<sha256-hex>",
"canonical_hash_b": "<sha256-hex>"
}pytestexamples/equal_a.jsonexamples/equal_b.jsonexamples/different.json