Skip to content

Extract verdict webhook dispatch helper#144

Open
scottscott wants to merge 1 commit intonomoticai:mainfrom
scottscott:feat/runtime-record-verdict-slice-4
Open

Extract verdict webhook dispatch helper#144
scottscott wants to merge 1 commit intonomoticai:mainfrom
scottscott:feat/runtime-record-verdict-slice-4

Conversation

@scottscott
Copy link
Collaborator

Summary

Fourth runtime decomposition implementation slice: extract verdict-driven webhook dispatch from _record_verdict.

Key Changes

  • Added GovernanceRuntime._dispatch_verdict_webhooks(action, context, verdict) in src/nomotic/runtime.py.
  • Replaced inline webhook logic in _record_verdict(...) with a single helper call.
  • Preserved existing webhook semantics for:
    • DENY
    • DRIFT_ALERT
    • TRUST_DROP

Test Updates

  • Added focused unit tests in tests/test_runtime.py:
    • test_dispatch_verdict_webhooks_emits_deny_and_trust_drop
    • test_dispatch_verdict_webhooks_emits_drift_alert

Validation

  • pytest -q tests/test_runtime.py tests/test_contract.py -> 48 passed

Scope

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

Refactor GovernanceRuntime._record_verdict by extracting webhook emission logic into _dispatch_verdict_webhooks.

Adds focused unit tests for DENY/TRUST_DROP and DRIFT_ALERT webhook paths.

assisted-by: GitHub Copilot
@codecov
Copy link

codecov bot commented Mar 22, 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