Skip to content

feat(lifecycle): resolve lifecycle status through one shared governance model (#80) - #170

Merged
ElliotSun merged 3 commits into
mainfrom
80-resolve-lifecycle-status-through-one-shared-governance-model
Aug 14, 2026
Merged

feat(lifecycle): resolve lifecycle status through one shared governance model (#80)#170
ElliotSun merged 3 commits into
mainfrom
80-resolve-lifecycle-status-through-one-shared-governance-model

Conversation

@ElliotSun

@ElliotSun ElliotSun commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #80.

Consolidates contract, schema, property, and nested property lifecycle resolution into a centralized, authoritative shared model in semapact.lifecycle.status.

Key Changes

  • Authoritative Model & Resolvers (semapact.lifecycle.status):
    • LifecycleStatus(StrEnum) (DRAFT, ACTIVE, DEPRECATED, RETIRED).
    • normalize_status(value) with case-insensitivity, whitespace trimming, and proposed -> DRAFT read-only interpretation alias.
    • resolve_contract_lifecycle(contract): canonical contract.status -> fallback contract.customProperties.lifecycleStatus -> default DRAFT.
    • resolve_declared_entity_lifecycle(entity): customProperties.lifecycleStatus on SchemaObject / SchemaProperty.
    • resolve_schema_lifecycle(schema_obj, *, contract) & resolve_property_lifecycle(prop, *, parent_lifecycle): parent lifecycle inheritance where an inactive ancestor locks downstream child properties and items.
    • Predicates: is_active_contract, is_retired_contract, participates_in_breaking_checks, is_explicitly_deprecated.
  • Fail-Closed Validation (semapact.core.validator, evaluator.py):
    • ContractValidator checks all lifecycle fields across contract, schemas, and recursive properties/items, flagging invalid statuses as ValidationIssue.
    • Resolvers safely fall back on invalid inputs, ensuring evaluate_governance_decision() and GovernanceService.merge_and_evaluate() deterministically evaluate to GovernanceDecision.BLOCK without unhandled ValueError crashes.
  • Governed Target vs Technical Source Lifecycle Isolation (semapact.lifecycle.merge_engine):
    • Gated breaking check conflict analysis and auto-deprecation strictly on the governed target contract lifecycle, preventing technical sources with missing/proposed status from bypassing governance.
  • Subsystem Harmonization & Compatibility:
    • Replaced legacy/duplicate status extractors in policy.py, merge_engine.py, evaluator.py, release.py, pipeline.py, and editor_semantics.py.
    • Preserved allows_breaking_changes as a deprecated compatibility wrapper.
  • Documentation & Test Suite:
    • Added docs/lifecycle_semantics.md.
    • Added tests/test_lifecycle_status_resolver.py, tests/test_lifecycle_effective_scope_matrix.py, and tests/test_lifecycle_fail_closed_governance.py.

Verification

  • uv run pytest -> 368 passed
  • uv run ruff check on modified modules -> All checks passed
  • uv build -> Successfully built packages

…ce model (#80)

- Add authoritative LifecycleStatus enum and resolvers in semapact.lifecycle.status
- Support canonical ODCS authority boundaries (root status for contract, customProperties for schemas/properties)
- Enforce declared vs effective lifecycle and cascade inheritance down nested properties and items
- Add fail-closed validation for unknown lifecycle statuses in ContractValidator
- Align policy, merge_engine, evaluator, release, pipeline, and editor layers
- Add documentation in docs/lifecycle_semantics.md and tests for resolver and effective scope matrix
@ElliotSun ElliotSun linked an issue Aug 14, 2026 that may be closed by this pull request
…ource lifecycle

- Safeguard resolve_contract_lifecycle and lifecycle_from_custom_properties against invalid inputs so validation outcomes block deterministically without unhandled ValueError
- Ensure MergeEngine governance scope is strictly driven by the governed target contract, preventing draft/missing status on technical sources from bypassing conflict checks and auto-deprecation
- Re-export allows_breaking_changes as a deprecated compatibility wrapper
- Add comprehensive acceptance tests in tests/test_lifecycle_fail_closed_governance.py
@ElliotSun
ElliotSun marked this pull request as ready for review August 14, 2026 07:29
@ElliotSun
ElliotSun merged commit ff53e7f into main Aug 14, 2026
4 checks passed
@ElliotSun
ElliotSun deleted the 80-resolve-lifecycle-status-through-one-shared-governance-model branch August 14, 2026 10:15
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.

Resolve lifecycle status through one shared governance model

1 participant