Skip to content

Clear the web-TLS-cert snapshot on stop so the expiry alert resolves (follow-up to #3514) - #3516

Merged
erikdarlingdata merged 1 commit into
devfrom
feature/3514-followup-clear-on-stop
Sep 17, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
feature/3514-followup-clear-on-stop

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Follow-up to #3514, closing the two findings from its post-merge adversarial review.

The bug (both reviewers, confirmed)

WebTlsCertificateState was write-once and StopServerAsync disposed the certificate without clearing it, so disabling the web dashboard at runtime (a no-restart op) left the worker firing the expiry alert forever — escalating to a Critical that claims "the LAN dashboard is unreachable now" about a dashboard the operator deliberately turned off — with no resolution short of a full service restart.

Fix

  • WebTlsCertificateState.Clear(), called wherever the host stops serving TLS: StopServerAsync (runtime disable), DisposeFailedStartAsync (failed start), and the SAN-catch loopback degrade. The lifetime-refusal path deliberately keeps the published facts so an expired-at-start cert still fires its Critical. Rebind-safe: Stop→Start run back-to-back in one supervisor tick, re-publishing before the worker's hourly sweep observes the null.
  • Makes the resolve path reachable (review finding Lite overview: show Online/Offline status for servers #2): the worker's report is now built by a pure static BuildWebTlsCertReport(snapshot) mapping a null/cleared snapshot → Configured=false → the evaluator's resolve arm.
  • Tests: dropped the misleading "renewed past the window" test (it fed the evaluator a report the seam cannot produce in-process — in-place renewal is restart-only), kept the now-reachable disable→resolve test, and added seam tests for Clear() and the report builder. CHANGELOG resolution wording corrected to match.

Known gap left as-is (out of the feature's expiry scope, covered by a Critical startup log): a not-yet-valid cert (future NotBefore) publishes a future NotAfter as healthy while the host is loopback-only — filing separately.

Full Darling.Tests green — only the known machine-local NpgsqlRootCertificateValidationTests TLS-trust flake fails (passes in CI on Linux), unrelated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RzwoqcD62jKyp6tzsWpZLz

…the expiry alert resolves (follow-up to #3514)

Adversarial review of #3514 caught a reachable bug: WebTlsCertificateState was write-once and
StopServerAsync disposed the certificate without clearing it, so disabling the web dashboard at
runtime (a no-restart op) left the worker firing the expiry alert forever - escalating to a
Critical that claims the LAN dashboard is unreachable, about a dashboard the operator deliberately
turned off - with no resolution short of a full service restart.

Add WebTlsCertificateState.Clear() and call it wherever the host stops serving TLS: StopServerAsync
(runtime disable), DisposeFailedStartAsync (failed start), and the SAN-catch loopback degrade. The
lifetime-refusal path deliberately keeps the published facts so an expired-at-start certificate
still fires its Critical. Rebind-safe: Stop->Start run back-to-back in one supervisor tick,
re-publishing before the worker's hourly sweep observes the null.

Also makes the resolve path reachable (review finding #2): the worker's report is now built by a
pure static BuildWebTlsCertReport(snapshot) mapping a null/cleared snapshot to Configured=false, so
a stop resolves the alert. Dropped the misleading "renewed past the window" test (it fed a report
the seam cannot produce in-process - in-place renewal is restart-only), kept the now-reachable
disable->resolve test, and added seam tests for Clear() and the report builder. CHANGELOG wording
corrected to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RzwoqcD62jKyp6tzsWpZLz
@erikdarlingdata
erikdarlingdata enabled auto-merge (squash) September 17, 2026 19:25
@erikdarlingdata
erikdarlingdata merged commit c4b5ec9 into dev Sep 17, 2026
7 of 8 checks passed
@erikdarlingdata
erikdarlingdata deleted the feature/3514-followup-clear-on-stop branch September 17, 2026 19: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