Skip to content

CI: run the sp_PerfCheck and sp_HumanEvents assertion harnesses - #833

Merged
erikdarlingdata merged 7 commits into
devfrom
ci/harnesses-in-ci-phase1
Jul 18, 2026
Merged

CI: run the sp_PerfCheck and sp_HumanEvents assertion harnesses#833
erikdarlingdata merged 7 commits into
devfrom
ci/harnesses-in-ci-phase1

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

The sql-tests workflow only ran basic-execution and help-output smoke tests, so the assertion harnesses ran only when someone remembered to. That gap is exactly how behavioral regressions shipped this cycle — a harness existed but nothing ran it. This wires the two self-contained harnesses into CI so they run on every push to dev and every PR, across the 2017/2019/2022/2025 matrix.

Why only these two (for now)

sp_PerfCheck and sp_HumanEvents build and drop their own scratch databases, Extended Events sessions, and configuration — no external data needed. sp_IndexCleanup and sp_QueryReproBuilder depend on StackOverflow2013, which the CI containers don't have; those are a later phase (their fixtures need to build their own data).

How

  • The harnesses were written and validated against the go-based sqlcmd, so CI installs that package (already in the Microsoft apt repo it configures) alongside mssql-tools18, rather than risk output-parsing differences from a different client.
  • Harness sqlcmd invocation is now configurable via SQLCMD_BIN (default sqlcmd) and SQLCMD_CONN_ARGS (default empty), so the same code runs locally unchanged and in CI with -C to trust the container cert.

Validation

  • Both changes are no-ops locally — harnesses still pass 53/53 and 195/195 against SQL2022.
  • The CI run on this PR is the real cross-environment validation (the go-sqlcmd-against-container path can't be exercised on a dev laptop). Watching the two new steps across the version matrix.

Tests + CI only — no procedure .sql touched, no version bumps.

🤖 Generated with Claude Code

erikdarlingdata and others added 7 commits July 18, 2026 05:58
The sql-tests workflow only ran basic-execution and help-output smoke tests, so
the assertion harnesses added recently ran only when someone remembered to. That
gap is exactly how behavioral regressions shipped: a harness existed but nothing
ran it. This wires the two self-contained harnesses into CI so they run on every
push to dev and every PR, across the 2017/2019/2022/2025 matrix.

PerfCheck and HumanEvents build and drop their own scratch databases, Extended
Events sessions, and configuration, so they need no external data - unlike the
IndexCleanup and ReproBuilder harnesses, which depend on StackOverflow2013 that
the CI containers do not have (a later phase).

The harnesses were written and validated against the go-based sqlcmd, so CI now
installs that package (already available from the Microsoft apt repo it
configures) alongside mssql-tools18, rather than risk output-parsing differences
from a different client. The harnesses' sqlcmd invocation is made configurable
through two environment variables - SQLCMD_BIN (default "sqlcmd") and
SQLCMD_CONN_ARGS (default empty) - so the same code runs locally unchanged and in
CI with "-C" to trust the container's self-signed certificate. Both changes are
no-ops locally: harnesses still pass 53/53 and 195/195 against SQL2022.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… runners)

The 'sqlcmd' apt package is not in the Microsoft repo for the ubuntu-noble
runners (E: Unable to locate package sqlcmd). Pull the latest linux-amd64
go-sqlcmd release binary instead, install to /usr/local/bin/sqlcmd, and point the
harness steps at it explicitly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e procs

The harnesses connect to master (as on a local box), but CI installed the procs
only into DarlingData_CI_Test, so the preflight reported sp_PerfCheck missing.
Add a master install before the harness steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…s runs on Linux

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On Linux SQL Server sys.traces still lists a default trace, but
fn_trace_gettable cannot read it there and raises Msg 19049, which
aborted the whole procedure before it returned any findings. Wrap the
default-trace read in TRY/CATCH: on failure leave #trace_events empty
(the trace-based checks below then simply find nothing) and record one
informational finding (check_id 5004) noting the trace was unreadable.
Also covers a missing or corrupt trace file on Windows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The go-sqlcmd the harnesses use failed to connect to the SQL Server 2017
container instantly: the modern Go TLS stack rejects that old container's
self-signed certificate outright, and -C (trust cert) does not bypass it,
so the harness read the empty result as "proc not installed." Disable
encryption (-N disable) so no TLS handshake happens - there is nothing to
secure on a localhost throwaway container. Removes the temporary
continue-on-error on the sp_PerfCheck step now that it degrades cleanly
on Linux and passes there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The "zero net configuration change" meta-assertion failed on the SQL
Server 2017 CI container: its image ships 'clr strict security' configured
on but not yet in use (value=1, value_in_use=0), a staged change. The
harness's own RECONFIGURE (for its SAFE_OPTIONS) applied that pending
change mid-run, so it surfaced as a net config change the harness never
made. Issue RECONFIGURE before capturing the baseline so the comparison
measures only the harness's own effect. Verified by staging an equivalent
pending change locally: fails without this, passes with it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@erikdarlingdata
erikdarlingdata merged commit 68c0e03 into dev Jul 18, 2026
5 checks passed
@erikdarlingdata
erikdarlingdata deleted the ci/harnesses-in-ci-phase1 branch July 18, 2026 10:53
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