Skip to content

CI: execute every report view against seeded rows (#1669) - #1677

Merged
erikdarlingdata merged 4 commits into
devfrom
feature/1669-report-view-execution
Jul 26, 2026
Merged

CI: execute every report view against seeded rows (#1669)#1677
erikdarlingdata merged 4 commits into
devfrom
feature/1669-report-view-execution

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Closes #1669 — the follow-through on the #1635/#1666 bug class: views that compile and exist but only fail (or corrupt) when rows flow through the projection. ci_validate_installation.sql checks report.* by OBJECT_ID alone.

What's added

  • .github/sql/ci_seed_report_sources.sql — one guarded representative row per collect/config table, generated from the installed schema (NOT NULL/non-identity/non-computed columns get type-appropriate values; nullable columns stay NULL so those branches execute; compressed-LOB columns get real COMPRESS() payloads; timestamps land 5 minutes back so "today"/"last hour" windows include them). The three change-history tables get hand-authored correlated PAIRS (trace flag OFF→ON, server knob changed, database setting changed) so the LAG/toggle views emit actual rows. Every insert is guarded on the table being empty — re-runnable anywhere, inert on real data.
  • .github/sql/ci_execute_report_views.sql — enumerates sys.views in the report schema at run time and materializes each with SELECT * INTOCOUNT(*) would let the optimizer prune the projection and skip exactly the per-row conversions this exists to catch. Failures are collected and re-thrown as one error listing every broken view; sqlcmd -b turns that into a red job. Dynamic enumeration covers future views automatically and tolerates the collection-time-built report.query_snapshots pair being absent on a fresh install.
  • .github/sql/ci_generate_seed_rows.sql — dev tool (not run by CI) to regenerate the seed section after schema changes.
  • sql-validation.yml — two new steps after installation validation, across the full 2017/2019/2022/2025 matrix. The workflow paths-filter includes .github/sql/** and the workflow file, so this PR's own checks run the new sweep end-to-end on all four versions.

Validation

🤖 Generated with Claude Code

The SQL-validation workflow checked report.* views by OBJECT_ID only,
which let two same-class bugs ship (#1635 Msg 245, #1666 sql_variant
boxing) - views that compile and exist but only misbehave when rows
flow through the projection.

- ci_seed_report_sources.sql: one guarded representative row per
  collect/config table (generated from the installed schema; NOT NULL
  columns typed, nullable stay NULL, LOB columns COMPRESS()ed), plus
  hand-authored correlated pairs in the three change-history tables so
  the LAG/toggle views produce output rows. Empty-table guards make it
  inert anywhere data already exists.
- ci_execute_report_views.sql: enumerate sys.views in the report
  schema, materialize each with SELECT * INTO (COUNT(*) would prune
  the projection and skip the per-row conversions), collect failures,
  THROW with the list. Dynamic enumeration covers new views on arrival
  and tolerates the collection-time-built query_snapshots pair.
- ci_generate_seed_rows.sql: dev tool that regenerates the seed
  section after schema changes.
- sql-validation.yml: two new steps after installation validation, on
  the full 2017/2019/2022/2025 matrix; this PR's own run exercises
  them end-to-end.

Validated locally against a full install on SQL Server 2022: 41 views
executed clean; a planted per-row Msg 245 poison view flips the sweep
red and the THROW propagates through sqlcmd -b.

Closes #1669

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The generated section carried collect.query_stats_old - a leftover
from the #1673 validation store the generator ran against, absent on
a fresh CI install (Msg 208 across all four matrix legs). Dropped the
leftover, cross-checked every seeded table name against install/*
(54/54 present), and re-validated locally: seed twice clean, sweep 41
views / 0 failed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
erikdarlingdata and others added 2 commits July 26, 2026 10:20
SQL Server on Linux begins at 2017 - no 2016 container image exists -
so the minimum-supported version cannot ride this workflow. Validated
manually against the local SQL2016 box (13.0.6300) with the exact same
sequence: full install surface clean, seeds clean, view execution
sweep 41/41 with zero failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@erikdarlingdata

Copy link
Copy Markdown
Owner Author

SQL Server 2016 coverage (the min-supported version the matrix can't include — SQL Server on Linux starts at 2017, so no 2016 container image exists):

Ran the identical sequence manually against the local SQL2016 box (13.0.6300), scratch database, fixture PerformanceMonitor DB untouched:

  • full install surface (01–51 minus agent/test scripts): clean
  • ci_seed_report_sources.sql: clean, twice
  • ci_execute_report_views.sql: 41 views executed, 0 failed

The matrix now carries a comment recording why 2016 is absent and that it's validated manually as part of release testing.

@erikdarlingdata
erikdarlingdata merged commit e41c70a into dev Jul 26, 2026
8 checks passed
@erikdarlingdata
erikdarlingdata deleted the feature/1669-report-view-execution branch July 26, 2026 14:57
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