Code review 2026-12-02 WP2: Config and transport data integrity #153

Closed
opened 2026-12-02 16:06:53 -05:00 by dohertj2 · 1 comment
Owner

From the 2026-12-02 full code review (commits 28b6651a, f7e4f5b4: decisions accepted 2026-12-03).

  • Findings: docs/plans/2026-12-02-full-code-review.md
  • Plan: docs/plans/2026-12-02-full-code-review-remediation.md → WP2
Task Findings Change Verify
2.1 TRN-1 Add .Include(Recipients) to GetListByNameAsync. Decided: fix the repository method, so every caller gets the recipients; don't just switch the importer to the bulk lookup. Import Overwrite test: the target list {A,B} + bundle {A,C} must end as {A,C}, and stay that way after a re-import.
2.2 TPL-1, TPL-5 Resolve alarm on-trigger script references per composition chain, not through the global scriptCanonicalById. A two-slot test and a nested-slot override test. Their revision hashes change by design, so note that in the commit.
2.3 TPL-2 A derived script override keeps the base alarm's on-trigger link (resolve by name). Unit test.
2.4 TRN-2, TRN-6 The diff compares the secret-bearing values by hash, which keeps them presence-only to the operator. The instance diff covers the bound connection and drops the never-written field. Diff tests.
2.5 TRN-3, TRN-7, TRN-8, TRN-9 Preview applies the name map. Site-scoped lookups are case-insensitive. Areas match by full path. Rename either works for every kind or is rejected where unsupported. Importer tests. Re-run the reflection round-trip guard.
2.6 TRN-4, TRN-5 Template Overwrite removes compositions that aren't in the bundle. The composition rewire also deletes the slot-owned derived templates. Importer tests against a real context.
2.7 TRN-10 Clamp the manifest KDF iteration count to a sane range. Unit test.
2.8 CLI-2 Update commands only send options that were actually passed. Decided: preserve-if-null on the server. The update command fields become nullable and the handler applies if (cmd.X is not null). Fetch-and-merge in the CLI was rejected: the fetch returns scrubbed secrets, so merging would write the placeholders back, and it races concurrent edits. CLI tests per update command.
2.9 DEP-3 Widen PerSiteStatus to nvarchar(max). Migration + SQL script.
From the 2026-12-02 full code review (commits 28b6651a, f7e4f5b4: decisions accepted 2026-12-03). - Findings: `docs/plans/2026-12-02-full-code-review.md` - Plan: `docs/plans/2026-12-02-full-code-review-remediation.md` → WP2 | Task | Findings | Change | Verify | |---|---|---|---| | 2.1 | TRN-1 | Add `.Include(Recipients)` to `GetListByNameAsync`. **Decided:** fix the repository method, so every caller gets the recipients; don't just switch the importer to the bulk lookup. | Import Overwrite test: the target list {A,B} + bundle {A,C} must end as {A,C}, and stay that way after a re-import. | | 2.2 | TPL-1, TPL-5 | Resolve alarm on-trigger script references per composition chain, not through the global `scriptCanonicalById`. | A two-slot test and a nested-slot override test. Their revision hashes change by design, so note that in the commit. | | 2.3 | TPL-2 | A derived script override keeps the base alarm's on-trigger link (resolve by name). | Unit test. | | 2.4 | TRN-2, TRN-6 | The diff compares the secret-bearing values by hash, which keeps them presence-only to the operator. The instance diff covers the bound connection and drops the never-written field. | Diff tests. | | 2.5 | TRN-3, TRN-7, TRN-8, TRN-9 | Preview applies the name map. Site-scoped lookups are case-insensitive. Areas match by full path. Rename either works for every kind or is rejected where unsupported. | Importer tests. Re-run the reflection round-trip guard. | | 2.6 | TRN-4, TRN-5 | Template Overwrite removes compositions that aren't in the bundle. The composition rewire also deletes the slot-owned derived templates. | Importer tests against a real context. | | 2.7 | TRN-10 | Clamp the manifest KDF iteration count to a sane range. | Unit test. | | 2.8 | CLI-2 | Update commands only send options that were actually passed. **Decided:** preserve-if-null on the server. The update command fields become nullable and the handler applies `if (cmd.X is not null)`. Fetch-and-merge in the CLI was rejected: the fetch returns scrubbed secrets, so merging would write the placeholders back, and it races concurrent edits. | CLI tests per update command. | | 2.9 | DEP-3 | Widen `PerSiteStatus` to `nvarchar(max)`. | **Migration + SQL script.** |
dohertj2 added the type:review-findingpriority:p0 labels 2026-12-02 16:06:53 -05:00
Author
Owner

Fixed on main (pushed, 922021c4). Plan: docs/plans/2026-12-02-full-code-review-remediation.md (see its Outcome section).

All 9 tasks done.

Behaviour changes:

  • Revision hash (2.2): instances with multi-slot compositions, derived on-trigger overrides or nested-slot overrides read Out of date once after upgrade. This is correct.
  • Partial updates (2.8): site, data-connection and api-method update are preserve-if-null; an empty string clears a field.
  • Import diff: a changed secret shows as Modified without revealing the value.
  • Import mapping: the preview applies the name map; lookups are case-insensitive; areas match by full path; Rename is rejected for Site, DataConnection, SMTP and SMS.

Follow-up: bundle schemaVersion bumped 1.2 → 1.3 for AreaPath (3f98d40f).

Migration: WidenSystemArtifactPerSiteStatus, with a SQL script.

Rig: site update --id N --name X keeps both gRPC and both Akka addresses.

Commits:

  • 937fec1c feat(config-db): migration WidenSystemArtifactPerSiteStatus (DEP-3, WP2 task 2.9)
  • 7eabb822 fix(config-db): unbound SystemArtifactDeploymentRecord.PerSiteStatus (DEP-3, WP2 task 2.9)
  • baecf10f fix(transport): import diff compares secrets and bindings; preview honours the name map; CI lookups; area paths; no Rename where unsupported (TRN-2, TRN-3, TRN-6, TRN-7, TRN-8, TRN-9, WP2 tasks 2.4+2.5)
  • cbdd9fc4 fix(transport): template Overwrite clears compositions and cascades removed slots' derived templates (TRN-4, TRN-5, WP2 task 2.6)
  • fe60c4a1 fix(template-engine): resolve alarm on-trigger scripts by name per composition chain (TPL-1, TPL-2, TPL-5, WP2 tasks 2.2+2.3)
  • 61c6278b fix(cli): site/data-connection/api-method update are preserve-if-null partial updates (CLI-2, WP2 task 2.8)
  • c207809e fix(transport): range-check the manifest KDF iteration count before deriving the key (TRN-10, WP2 task 2.7)
  • f42c17d2 fix(transport): notification-list Overwrite replaces recipients instead of appending (TRN-1, WP2 task 2.1)

Deploying to QA and DEV is tracked in #160. Closing.

Fixed on `main` (pushed, `922021c4`). Plan: `docs/plans/2026-12-02-full-code-review-remediation.md` (see its Outcome section). All 9 tasks done. **Behaviour changes:** - **Revision hash (2.2):** instances with multi-slot compositions, derived on-trigger overrides or nested-slot overrides read *Out of date* once after upgrade. This is correct. - **Partial updates (2.8):** `site`, `data-connection` and `api-method` update are preserve-if-null; an empty string clears a field. - **Import diff:** a changed secret shows as Modified without revealing the value. - **Import mapping:** the preview applies the name map; lookups are case-insensitive; areas match by full path; Rename is rejected for Site, DataConnection, SMTP and SMS. **Follow-up:** bundle `schemaVersion` bumped 1.2 → 1.3 for `AreaPath` (3f98d40f). **Migration:** `WidenSystemArtifactPerSiteStatus`, with a SQL script. **Rig:** `site update --id N --name X` keeps both gRPC and both Akka addresses. **Commits:** - 937fec1c feat(config-db): migration WidenSystemArtifactPerSiteStatus (DEP-3, WP2 task 2.9) - 7eabb822 fix(config-db): unbound SystemArtifactDeploymentRecord.PerSiteStatus (DEP-3, WP2 task 2.9) - baecf10f fix(transport): import diff compares secrets and bindings; preview honours the name map; CI lookups; area paths; no Rename where unsupported (TRN-2, TRN-3, TRN-6, TRN-7, TRN-8, TRN-9, WP2 tasks 2.4+2.5) - cbdd9fc4 fix(transport): template Overwrite clears compositions and cascades removed slots' derived templates (TRN-4, TRN-5, WP2 task 2.6) - fe60c4a1 fix(template-engine): resolve alarm on-trigger scripts by name per composition chain (TPL-1, TPL-2, TPL-5, WP2 tasks 2.2+2.3) - 61c6278b fix(cli): site/data-connection/api-method update are preserve-if-null partial updates (CLI-2, WP2 task 2.8) - c207809e fix(transport): range-check the manifest KDF iteration count before deriving the key (TRN-10, WP2 task 2.7) - f42c17d2 fix(transport): notification-list Overwrite replaces recipients instead of appending (TRN-1, WP2 task 2.1) Deploying to QA and DEV is tracked in #160. Closing.
Sign in to join this conversation.