Skip to content

sp_IndexCleanup rule_coverage: create Crap scratch DB; wire into CI - #835

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/rule-coverage-scratch-db
Jul 18, 2026
Merged

sp_IndexCleanup rule_coverage: create Crap scratch DB; wire into CI#835
erikdarlingdata merged 1 commit into
devfrom
fix/rule-coverage-scratch-db

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Roots out why rule_coverage_test.py failed on the CI containers, fixes it, and adds it as the fourth IndexCleanup runner in CI.

Root cause (a test-harness gap, not a proc bug)

rule_coverage_test.py assumed a pre-existing Crap database. On a long-lived instance it persists between runs; on a fresh container it has never existed. The setup connects with -d Crap, so it failed with Msg 4060 ("Cannot open database"), Level 11 — below the harness's Level-16 error check — so setup silently no-op'd and every Crap-scoped assertion failed with "found 0". This looked like the procedure dropping PAGE compression recommendations on freshly-started servers, but a direct diagnostic on a fresh container proved the procedure emits them correctly (single-table, multi-table, both sqlcmd tools). No proc change.

Fix

  • Create Crap if absent (CrapA/CrapB were already created this way).
  • Treat Msg 4060/911 as fatal in sql_errors, so a missing scratch database fails loudly instead of leaving the suite green.
  • Re-include rule_coverage_test.py in the CI IndexCleanup step (now all four runners).

Verification

Dropping Crap on a local instance reproduces the CI failure exactly; with the fix it passes 40/40.

🤖 Generated with Claude Code

rule_coverage_test.py assumed a pre-existing Crap database. On a long-lived
instance it persists between runs (nothing drops it), so the gap was
invisible; on a freshly-started instance -- every CI container -- Crap has
never existed. run_sql_script connects with -d Crap, so setup failed with
Msg 4060 ("Cannot open database"), which is Level 11 and slipped past the
Level-16 error check: the fixture silently did not build and every
Crap-scoped assertion failed with "found 0". This masqueraded as a
procedure bug (missing PAGE compression recommendations); it was not -- the
procedure emits them correctly on a fresh instance, confirmed directly.

Create Crap if absent (CrapA/CrapB were already created this way) and treat
Msg 4060/911 as fatal in sql_errors so a missing scratch database fails
loudly instead of leaving the suite green. rule_coverage now runs on a fresh
instance, so wire it back into CI as the fourth IndexCleanup runner.

Verified by dropping Crap on a local instance: fails identically to CI
without the fix, passes 40/40 with it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@erikdarlingdata
erikdarlingdata merged commit 69e4488 into dev Jul 18, 2026
5 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/rule-coverage-scratch-db branch July 18, 2026 12:43
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