Skip to content

feat: MGTP minimal deterministic decision artefact demo#9

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

feat: MGTP minimal deterministic decision artefact demo#9
Copilot wants to merge 3 commits intofeat/mgtp-scaffold-v0.1from
copilot/add-deterministic-decision-demo

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Adds a minimal, regulator-readable artefact demonstration proving deterministic canonicalisation, hash stability, and replay correctness for the MGTP commit gate — with no changes to any upstream module.

New files

  • examples/minimal_decision_demo.py — Fixed-input demo (no randomness, no live timestamps). Evaluates a canonical CommitRequest, prints verdict, decision_hash, and canonical_bytes (base64):

    verdict        : ALLOW
    decision_hash  : fab8740c920489154038063620e1453460e1ea1549d0cb1f0cb2dca0ce860360
    canonical_bytes (base64): eyJhcnRlZmFjdF92ZXJzaW9uIjoiMC4x…
    

    Reproduce: python examples/minimal_decision_demo.py

  • tests/fixtures/golden_canonical_bytes.b64 — Locked golden canonical bytes for the fixed input set.

  • tests/test_replay_decision.py — Two replay assertions:

    • T-REPLAY-1: canonicalise(evaluate(REQUEST, RULESET)) is byte-identical to the golden fixture (any byte difference → fail).
    • T-REPLAY-2: decision_hash in re-evaluated result matches hash embedded in golden bytes.

Modified files

  • README.md — New Deterministic Decision Artefact Demo section: input table, output artefact snippet, decision_hash, and exact reproduce/replay commands.

  • .github/workflows/ci.yml — Added check-mode step running python examples/minimal_decision_demo.py across the Python 3.10/3.11/3.12 matrix on every push/PR.

  • .gitignore — Excludes __pycache__, .pyc, .pytest_cache.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits February 28, 2026 14:00
Co-authored-by: LalaSkye <228581229+LalaSkye@users.noreply.github.com>
…ble)

Co-authored-by: LalaSkye <228581229+LalaSkye@users.noreply.github.com>
Copilot AI changed the title [WIP] Add demonstration for deterministic decision artefact feat: MGTP minimal deterministic decision artefact demo Feb 28, 2026
@LalaSkye LalaSkye requested a review from Copilot February 28, 2026 15:28
@LalaSkye LalaSkye marked this pull request as ready for review February 28, 2026 15:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a deterministic “decision artefact” demo + golden-fixture replay tests to prove canonicalisation stability and decision hash replay for the MGTP/commit_gate commit authority evaluation, and wires the demo into CI.

Changes:

  • Add a fixed-input demo script that prints the evaluated verdict + canonical artefact bytes (base64).
  • Add golden canonical bytes + replay tests asserting byte-identical canonicalisation and stable decision_hash.
  • Document the demo/replay steps in README and run the demo in CI.

Reviewed changes

Copilot reviewed 5 out of 34 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_replay_decision.py Adds two replay tests (byte-identical canonical bytes + decision_hash match).
tests/fixtures/golden_canonical_bytes.b64 Stores the locked “golden” canonical bytes fixture (base64).
examples/minimal_decision_demo.py Deterministic demo that evaluates a fixed request/ruleset and prints canonical bytes (base64).
README.md Documents deterministic artefact demo inputs, expected outputs, and replay commands.
.github/workflows/ci.yml Runs the demo script as an additional CI step across the Python matrix.
.gitignore Adds ignores for Python bytecode/caches and build artefacts.
tests/pycache/test_smoke_mgtp.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
pycache/stop_machine.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
pycache/authority_gate.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
pycache/invariant_litmus.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
pycache/test_stop_machine.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
pycache/test_authority_gate.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/src/commit_gate/pycache/engine.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/src/commit_gate/pycache/drift.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/src/commit_gate/pycache/canonicalise.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/src/commit_gate/pycache/init.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/tests/pycache/test_determinism.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
commit_gate/tests/pycache/test_drift.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/conftest.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/init.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_schema_validation.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_redline_scanner.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_negative_injection.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_input_hashing.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_fit_report_classification.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/tests/pycache/test_aggregation_determinism.cpython-312-pytest-9.0.2.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/schemas.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/redlines.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/io_jsonl.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/hashing.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/fit_report.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/aggregate.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).
prometheus/src/prometheus/pycache/init.cpython-312.pyc Compiled artefact accidentally committed (should be removed from git).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +52
result = evaluate(REQUEST, RULESET)
canonical_bytes = canonicalise(result)
canonical_b64 = base64.b64encode(canonical_bytes).decode("ascii")
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script runs significant logic at import time (evaluate + printing). Wrapping execution in a main() and guarding with if name == 'main' avoids side effects if the module is imported (e.g., by tooling) and makes it easier to reuse in tests.

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +44
def _load_golden_bytes():
b64_text = (FIXTURES_DIR / "golden_canonical_bytes.b64").read_text().strip()
return base64.b64decode(b64_text)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For deterministic behavior across environments, consider specifying an explicit encoding when reading the fixture (it's ASCII/base64) and using base64.b64decode(..., validate=True) so corruption/non-base64 characters fail loudly with a clear error.

Copilot uses AI. Check for mistakes.
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.

3 participants