Skip to content

feat(governance): guarantee deterministic governance behavior with golden regression scenarios (#32) - #182

Merged
ElliotSun merged 2 commits into
mainfrom
32-guarantee-deterministic-governance-behavior-with-golden-regression-scenarios
Aug 29, 2026
Merged

feat(governance): guarantee deterministic governance behavior with golden regression scenarios (#32)#182
ElliotSun merged 2 commits into
mainfrom
32-guarantee-deterministic-governance-behavior-with-golden-regression-scenarios

Conversation

@ElliotSun

Copy link
Copy Markdown
Collaborator

Summary

Closes Issue #32.

Creates a deterministic golden regression suite that freezes and protects authoritative M0 governance semantics across:

  • Lifecycle state resolution (active, draft, deprecated, retired)
  • Breaking-change detection and version bump recommendations
  • Machine-readable reason codes (GovernanceReasonCode)
  • Canonical governance identity stability
  • Deterministic UUIDv5 decision IDs
  • Stable byte-level public GovernanceDecision (v1) JSON contract

Includes 23 minimal, read-only scenario fixtures in tests/fixtures/governance_scenarios/ and a comprehensive parameterized test runner in tests/test_governance_golden_scenarios.py.

Architecture

  • Layer: semapact.governance & semapact.lifecycle
  • Regression harness validates the boundary:
    • Internal GovernanceDecision
    • Explicit projection to PublicGovernanceDecisionV1
    • Byte-stable canonical JSON serialization
  • Verifies that physicalName differences do not mutate canonical identity (schema, property).
  • Validates lifecycle isolation (draft/deprecated skip breaking checks, active->retired is reviewable, retired mutation is strictly blocked).

Validation

  • Tests added or updated where behavior changed (33 new golden/determinism tests added)
  • uv run pytest (508 passed in ~48s)
  • uvx ruff check . --select E9,F63,F7,F82
  • uv build

Governance / compatibility impact

None (Pure regression-hardening task. Does not modify production governance semantics; locks existing authoritative M0 behavior against silent regression).

…stic test harness (#32)

- Add 23 read-only golden scenario fixtures under tests/fixtures/governance_scenarios/
- Implement parameterized golden regression runner in tests/test_governance_golden_scenarios.py
- Assert domain invariants and byte-exact PublicGovernanceDecisionV1 serialization
- Add regression tests for lifecycle states, canonical identity, reason codes, and determinism
…code matching

- Lock existence and exact identity sets in physical name stability test
- Enforce exact reason codes equality in domain-level scenario assertions
- Remove unused monkeypatch parameter from test_fixtures_are_read_only
@ElliotSun ElliotSun self-assigned this Aug 29, 2026
@ElliotSun
ElliotSun merged commit 4351daa into main Aug 29, 2026
7 checks passed
@ElliotSun
ElliotSun deleted the 32-guarantee-deterministic-governance-behavior-with-golden-regression-scenarios branch August 29, 2026 07:31
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.

1 participant