Skip to content

Fix: create config.remediation_action_log in install/, not the upgrade folder#1051

Merged
erikdarlingdata merged 2 commits into
devfrom
fix/remediation-log-install-not-upgrade
Jun 2, 2026
Merged

Fix: create config.remediation_action_log in install/, not the upgrade folder#1051
erikdarlingdata merged 2 commits into
devfrom
fix/remediation-log-install-not-upgrade

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Problem (release-blocking)

config.remediation_action_log (the B3 Apply-Fix audit table, new in 2.12.0) was placed only in upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql and nowhere in install/. The installer runs the upgrade folders only when upgrading from a prior version; a fresh 2.12.0 install runs install/* only — so it never created the table. Result: on a fresh install every privileged remediation (force-plan, DB-config, RCSI, clear-plan) hits its audit-table-absent hard block → the whole Apply-Fix feature is dead.

This also violated the rule that upgrades/{from}-to-{to}/ is for schema changes to EXISTING objects only (ALTER ADD COLUMN / change datatype / nullable). New tables + view/proc code belong in install/* (idempotent), which the installer runs on both fresh installs and upgrades (Installer/Program.cs runs upgrade folders, then re-runs install/*).

Fix

  • Move the table's CREATE (final shape, incl. consent_acknowledged) into install/03_create_config_tables.sql (the config.* home), inside config.ensure_config_tables, with the same IF OBJECT_ID(...) IS NULL guard / @tables_created increment / config.collection_log entry as its sibling tables. → created on fresh AND upgrade.
  • Delete upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql + its upgrade.txt line; renumber 03_make_other_process_cpu_nullable.sql02_.
  • The upgrade folder now holds only legitimate ALTER-existing-object scripts (01 add columns, 02 make column nullable).

Validation

  • upgrade-path-validator: PASS — column shape byte-equivalent to the deleted script (all 17 columns, same types/nullability, constraint names preserved); idempotent block won't break config.ensure_config_tables; no dangling references; both fresh and upgrade create it.
  • Maintainer pre-merge gate: Installer fresh install (table present) + upgrade from 2.11.0 (table present) on a throwaway/SQL2022 DB.

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits June 2, 2026 18:25
…e folder

The B3 Apply-Fix audit table (config.remediation_action_log) was placed ONLY in
upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql and nowhere in
install/. A FRESH 2.12.0 install therefore never created it, so every privileged
remediation (force-plan, DB-config, RCSI, clear-plan) would hit its
audit-table-absent hard block on a clean install.

The upgrade folder is for schema changes to EXISTING objects only (ALTER ADD
COLUMN, change datatype, nullable). New tables and view/proc code belong in
install/* (idempotent), which the installer runs on BOTH fresh installs and
upgrades (Installer/Program.cs runs upgrade folders, then re-runs install/*).

- Move the table's CREATE (final shape incl. consent_acknowledged) into
  install/03_create_config_tables.sql, inside config.ensure_config_tables, with
  the same IF OBJECT_ID guard / @tables_created increment / collection_log entry
  as its siblings. Created on fresh AND upgrade.
- Delete upgrades/2.11.0-to-2.12.0/02_create_remediation_action_log.sql and its
  upgrade.txt line; renumber 03_make_other_process_cpu_nullable.sql -> 02_.
- The upgrade folder now holds only ALTER-existing-object scripts (01 add
  columns, 02 make column nullable).

Verified by upgrade-path-validator: column shape identical to the deleted
script; idempotent; no dangling references; fresh + upgrade both create it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lock

The header comment contained "install/*" twice; in a T-SQL block comment /* opens
a NESTED comment, so the closing */ closed the nested one and left the outer
comment unterminated -> "Missing end comment mark '*/'" aborted 03_create_config_tables.
Reworded to "the install scripts" (no /* sequence). Verified by a clean fresh
install on SQL2022 (exit 0): config.remediation_action_log created with all 17
columns incl. consent_acknowledged, action varchar(32); PerformanceMonitor DB online.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit a63af58 into dev Jun 2, 2026
6 checks passed
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