Skip to content

feat: dead-man gap-day monitor + preflight scripts (S6-004)#103

Merged
lwalden merged 2 commits into
mainfrom
feature/s6-004-gapday-monitor-preflight
Jun 11, 2026
Merged

feat: dead-man gap-day monitor + preflight scripts (S6-004)#103
lwalden merged 2 commits into
mainfrom
feature/s6-004-gapday-monitor-preflight

Conversation

@lwalden

@lwalden lwalden commented Jun 11, 2026

Copy link
Copy Markdown
Owner

What

Adds the dead-man gap-day monitor (tools/ops/Check-DailySnapshot.ps1 + Register-GapDayMonitorTask.ps1) and scripted preflight checks, plus the runbook subsection documenting registration, exit-code legend, run-as, and end-of-run decommission.

Why

Closes the runbook's #1 triage gap: a silently dead worker can never tell the operator it is down. An independent scheduled check (2:30 PM local, weekdays) verifies today's DailySnapshot entry exists and posts an orange Discord embed when it does not. Observability only — never touches TWS, the worker, or trading state.

Test plan

  • 20/20 fixture-matrix checks pass (exit codes 0/1/2/3, weekend skip, malformed-file-as-missing, skip-reason variants)
  • Full suite 632/632 — no C# changes
  • Script parses clean (Parser::ParseFile, zero errors); enriched skip warnings verified against temp fixtures with -WhatIf
  • tools/ops/** is outside the backend CI filter — CI-neutral path

Notes

  • Task registration is a deliberate post-merge operator step (sprint VALIDATE) — never performed by CI, tests, hooks, or agent pipelines.
  • Review fix-now items applied in 05fe512 (skip-reason clarity + runbook decommission/run-as notes); message/doc-level only, exit codes and fixture matrix unchanged.

🤖 Generated with Claude Code

lwalden and others added 2 commits June 10, 2026 20:18
A down worker can never report itself down — the dead-man blind spot in
runbook section 5. Close it with operator tooling in tools/ops/ (outside
the CI dorny filter; nothing in CI/tests/hooks runs or registers any of it):

- Check-DailySnapshot.ps1: weekday-only check that today's entry exists in
  the worker's data/snapshots.json (path verified against the
  TradingSystem-FuncHost task cwd); on a gap, posts one orange Discord
  embed (webhook from gitignored local.settings.json, file -> variable ->
  -Uri only, -TimeoutSec 10). Diagnosable exit codes 0/1/2/3; -Date /
  -SnapshotPath / -WhatIf seams for fixture-driven testing. Holiday false
  positives accepted by design (no holiday calendar, no Polygon).
- preflight.ps1: scripts runbook section 2 — TWS port probe (3s),
  gateway /health (WARN not FAIL per ADR-029/030 degrade), worker
  admin-endpoint 4-function assert, data dir; bounded timeouts throughout.
- Register-GapDayMonitorTask.ps1: idempotent manual registration of
  TradingSystem-GapDayMonitor, weekdays 2:30 PM local (>=45 min after the
  EOD timer in both DST regimes); quoted -File path (Azurite-task lesson).
- Runbook: preflight pointer, dead-man alert triage row, registration
  subsection with exit-code legend.

Fixture harness: 20/20 (present/missing/file-absent/weekend/disabled/
secret-hygiene/timeout/preflight-down/parse). Suite: 632/632 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…(S6-004)

Judge fix-now items, message/doc-level only:
- Check-DailySnapshot.ps1 exit-1 skip branch now names WHICH condition
  triggered the skip (Discord disabled / webhook blank / placeholder)
  with a remediation hint each; exit code unchanged.
- Runbook gap-day-monitor subsection: run-as clause (current user, no
  elevation) on registration, and the end-of-run decommission command.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lwalden lwalden merged commit 93b3027 into main Jun 11, 2026
5 checks passed
@lwalden lwalden deleted the feature/s6-004-gapday-monitor-preflight branch June 11, 2026 03:28
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