Commit Graph

1987 Commits

Author SHA1 Message Date
Joseph Doherty df53391646 test(localdb): deregister preserves data + partial-flip fails loudly (review round)
Review round on 3e62f161. Two coverage gaps and three wording/comment nits.

IMPORTANT 1 — deregistration is now proven DATA-PRESERVING. The self-heal test
inserted a deployment_pointer row and rebooted unconfigured but never looked at
the row again, so a library regression that touched base-table data during
cleanup would have gone unnoticed — on the very tables that ARE the
boot-from-cache backstop, and on the default-OFF nodes least likely to notice.
The new DisablingReplication_PrunesBookkeepingButNeverTouchesTheCachedDataItself
asserts the row's CONTENT survives (not just its count — a count passes against
a cleanup that blanks columns) while __localdb_row_version and __localdb_oplog,
the bookkeeping deregistration does own, go to zero.

IMPORTANT 2 — mid-loop partial failure is documented and pinned. Both loops flip
four tables with no try/catch, so a throw on the third leaves two flipped and
propagates out of the AddZbLocalDb singleton factory, failing host start. That
is correct — a node that came up anyway would be silently capturing on an
arbitrary subset — and both library calls are idempotent, so the retried boot
completes the flip. Written into OnReady's remarks and pinned by
AFailureMidwayThroughRegistration_FailsBootLoudly_AndTheRetriedBootConverges,
which drives OnReady through a delegating ILocalDb that throws on the Nth
RegisterReplicated, asserts the throw propagates, asserts the wrapper actually
reached that call, then re-runs OnReady unwrapped and asserts all four converge.

MINOR 3 — the Boot helper now records that OnReady's null-logger fallback lands
on Serilog's static Log.Logger, which this assembly never assigns; assertions
about logging pass an explicit logger.
MINOR 5 — log wording: "are both unset" -> "are both absent — unset or blank",
matching IsNullOrWhiteSpace.
MINOR 4 — LocalDbDeploymentArtifactCacheTests said its setup "mirrors
LocalDbSetup.OnReady"; it reproduces the two tables only and registers them
unconditionally without baselining. Softened to say so and to name the
divergence as intentional and inert there.

Falsified both new pins. Wrapper set to failOnCall: 99 (never throws) => the
partial-flip pin is the SOLE failure, so it genuinely exercises the Nth-call
throw path rather than some incidental exception. Predicate forced constant-true
=> five pins red including the new data-preservation one. Both mutations
reverted.

LocalDbSetupTests 15/15. Host.IntegrationTests 226 passed / 0 failed / 5
skipped. Runtime.Tests LocalDbDeploymentArtifactCacheTests 12/12.
2026-08-18 07:42:06 -04:00
Joseph Doherty 3e62f1617b fix(localdb): registration follows replication config — baseline on enable, deregister self-heal on disable (pair-symmetric)
LocalDbSetup.OnReady registered all four replicated tables unconditionally on
every driver node, replicating or not. That was not merely wasteful (an
unreplicated node paid two INSERTs plus a json_object of the whole row inside
every write transaction, for an oplog nothing ever drained) — it made
baselineExistingRows unusable, so enabling replication on a long-running
default-OFF node converged on SUBSEQUENT WRITES ONLY and the rows already in the
file stayed invisible to the peer, silently and forever.

Registration now follows one predicate, LocalDbSetup.ReplicationIsConfigured:
LocalDb:Replication:PeerAddress OR :ApiKey non-blank. The OR is load-bearing —
only the dialling half of a pair sets PeerAddress, so keying on it alone would
strip capture from every passive node and the pair would converge in one
direction only. SyncListenPort deliberately does not join it: the passive
endpoint is fail-closed on the key, so a port with no ApiKey syncs with nobody.

  configured   => RegisterReplicated(table, baselineExistingRows: true), per
                  table, in the unchanged load-bearing DDL->register order
  unconfigured => DeregisterReplicated(table), an idempotent boot self-heal that
                  drops the capture triggers an earlier build left behind and
                  prunes that table's oplog/row-version rows. One Information
                  line, only when it actually cleaned something.

PAIR SYMMETRY: the sync handshake compares registered-table digests fail-closed,
so flipping either key is a both-nodes-together change — set it on both and
restart both. Documented in CLAUDE.md, docs/Configuration.md and the replication
runbook (which claimed "this repo never calls DeregisterReplicated").

Verified against the pinned LocalDb 0.2.1: RegisterReplicated(string, bool) and
DeregisterReplicated(string) -> bool both exist; baselining seeds
__localdb_row_version at HLC 0 and the deregister return value distinguishes
"cleaned" from "nothing to clean". No pin bump needed.

Tests: LocalDbSetupTests gains pins for both branches (configured via
PeerAddress alone and via ApiKey alone; unconfigured => no tables, zero
triggers; late-enable => an HLC-0 baseline ledger entry; the log line fires once
and only when something was cleaned) — four went red against the old
unconditional code, and all four go red again under a constant-true predicate.
LocalDbWiringTests splits its exact-set pin into a replicating graph and a
default-OFF one. LocalDbPairHarness and AlarmSfLegacyMigratorTests built their
database from LocalDb:Path alone while configuring the replication engine from a
second config — production reads one configuration, so the two are now aligned.
Host.IntegrationTests: 224 passed, 0 failed, 5 skipped.
2026-08-18 07:25:01 -04:00
Joseph Doherty 1765e30063 fix(s7): worst-severity error message + OCE flushes recorded pass evidence (review round) 2026-08-18 07:10:51 -04:00
Joseph Doherty b35e423c1d fix(s7): a read pass that observes nothing reports nothing — empty pass no longer clears Faulted 2026-08-18 07:00:33 -04:00
Joseph Doherty 441b34a391 fix(acl): make InvalidateIfStale a monotonic-max CAS loop — stamp publication is never deferred 2026-08-17 07:15:30 -04:00
Joseph Doherty 4c16118105 fix(s7): read-pass health is worst-state-wins — a mixed pass can no longer report Healthy 2026-08-17 07:14:32 -04:00
Joseph Doherty d54b4fab62 docs(acl): fix the two comment nits from the T1 re-review — displacement precision, straggler-test claim 2026-08-17 06:09:13 -04:00
Joseph Doherty 98d6a1908e fix(acl): a stale-generation straggler can no longer roll the cache stamp backward and thrash ClearAll 2026-08-17 05:51:24 -04:00
Joseph Doherty 1979cf4119 fix(acl): stamp the generation on Shard so a rollover racer cannot serve a stale-generation verdict; eviction-swap capacity hint 2026-08-17 05:37:56 -04:00
Joseph Doherty 1edfc263ec docs(mtconnect): state AsStream's buffer aliasing and lifetime contract 2026-08-17 05:31:28 -04:00
Joseph Doherty 7c5a843ace docs(code): close-out comment fixes from the follow-ups review round 2026-08-17 04:32:53 -04:00
Joseph Doherty 57c66416d8 test(s7): live-gate span reads + multi-var leftovers against the s7_1500 fixture 2026-08-17 04:24:39 -04:00
Joseph Doherty 20022083df perf(s7): span leftovers batch through multi-var read PDUs with per-chunk fallback 2026-08-17 04:05:42 -04:00
Joseph Doherty 5ae430237f fix(alarms): background tasks register before they start; volatile _disposed 2026-08-17 04:04:45 -04:00
Joseph Doherty cda82c074e perf(mtconnect): stream sample-chunk parsing through XmlReader; no per-chunk document tree 2026-08-17 03:57:16 -04:00
Joseph Doherty d884934593 fix(acl): shard eviction swaps the shard object so _globalCount cannot over-subtract; concurrency stress test 2026-08-17 03:55:13 -04:00
Joseph Doherty 97902d6879 fix(drivers): overrun-meter tag keys align with the Meter's snake_case convention (driver_type/driver_instance) 2026-08-17 03:54:53 -04:00
Joseph Doherty c149410ba3 test(adminui): SQL-Server-backed pins for the drift watermark aggregate and the rename scan's collation widening 2026-08-17 03:53:16 -04:00
Joseph Doherty 7870c91fe4 fix(historian): a shutdown cancellation mid-drain is a pass abort, not a per-tag failure 2026-08-17 03:52:55 -04:00
Joseph Doherty dba5f806d3 fix(runtime): explicit 30s command timeout on the Direct-apply artifact read 2026-08-17 03:49:27 -04:00
Joseph Doherty 6ee553cf8f feat(s7): expose ReadMultipleVarsAsync through the IS7Plc seam 2026-08-17 03:48:15 -04:00
Joseph Doherty c4d8e4a200 fix(acl): revalidation memo rejects empty node identifiers, mirroring the authorizer's guard 2026-08-17 03:47:19 -04:00
Joseph Doherty e22ecea008 feat(drivers): per-driver poll-overrun meter on the shared OtOpcUa Meter; NoteOverrun + backoffCap doc notes 2026-08-17 03:46:27 -04:00
Joseph Doherty acb3772426 fix(s7): validate span-read options at parse time; document the over-PDU degradation 2026-08-17 03:45:14 -04:00
Joseph Doherty c8a7014388 fix(alarms): replacement drainer starts on a fresh stack; honest bounds in the latch comments 2026-08-16 05:57:05 -04:00
Joseph Doherty 445bb855e2 fix: release the alarm drain latch on escape; cancel before disposing the page poll timers 2026-08-16 05:40:27 -04:00
Joseph Doherty b9e9df4081 docs(code): honest rationales — Akka restart semantics, per-key shards, EF literal inlining; retire or annotate orphaned members 2026-08-16 05:33:33 -04:00
Joseph Doherty dbc9223206 docs(code): correct comments stale after the perf remainder 2026-08-16 05:09:00 -04:00
Joseph Doherty 451273c860 test(historian): pin the failed-batch-append branch; correct its loss-accounting docs
The batched ingest's append-failure catch had zero coverage, and two doc
statements overstated the loss: the Warning said the burst's values were
"dropped", and RecorderStatus.OutboxAppendFailures said "the value was
dropped, not recorded". The outbox contract is prefix-never-orphan, so a
partial-prefix failure leaves entries durably queued that drain normally.

- New test pins the branch: one 3-item burst whose group commit commits a
  1-entry prefix then throws => OutboxAppendFailures == 1 (per burst, not
  per value), TotalRecorded == 0, actor alive, and the prefix still reaches
  the writer via the post-failure DrainTick (drainInterval 30s, so the
  steady cadence cannot account for it). Falsified twice: counting per item
  and dropping the drain nudge each turn it red.
- Second test pins the OperationCanceledException filter from its
  observable side - a cancel that is NOT shutdown is metered, not swallowed.
  Removing the 'when (_lifetime.IsCancellationRequested)' turns it red. The
  shutdown side has no cheap seam (the counter dies with the actor).
- Docs corrected: OutboxAppendFailures counts FAILED BATCH APPENDS, one per
  burst whatever its size (a granularity change from the per-value era), and
  is not a count of values lost; TotalRecorded under-counts when a commit
  fails after a partial prefix. Log message says "failed to append" and
  names the prefix. No functional change beyond the message string.

Also folds in the DrainBatchSize default alignment behind 0298a0b9: the
recorder's two ctor defaults and its non-positive fallback still said 64
while ContinuousHistorizationOptions.DrainBatchSize now defaults to 1024.
No test pinned the old 64.
2026-08-16 04:50:30 -04:00
Joseph Doherty 0298a0b944 chore(historian): batch-era defaults + appsettings/doc alignment 2026-08-16 04:48:55 -04:00
Joseph Doherty 5b92eb0ff6 perf(runtime): direct-mode artifact read piped off the host mailbox 2026-08-16 04:48:02 -04:00
Joseph Doherty ca87329a83 fix(adminui): dedup + chunk the rename script-scan OR-chain 2026-08-16 04:36:03 -04:00
Joseph Doherty 384568b47a perf(historian): batch ingest — one group commit per value burst 2026-08-16 04:33:35 -04:00
Joseph Doherty b6275f439c perf(runtime): per-driver index for connectivity fans; comms-loss is one batch 2026-08-16 04:27:20 -04:00
Joseph Doherty 9cf400f1e8 perf(drivers): fixed-rate poll pacing with overrun counter; non-blocking unsubscribe 2026-08-16 04:26:20 -04:00
Joseph Doherty 684e59d871 perf(adminui): drift chip recomposes only when the config-edit watermark moves 2026-08-16 04:25:56 -04:00
Joseph Doherty d5f573b019 fix(abcip): single-flight cold-connect per device — backoff survives the parallel read window 2026-08-16 04:24:59 -04:00
Joseph Doherty fe8d132c64 perf(adminui): rename script scan filters server-side, stops shipping every script body 2026-08-16 04:24:10 -04:00
Joseph Doherty a76b4e0740 perf(historian): bounded-parallel per-tag drain (DrainConcurrency, default 8) 2026-08-16 04:21:18 -04:00
Joseph Doherty d8a17f2e34 perf(acl): authorizer hot path — cache lookup before scope build, lazy deny reasons 2026-08-16 04:19:47 -04:00
Joseph Doherty 7320586512 fix(historian): incremental batch-append bookkeeping; genuine group-commit durability pin 2026-08-16 04:18:38 -04:00
Joseph Doherty fbe8aaad9d perf(acl): dedup subscription revalidation by (session, node) 2026-08-16 04:18:03 -04:00
Joseph Doherty 50035b36bb test(mqtt): pin status-code half of republish suppression; note Sparkplug bypass 2026-08-16 04:16:35 -04:00
Joseph Doherty 39f67a0fce perf(s7): span-grouped reads — one PDU per contiguous block instead of one per tag 2026-08-16 04:15:37 -04:00
Joseph Doherty 63081d52d8 fix(adminui): fleet page disposes its poll timer asynchronously like hosts 2026-08-16 04:15:05 -04:00
Joseph Doherty 409a58b624 fix(modbus): lifecycle gate + non-vacuous reprobe regression test 2026-08-16 04:07:27 -04:00
Joseph Doherty 140bf0c131 perf(adminui): pooled DbContext factory; role-grants reads per-call, not per-circuit 2026-08-16 04:05:34 -04:00
Joseph Doherty 34f836e03c perf(mtconnect): sample chunks parse from bytes, no per-chunk string copies 2026-08-16 04:05:15 -04:00
Joseph Doherty 3795899d10 perf(adminui): 5s snapshot cache in front of the script tag catalog 2026-08-16 04:05:07 -04:00
Joseph Doherty ba977dbe0d perf(adminui): raw tree renders tag rows from a projection without TagConfig 2026-08-16 04:04:32 -04:00