fix(secrets): SqlServer/Akka extensions take contentRootPath; last explicit root wins (scadaproj#31)

The SQL-Server extensions called the 3-arg AddZbSecrets, and the store-path
validator captured the content root of whichever call registered it first.
In hub mode no registration order applied the pre-host under-content-root
guard: extension-first dropped the app's 4-arg root, core-first lost the
replicator (#30). That is the 0.6.0 store-path hole, reopened.

- AddZbSecretsSqlServerStore / AddZbSecretsSqlServerReplication /
  AddZbSecretsAkkaReplication gain a trailing optional contentRootPath,
  forwarded to the 4-arg AddZbSecrets
- the root now lives in one SecretsContentRoot instance holder per service
  collection; the last explicit root wins, null never erases one; the
  IHostEnvironment fallback is unchanged
- tests: ContentRootTests (hub mode, three compositions, artifact asserted
  before the throw, positive control), last-explicit-wins theory in
  SecretsStorePathRulesTests, Akka forwarding test
- code-reviews: Secrets-002 Resolved; README regenerated

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 14:50:07 -05:00
parent 015c556ced
commit c3b07d6766
10 changed files with 272 additions and 18 deletions
+8
View File
@@ -18,6 +18,14 @@ Fixes six scadaproj#15 code-review findings (`code-reviews/Secrets/findings.md`)
the SQLite store (shared-store mode) or the `NoOpSecretReplicator` (hub and Akka modes). They now
replace those registrations after the core call; a later `AddZbSecrets` only `TryAdd`s, so either
order yields the same graph, and exactly one `ISecretStore` is registered.
- **The SQL-Server and Akka extensions take a `contentRootPath`** (scadaproj#31, Secrets-002), and the
store-path validator's content root is now **the last explicitly supplied one** across all
`AddZbSecrets` calls (a `null` root never erases an earlier explicit one). Before, the first call to
register the validator captured the root, so a package's internal 3-arg call that ran first silently
dropped the application's 4-arg root and the pre-host under-content-root guard was skipped — in hub
mode no registration order applied it. New trailing optional parameter on
`AddZbSecretsSqlServerStore`, `AddZbSecretsSqlServerReplication` and `AddZbSecretsAkkaReplication`
(source-compatible; callers recompile). Pass it from every pre-host composition.
## 0.6.5 — unreleased (NOT published to the feed)