Surface DoH reconciliation proposals via audit and a persisted snapshot (D-0055) #135

Merged
hannah-vernon merged 2 commits from feature/doh-reconciliation-proposals into dev 2026-09-24 16:14:01 -05:00
Owner

What does this PR do?

Makes the propose-only output of the DoH reconciliation worker (D-0054) visible to the operator instead of only a count in the pipeline container log. Two additions (D-0055):

  1. Audit on dry-run. DohReconciliationWorker now records an audit entry on any cycle with changes, in dry-run as well as applied cycles. The cycle result gained HasChanges/ProposedAdded/ProposedRemoved/ProposedCommentUpdated, counted from the per-router add/remove/comment lists regardless of mode; the audit gate uses HasChanges, and the Summary and DetailJson distinguish dry-run from applied. Previously the append was gated on an applied-changes flag that is always zero in dry-run, so propose-only cycles produced no audit record.

  2. Persisted snapshot + API + panel. The worker persists the latest full proposal each cycle to the new single-row doh_reconciliation_proposal table (fixed id 1, detail_json holding the serialized DohReconciliationProposal with per-router add/remove/comment-update address lists) through the new IDohReconciliationProposalStore (in-memory + Postgres). Exposed read-only at GET /api/v1/doh/proposals and rendered in a "Latest reconciliation proposal" panel on /configuration#doh-blocklist. The snapshot is persisted because the reconciliation worker runs in the PipelineHost while the Admin UI and API run in the AdminApi, so the two processes share only Postgres.

EF migration AddDohReconciliationProposal auto-applies on the next deploy. The store follows the config-store single-row convention (FixedId=1, id = 1 check constraint) but is a plain upsert: no RowVersion and no NOTIFY, since it is a most-recent-wins snapshot read on demand.

How was this tested?

  • dotnet build - 0 errors, 0 warnings
  • dotnet test - Application (581), AdminApi (225), and Postgres integration (89, incl. new proposal round-trip) all pass
  • Manually tested (Razor panel and /api/v1/doh/proposals compile clean; not yet browser-verified against a live cycle)

Checklist

  • I have read the Contributing Guide
  • Changes are focused - one logical change per PR
  • Documentation updated (DECISIONS.md D-0055, AGENT-README.md, ARCHITECTURE.md)
  • New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (none added)
  • No secrets, credentials, or real infrastructure identifiers in the diff
  • No commented-out code or debug leftovers
## What does this PR do? Makes the propose-only output of the DoH reconciliation worker (D-0054) visible to the operator instead of only a count in the pipeline container log. Two additions (D-0055): 1. **Audit on dry-run.** `DohReconciliationWorker` now records an audit entry on any cycle with changes, in dry-run as well as applied cycles. The cycle result gained `HasChanges`/`ProposedAdded`/`ProposedRemoved`/`ProposedCommentUpdated`, counted from the per-router add/remove/comment lists regardless of mode; the audit gate uses `HasChanges`, and the Summary and DetailJson distinguish dry-run from applied. Previously the append was gated on an applied-changes flag that is always zero in dry-run, so propose-only cycles produced no audit record. 2. **Persisted snapshot + API + panel.** The worker persists the latest full proposal each cycle to the new single-row `doh_reconciliation_proposal` table (fixed id 1, `detail_json` holding the serialized `DohReconciliationProposal` with per-router add/remove/comment-update address lists) through the new `IDohReconciliationProposalStore` (in-memory + Postgres). Exposed read-only at `GET /api/v1/doh/proposals` and rendered in a "Latest reconciliation proposal" panel on `/configuration#doh-blocklist`. The snapshot is persisted because the reconciliation worker runs in the PipelineHost while the Admin UI and API run in the AdminApi, so the two processes share only Postgres. EF migration `AddDohReconciliationProposal` auto-applies on the next deploy. The store follows the config-store single-row convention (`FixedId=1`, `id = 1` check constraint) but is a plain upsert: no `RowVersion` and no NOTIFY, since it is a most-recent-wins snapshot read on demand. ## How was this tested? - [x] `dotnet build` - 0 errors, 0 warnings - [x] `dotnet test` - Application (581), AdminApi (225), and Postgres integration (89, incl. new proposal round-trip) all pass - [ ] Manually tested (Razor panel and `/api/v1/doh/proposals` compile clean; not yet browser-verified against a live cycle) ## Checklist - [x] I have read the Contributing Guide - [x] Changes are focused - one logical change per PR - [x] Documentation updated (DECISIONS.md D-0055, AGENT-README.md, ARCHITECTURE.md) - [x] New dependencies are MIT/Apache-2.0/BSD, security-vetted, and recorded in THIRD-PARTY-NOTICES.md (none added) - [x] No secrets, credentials, or real infrastructure identifiers in the diff - [x] No commented-out code or debug leftovers
The propose-only reconciliation output was previously visible only as a
count in the pipeline container log.  This adds two operator-facing surfaces.

1. Audit on dry-run: DohReconciliationWorker now records an audit entry on any
   cycle with changes, in dry-run as well as applied cycles.  The cycle result
   gained HasChanges/ProposedAdded/ProposedRemoved/ProposedCommentUpdated,
   counted from the per-router lists regardless of mode; the audit gate uses
   HasChanges, and the Summary and DetailJson distinguish dry-run from applied.

2. Persisted snapshot + API + panel: the worker persists the latest full
   proposal each cycle to the single-row doh_reconciliation_proposal table
   (fixed id 1, detail_json holding the serialized DohReconciliationProposal
   with per-router add/remove/comment-update lists) through the new
   IDohReconciliationProposalStore (in-memory + Postgres).  Exposed read-only at
   GET /api/v1/doh/proposals and rendered in a "Latest reconciliation proposal"
   panel on /configuration#doh-blocklist.  Persisted because the reconciliation
   worker runs in the PipelineHost while the Admin UI/API run in the AdminApi, so
   the two processes share only Postgres.

EF migration AddDohReconciliationProposal auto-applies on next deploy.  Docs
updated (DECISIONS.md D-0055, AGENT-README.md, ARCHITECTURE.md).  Offline test
suites and Postgres integration tests (89) pass.

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!135
No description provided.