Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decision-verifier

Historical Canonical-Hash Comparison Scaffold

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.

⚠️ Important

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.

Status

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.

Scope

  • Exposes POST /verify
  • Accepts decision_a and decision_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:
    • equivalent
    • canonical_hash_a
    • canonical_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.

Non-goals

  • 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.

Quick Start

python -m venv .venv
. .venv/Scripts/activate
pip install -r requirements.txt
uvicorn app.main:app --reload

API

POST /verify

Request 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>"
}

Run Tests

pytest

Example Files

  • examples/equal_a.json
  • examples/equal_b.json
  • examples/different.json

About

Historical JSON canonical-hash comparison scaffold; not the current Guardian equivalence implementation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages