Skip to content

feat(tx-killswitch): audit remote-driven gate transitions - #132

Merged
M0LTE merged 1 commit into
masterfrom
feat/tx-killswitch-audit-remote-flip
May 6, 2026
Merged

feat(tx-killswitch): audit remote-driven gate transitions#132
M0LTE merged 1 commit into
masterfrom
feat/tx-killswitch-audit-remote-flip

Conversation

@M0LTE

@M0LTE M0LTE commented May 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes the asymmetry in audit coverage left over from the kill-switch trilogy. The local Stop/Resume button writes a `tx-control` row on every press; remote-driven gate flips were silent. Now they audit symmetrically.

What gets audited

Event Audit row?
First poll says BLOCK Yes
First poll says ALLOW No (would be one row per startup, noise)
ALLOW -> BLOCK transition Yes
BLOCK -> ALLOW transition Yes
Steady-state poll (same result) No
Poll failure No (no state change)
Block targeted at other callsigns (`appliesTo` doesn't match us) No

`Kind="tx-control"` matches the local toggle; `Bearer="remote"` (the local toggle uses `"ui"`) so an operator filtering by bearer can separate the two signals.

Test plan

  • 7 new tests in `TxKillSwitchPollerAuditTests` covering each branch above
  • Existing 18 poller tests still green - `TransmissionAuditService` is injected nullable so they don't need DB plumbing
  • Full unit suite: 644/644

🤖 Generated with Claude Code

The local Stop/Resume button writes a tx-control audit row on every
press; remote-driven gate flips were silent. Now they audit
symmetrically, so reviewing audit history shows both signals' impact.

Logic:
- First successful poll says BLOCK -> audit (the kill-switch is
  active right now is genuinely notable).
- First successful poll says ALLOW -> no audit (steady state on
  every startup would be log noise).
- ALLOW -> BLOCK transition: audit "BLOCK (was ALLOW): <reason>".
- BLOCK -> ALLOW transition: audit "ALLOW (was BLOCK): <reason>".
- Steady-state polls (same result as last time): no audit.
- Failed polls: no audit (no state change to record).
- Block targeted at other callsigns: counts as ALLOW for us, no
  audit on first poll.

Audit kind is "tx-control" (matches the local toggle) and bearer
is "remote" (the local toggle uses "ui"). Operators filtering for
tx-control rows see both signals; the bearer field disambiguates.

7 new tests in TxKillSwitchPollerAuditTests cover each branch.
TransmissionAuditService is injected nullable so the existing 18
poller tests don't need DB plumbing.

Tests: 644/644 (was 637; added 7).
@M0LTE
M0LTE merged commit 0d95c89 into master May 6, 2026
4 checks passed
@M0LTE
M0LTE deleted the feat/tx-killswitch-audit-remote-flip branch May 6, 2026 10:31
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