Skip to content

feat(collector): add systemd watchdog, opt-in DLQ expiry ledger, and auxiliary volume health (#138) - #305

Merged
jusso-dev merged 1 commit into
mainfrom
feat/crash-resilience-and-disk-hygiene
Nov 21, 2026
Merged

jusso-dev merged 1 commit into
mainfrom
feat/crash-resilience-and-disk-hygiene

Conversation

@jusso-dev

Copy link
Copy Markdown
Owner

Summary

Closes #138.

Completes collector crash resilience and disk hygiene (building on PRAGMA synchronous = FULL, StorageGuard queue-volume watermarks, unclean shutdown detection + temp-file cleanup in #215, and MSI service recovery actions):

  • Pure-.NET systemd watchdog (src/Bower.Collector/SystemdWatchdog.cs, deploy/systemd/bower.service):
    • Adds WatchdogSec=60s to deploy/systemd/bower.service.
    • Sends READY=1, periodic WATCHDOG=1 (at half WATCHDOG_USEC), and STOPPING=1 over NOTIFY_SOCKET via Unix domain datagram sockets with no external native dependencies.
  • Opt-in dead-letter retention with hash-chained ledger evidence (src/Bower.Persistence/SqliteEventStore.DeadLetterRetention.cs, src/Bower.Collector/Jobs/QueueRetentionJob.cs, src/Bower.Collector/CollectorSettings.cs):
    • Dead-lettered rows remain retained indefinitely by default (BOWER_DEAD_LETTER_RETENTION_DAYS unset).
    • When opted into (1–3650 days), logs a metadata-only pre-expiry warning (EventId 1510) within 24 hours of expiry and records a hash-chained evidence entry in queue_dead_letter_purges (count, cutoff, failure-code summary, oldest/newest timestamps, chain hash) before deleting expired dead-letter rows (EventId 1511).
  • Auxiliary volume health & heartbeat reporting (QueueStorageMonitor.cs, CollectorApplication.cs, CollectorJson.cs, ManagementHeartbeatJob.cs):
    • Monitors free space on configured AMA spool (BOWER_OUTPUT=ama-spool) and archive (BOWER_ARCHIVE_PATH) volumes using the same BOWER_STORAGE_* watermarks, reporting volumes in /v1/status and degrading /health and /v1/status when critical.
    • Reports oldestDeadLetterAgeSeconds and recovery on collector heartbeats.
  • Docs: Updates docs/operations/queue-v5-durability.md and docs/operations/fleet-and-queue-integrity.md.

Verification

  • dotnet build --configuration Release — 0 warnings, 0 errors
  • dotnet test (CrashResilienceAndDiskHygieneTests, CrashRecoveryTests, QueueStorageTests, QueueRetentionTests, QueueLedgerTests) — 15 passed, 0 failed
  • dotnet format --verify-no-changes — passed

Security and compatibility impact

  • All new settings, tables and JSON fields are strictly additive; dead-letter auto-expiry is opt-in and off by default.
  • Purge evidence and pre-expiry warnings are metadata-only (counts and failure codes; never raw payloads or secrets).

@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63a0def7-6a7c-4187-803c-b3c8c31f895b
Commits

Reviewing files that changed from the base of the PR and between abe1e41 and ebbaca4.

Files selected for processing: 13

  • deploy/systemd/bower.service
  • docs/operations/fleet-and-queue-integrity.md
  • docs/operations/queue-v5-durability.md
  • src/Bower.Collector/CollectorApplication.cs
  • src/Bower.Collector/CollectorJson.cs
  • src/Bower.Collector/CollectorSettings.cs
  • src/Bower.Collector/Jobs/ManagementHeartbeatJob.cs
  • src/Bower.Collector/Jobs/QueueRetentionJob.cs
  • src/Bower.Collector/QueueStorageMonitor.cs
  • src/Bower.Collector/SystemdWatchdog.cs
  • src/Bower.Persistence/SqliteEventQueue.cs
  • src/Bower.Persistence/SqliteEventStore.DeadLetterRetention.cs
  • tests/Bower.UnitTests/CrashResilienceAndDiskHygieneTests.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@jusso-dev
jusso-dev force-pushed the feat/crash-resilience-and-disk-hygiene branch from 29af0b9 to ebbaca4 Compare November 21, 2026 21:44
@jusso-dev
jusso-dev merged commit 38b71e9 into main Nov 21, 2026
28 checks passed
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.

Collector crash resilience and disk hygiene: explicit fsync, watermarks, cleanup and watchdog

1 participant