Add an on-demand "Probe now" trigger for the DoH canary probe (D-0057) #137

Merged
hannah-vernon merged 1 commit from feature/doh-probe-now into dev 2026-09-24 17:21:46 -05:00
Owner

What does this PR do?

Adds an on-demand Probe now button to /configuration#doh-blocklist that forces an immediate DoH canary-probe cycle instead of waiting for the periodic interval (default 6 hours). This makes the D-0056 ladder (and any future probe change) measurable without restarting the PipelineHost (D-0057).

How it works

The probe worker runs in the PipelineHost while the Admin UI/API run in the AdminApi, so the trigger is a cross-process signal over Postgres LISTEN/NOTIFY, following the same pattern as the settings refresh loops:

  • New IDohProbeTrigger abstraction. Postgres implementation publishes with pg_notify on channel viegard_doh_probe_now and, on the wait side, listens on it. The wait is sliced into 60-second segments so no LISTEN connection is held for the full multi-hour interval (matching the settings refresh cadence). In-memory implementation covers single-process/dev use.
  • DohProbeWorker now waits on the trigger instead of a plain delay, so a request wakes it early while it still runs at startup and every ProbeInterval.
  • POST /configuration/doh/probe-now (authenticated, antiforgery-protected, rate-limited, audited) publishes the request. It rejects the request with an explanatory message when the blocklist or probing is disabled, so the button is not a silent no-op. Requests are coalesced.

Deliberate boundaries

  • No step-up. A probe changes no persisted configuration and no router state; it only initiates outbound confirmation queries. It is gated on authentication + antiforgery like the fleet-upgrade request.
  • No new configuration value. A one-shot action is not a behaviour-controlling setting, so the standing "expose in both Admin UI and API" rule does not apply. It is still reachable through both the UI button and the POST endpoint.

How was this tested?

  • dotnet build Viegard.slnx - 0 warnings, 0 errors
  • AdminApi endpoint suite - 55 pass, including 3 new tests (signals + audits when probing enabled; rejected when the blocklist is disabled; rejected when probing is disabled)
  • DoH application tests - 17 pass, including 3 new InMemoryDohProbeTrigger tests (wake after request, no-request timeout, request coalescing)
  • Live effect is observable on the next cycle after deploy (the button triggers it on demand)

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Documentation updated (DECISIONS.md D-0057, AGENT-README.md, ARCHITECTURE.md)
  • New dependencies: none
  • No secrets, credentials, or real infrastructure identifiers in the diff
  • No commented-out code or debug leftovers
## What does this PR do? Adds an on-demand **Probe now** button to `/configuration#doh-blocklist` that forces an immediate DoH canary-probe cycle instead of waiting for the periodic interval (default 6 hours). This makes the D-0056 ladder (and any future probe change) measurable without restarting the PipelineHost (D-0057). ### How it works The probe worker runs in the **PipelineHost** while the Admin UI/API run in the **AdminApi**, so the trigger is a cross-process signal over **Postgres LISTEN/NOTIFY**, following the same pattern as the settings refresh loops: - New `IDohProbeTrigger` abstraction. Postgres implementation publishes with `pg_notify` on channel `viegard_doh_probe_now` and, on the wait side, listens on it. The wait is sliced into 60-second segments so no LISTEN connection is held for the full multi-hour interval (matching the settings refresh cadence). In-memory implementation covers single-process/dev use. - `DohProbeWorker` now waits on the trigger instead of a plain delay, so a request wakes it early while it still runs at startup and every `ProbeInterval`. - `POST /configuration/doh/probe-now` (authenticated, antiforgery-protected, rate-limited, audited) publishes the request. It rejects the request with an explanatory message when the blocklist or probing is disabled, so the button is not a silent no-op. Requests are coalesced. ### Deliberate boundaries - **No step-up.** A probe changes no persisted configuration and no router state; it only initiates outbound confirmation queries. It is gated on authentication + antiforgery like the fleet-upgrade request. - **No new configuration value.** A one-shot action is not a behaviour-controlling setting, so the standing "expose in both Admin UI and API" rule does not apply. It is still reachable through both the UI button and the POST endpoint. ## How was this tested? - [x] `dotnet build Viegard.slnx` - 0 warnings, 0 errors - [x] AdminApi endpoint suite - 55 pass, including 3 new tests (signals + audits when probing enabled; rejected when the blocklist is disabled; rejected when probing is disabled) - [x] DoH application tests - 17 pass, including 3 new `InMemoryDohProbeTrigger` tests (wake after request, no-request timeout, request coalescing) - [ ] Live effect is observable on the next cycle after deploy (the button triggers it on demand) ## Checklist - [x] I have read the Contributing Guide - [x] Changes are focused - one logical change per PR - [x] Documentation updated (DECISIONS.md D-0057, AGENT-README.md, ARCHITECTURE.md) - [x] New dependencies: none - [x] No secrets, credentials, or real infrastructure identifiers in the diff - [x] No commented-out code or debug leftovers
The probe worker runs on a fixed interval (default 6 hours), so after enabling
a probe change there was no way to reprobe without restarting PipelineHost.
This adds a "Probe now" button on /configuration#doh-blocklist that forces an
immediate cycle.

Because the probe worker runs in the PipelineHost while the Admin UI/API run in
the AdminApi, the trigger is a cross-process signal over Postgres LISTEN/NOTIFY,
following the same pattern as the settings refresh loops.  A new IDohProbeTrigger
has a Postgres implementation that publishes with pg_notify on channel
viegard_doh_probe_now and, on the wait side, listens on it; the wait is sliced
into 60-second segments so no LISTEN connection is held for the full interval.
DohProbeWorker now waits on the trigger instead of a plain delay, so a request
wakes it early while it still runs at startup and every ProbeInterval.  An
in-memory implementation covers single-process/dev use.

POST /configuration/doh/probe-now (authenticated, antiforgery, rate-limited,
audited) publishes the request and rejects it with an explanatory message when
the blocklist or probing is disabled, so the button is not a silent no-op.  No
step-up: a probe changes no persisted config and no router state.  No new
configuration value: a one-shot action is not a behaviour-controlling setting,
and it is reachable through both the UI button and the endpoint.

Tests: 3 InMemoryDohProbeTrigger unit tests (wake, no-request, coalescing) and
3 endpoint tests (signals + audits when enabled, rejected when the blocklist or
probing is disabled).  Full solution build 0/0; AdminApi endpoint suite 55 pass;
DoH application tests 17 pass.  Docs updated (DECISIONS D-0057, AGENT-README,
ARCHITECTURE).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
hannah-vernon/viegard-sentinel!137
No description provided.