Commit Graph

1 Commits

Author SHA1 Message Date
Joseph Doherty e5ad4c9f53 test(site-call-audit, deployment): cover error, retry and state-transition branches (ScadaBridge#73)
Backfills the branches arch-review 08 flagged as thin, chosen for what they
decide rather than for count. Every new test was mutation-checked: the
guarded line was broken and the test went red.

SiteCallAudit (SiteCallAuditFailurePathTests, 17 cases, in-memory - the
18 MSSQL-backed actor tests skip without a database, so the ingest and read
fault paths had no runnable coverage):
- a failed page write holds the reconciliation cursor; the next tick re-pulls
  the same window and advances only after the write lands
- the pinned latch publishes Pinned=true once across many pinned ticks and
  Pinned=false once when the site starts honouring after_id
- a site-enumeration fault skips one tick without wedging the single-flight
  guard
- an endless backlog drains at most 50 pages per tick, unpinned, and the next
  tick resumes from the advanced cursor
- purge single-flight: ticks during a blocked purge are dropped
- ingest fault replies Accepted=false and the next upsert is accepted
- detail / KPI / per-site / per-node / query faults map to Success=false with
  the root-cause message and an empty payload; the actor keeps serving
- query page size clamped to [1, 200]; an empty page carries no cursor
- Discard NotParked / OperationFailed (site message verbatim) with no audit
  row; Discard before transport registration is SiteUnreachable
- a throwing audit sink leaves an Applied relay Applied; a missing mirror row
  or unknown channel still audits the operator, falling back to ApiOutbound

DeploymentManager (DeploymentServiceFailurePathTests, 11 cases):
- a site that answers Failed commits a Failed record with the site's message
  (no timeout marker), leaves instance state and the deployed snapshot
  untouched, and audits Deploy (not DeployFailed)
- a prior non-timeout Failed record skips the query-before-redeploy
- a failing Failed-status write detaches pending changes and retries once
  (none when nothing was detached); the caller still gets the original error
- Disable / Enable / Delete answered with Success=false leave the instance
  unchanged, audit the attempt, and surface the site's message or the default

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
2026-11-09 13:10:31 -05:00