Skip to content

Extract runtime lifecycle event dispatch helper#141

Open
scottscott wants to merge 1 commit intonomoticai:mainfrom
scottscott:feat/runtime-lifecycle-slice-1
Open

Extract runtime lifecycle event dispatch helper#141
scottscott wants to merge 1 commit intonomoticai:mainfrom
scottscott:feat/runtime-lifecycle-slice-1

Conversation

@scottscott
Copy link
Collaborator

Summary

First implementation slice for runtime decomposition: extract a shared lifecycle event dispatch helper inside GovernanceRuntime.

Key Changes

  • Added internal helper GovernanceRuntime._emit_lifecycle_event(...) in src/nomotic/runtime.py.
  • Routed three lifecycle paths through the helper:
    • birth() -> BIRTH event
    • revoke() -> REVOCATION event
    • _check_lifecycle_transitions() -> DEGRADED/CRITICAL/RETIREMENT transitions
  • Preserved behavior and external interfaces; this is a structural cleanup to support further decomposition.

Validation

  • pytest -q tests/test_lifecycle.py -> 37 passed
  • pytest -q tests/test_runtime.py tests/test_lifecycle.py -> 50 passed

Scope

  • Internal refactor only
  • No API changes
  • No CI/workflow changes

Refactor GovernanceRuntime to centralize lifecycle context construction and trigger logic in _emit_lifecycle_event without changing external behavior.

Routes birth, revoke, and transition paths through the helper to reduce duplication and support incremental decomposition.

assisted-by: GitHub Copilot
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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