Skip to content

feat(mgtp): deterministic decision artefact demo with golden replay test#10

Draft
Copilot wants to merge 3 commits intofeat/mgtp-scaffold-v0.1from
copilot/add-deterministic-demo
Draft

feat(mgtp): deterministic decision artefact demo with golden replay test#10
Copilot wants to merge 3 commits intofeat/mgtp-scaffold-v0.1from
copilot/add-deterministic-demo

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Adds a minimal, regulator-readable demonstration that MGTP DecisionRecord serialisation is deterministic, hash-stable, and replayable. No upstream modules modified.

Changes

  • mgtp/types.py — New DecisionRecord frozen dataclass; canonical_bytes() (sorted-key JSON, UTF-8) and decision_hash() (sha256 hex) methods; stdlib only
  • examples/minimal_decision_demo.py — Fixed-input script printing canonical_bytes (base64), decision_hash, and verdict; no randomness, no clock
  • tests/golden/decision_golden.b64 — Precomputed base64 canonical bytes anchor fixture
  • tests/test_mgtp_replay.py — Three assertions: live bytes == golden bytes, live hash == sha256(golden bytes), replayed hash == live hash; any byte drift fails
  • README.md — "Deterministic Decision Artefact Demo" section: input table, base64 snippet, hash value, reproduce commands
  • .github/workflows/ci.yml — Runs python examples/minimal_decision_demo.py as a check step
  • .gitignore — Excludes __pycache__ and build artifacts

Example

from mgtp.types import DecisionRecord
import base64

record = DecisionRecord(
    transition_id="txn-0001", risk_class="LOW", irreversible=False,
    resource_identifier="res://demo/alpha", trust_boundary_crossed=False,
    override_token=None, timestamp="2026-01-01T00:00:00Z",
    actor_id="demo-actor", authority_basis="OWNER", tenant_id="tenant-001",
    verdict="APPROVED",
)

print(base64.b64encode(record.canonical_bytes()).decode())
# eyJhY3Rvcl9pZCI6ImRlbW8tYWN0b3IiLC...
print(record.decision_hash())
# 8523083fc724b22f80fb638a2518133bf03f8c3283fbe7a0f629e04da5e01200

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 28, 2026 14:44
…lisation)

Co-authored-by: LalaSkye <228581229+LalaSkye@users.noreply.github.com>
Co-authored-by: LalaSkye <228581229+LalaSkye@users.noreply.github.com>
Copilot AI changed the title [WIP] Add minimal demonstration for MGTP reproducibility feat(mgtp): deterministic decision artefact demo with golden replay test Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants