feat(governance): standardize governance change representation (#82) - #172
Draft
ElliotSun wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #82.
Introduces one authoritative, deterministic, ODCS-aware semantic change representation (
GovernanceChange) for governed contract evolution. The canonical changes are computed exactly once in the governance kernel and uniformly consumed across lifecycle policy, release classification, merge conflict correlation, and decision explanations.Key Changes
semapact/lifecycle/changes.py):GovernanceChange: Frozen Pydantic model capturingchange_type,entity_type,identity(canonical ancestry tuple),path,field,before/after(JsonValue),domain,breaking,reason_codes, andevidence.analyze_governance_changes(): Pure ODCS-aware comparison of base and candidate contracts with semantic deprecation coalescing.governance_change_sort_key(): Canonical deterministic ordering.describe_governance_change(): Explainability helper.semapact/lifecycle/policy.py):evaluate_merge_policy()accepts canonicalchangessequence, annotating breaking changes and reason codes without re-diffing.semapact/core/release.py):classify_contract_change()projects required version bumps directly from canonical change categories, eliminating redundant diffing.semapact/governance/evaluator.py,models.py):evaluate_governance_decision()computes canonical changes once.MERGE_CONFLICTevidence to matching changes via_correlate_merge_conflicts().GovernanceDecision.changes.tests/test_governance_changes.py: 13 unit tests for analyzer matrix, sorting, and serialization.tests/test_governance_change_integration.py: 11 integration tests for policy projection, release parity, and evaluator evidence correlation.Verification
uv run pytest: 417 passeduv run ruff check: all checks passed