Skip to content

Extract lifecycle state classification helpers#142

Open
scottscott wants to merge 2 commits intonomoticai:mainfrom
scottscott:feat/runtime-lifecycle-slice-2
Open

Extract lifecycle state classification helpers#142
scottscott wants to merge 2 commits intonomoticai:mainfrom
scottscott:feat/runtime-lifecycle-slice-2

Conversation

@scottscott
Copy link
Collaborator

Summary

Second runtime decomposition implementation slice: extract lifecycle transition decision helpers.

Key Changes

  • Added internal helper methods in src/nomotic/runtime.py:
    • _get_uahs_health(agent_id)
    • _classify_lifecycle_state(trust, uahs)
    • _lifecycle_event_for_state(state)
  • Simplified _check_lifecycle_transitions(...) to orchestrate transition flow using these helpers.
  • Preserved existing transition behavior and lifecycle event emission semantics.

Test Updates

  • Added focused tests in tests/test_lifecycle.py:
    • retirement state precedence over UAHS-derived states
    • UAHS lookup failure safety (no lifecycle event emitted)

Validation

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

Scope

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

Refactor lifecycle transition checks in GovernanceRuntime by extracting UAHS health lookup, state classification, and event mapping helpers.

Keeps behavior unchanged while making transition logic easier to evolve in subsequent decomposition slices.

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!

Add focused lifecycle tests for missing UAHS score handling and unknown lifecycle state mapping to improve diff coverage on PR nomoticai#142.

assisted-by: GitHub Copilot
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