Skip to content

test: measure SQL Server MCP read-safety controls and process topology against a local container #9892

Description

@kyle-sexton

Refs #5940. Slice 4 of 7. Blocked by #9849 (slice 2, the server). Runs in parallel with slice 3.

Problem

#5940 S3 and F10 require read-safety defaults and the process topology to be backed by a recorded local measurement before they become defaults. Read Committed Snapshot Isolation is off on SQL Server including the Linux container, so plain reads take shared locks there.

Fix

Add a measurement script in the plugin that, against a local SQL Server Linux container:

  • runs the read tool against a table while a second session updates it, with and without each read control the ADR chose (LOCK_TIMEOUT, pinned isolation, row cap with prompt cancel, request timeout with rollback), and records blocked time, lock waits, and any transaction left open (sys.dm_tran_session_transactions) after a timeout;
  • starts N concurrent server processes (per-session topology) against the same database and records connection count and blocking.

Write the results and the chosen defaults to a doc in the plugin (docs/ or reference/), dated, with the container image tag. Set the server's defaults to the measured values.

Done when

  • The measurement script named in the doc exits 0 on a Linux host with Docker and writes its result table
  • The doc's table shows zero open transactions after a forced timeout with the chosen defaults: grep -c 'open transactions after timeout: 0' <doc> prints 1 or more
  • The server's default values match the doc's chosen row (a unit test asserts each default)
  • ci-status is green on the PR head

Activity

  1. added
    needs-triage
    on Oct 24, 2026
  2. github-actions commented on Oct 24, 2026

    @github-actions
    Contributor

    Proposed work class: work-class: scoped
    Basis: automated intake triage; the lanes App applied this class.

    Size: Medium
    Complexity: High
    Uncertainty: Knowable
    Flags: none
    Blocked by: #9849

    Understood: add a measurement script to the SQL Server MCP plugin. It runs against a local SQL Server Linux container and compares read controls (lock timeout, pinned isolation, row cap, request timeout) and per-session process topology. It writes a dated results doc with the image tag and sets the server defaults to the measured values, with a unit test per default. This depends on the server from #9849, which is still open. The Docker-host run in the first done-when item can't be done by an unattended lane run, so that part is held for a person.

    Automated triage, applied by the lanes App.

  3. added and removed
    needs-triage
    on Oct 24, 2026
  4. added
    status: ready
    on Oct 24, 2026
  5. melodic-automation-lanes commented on Oct 24, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane yet: blocker #9849 is not closed by a listed human or a merge.

  6. 2 remaining items

  7. added
    agent-ready
    and removed
    agent-ready
    on Oct 31, 2026
  8. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor
    No description provided.
  9. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor
    No description provided.
  10. added
    host-run
    and removed
    agent-ready
    on Oct 31, 2026
  11. melodic-automation-lanes commented on Oct 31, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue lane stopped on this issue (host-only): the run reports the work needs a host run the lane cannot make.
    It added host-run and removed agent-ready: an agent run on a host builds it, and it waits on no decision from a person.

    In the run's words:

    host-only: every done-when item but the CI one rests on a recorded run of a new measurement script against a local SQL Server Linux container, and both the doc's result table and the server's new defaults must come from that run. This lane's Bash runs only its named check wrappers, with no docker and no node, so it can neither start the container nor run the script or the plugin's node tests, and writing measured values it did not measure would be made up. A host run with Docker and Node 22 needs to write and run the script, record the dated results with the image tag, and set the defaults from them.

    What the run says it did not do:

    • Done-when 1, the measurement script exiting 0 on a Linux host with Docker and writing its result table: not written, because this lane cannot run Docker or Node to start the container or test the script
    • Done-when 2, the doc's table showing 'open transactions after timeout: 0' for the chosen defaults: not written, because that line must come from a real run of the script
    • Done-when 3, the server's defaults matching the doc's chosen row with a unit test per default: not changed, because the chosen row does not exist until the measurement runs
    • Done-when 4, ci-status green on the PR head: no PR, since nothing changed
    • tidy, review, verify and checks prep steps: skipped, because the run made no change for them to cover

    Run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41231391132

    To hand it back to the lane, remove host-run and add agent-ready again.

  12. kyle-sexton commented on Oct 31, 2026

    @kyle-sexton
    MemberAuthor

    Host run. The new plugins/sql-server/scripts/measure-read-safety.mjs ran against a local SQL Server 2025 Linux container (Docker, --memory 2g), and its results and the chosen defaults went to PR #11686.

    Blocker: #9849 is still open, but only as the tracker. Its decision comment re-pointed this issue to slice C, #11327, which closed on 2026-10-31 when #11550 merged. The server and executor are on main.

    What ran (Claude Code 2.1.316, Node 24, Docker 29.9.2):

    • npm ci --ignore-scripts --no-audit --no-fund in plugins/sql-server.
    • node scripts/measure-read-safety.mjs against mcr.microsoft.com/mssql/server:2025-CU8-ubuntu-24.04 (sha256:4bab24f3…d512e1), SQL Server 17.0.4075.5 Developer, with RCSI, ADR and optimized locking off. Each run created a container with a generated name and an SA password generated for that run, never written or logged, and removed the container when it finished. The final run exited 0 and rewrote the results block of plugins/sql-server/reference/read-safety-measurement.md.
    • npm test --prefix plugins/sql-server: 125 passed. Changing the doc's chosen lockTimeoutMs made defaults.test.mjs fail.
    • scripts/check-affected.sh --tests on the committed head: 13 passed, 3 skipped. check-cant-fail-scan.sh and check-test-tmp-cleanup.sh --check were clean.

    Key numbers:

    • With no controls, a read blocked for the writer's full 8000 ms hold. Lock timeouts of 500 to 5000 ms ended the read within 83 ms of the value, and request timeouts of 1000 and 3000 ms within 72 ms. Every one left 0 open transactions.
    • A raw session cancelled inside BEGIN TRAN with XACT_ABORT OFF and kept open held 1 transaction. That is what the executor's discard rule prevents.
    • A writer waited 4 ms on a READ COMMITTED reader transaction and about 3000 ms under REPEATABLE READ or SERIALIZABLE.
    • The row cap cancelled promptly: 1000 rows took 60 ms, against 277 ms for all 200000.
    • Forced timeouts at the shipped defaults: lock timeout at 5079 ms and request timeout at 30205 ms, each with open transactions after timeout: 0.
    • Topology: 2 sessions per busy process. With 1 or 2 processes no request was blocked. With 4 and 8 processes up to 2 and 5 requests were briefly blocked, and the writer's slowest update was 217 ms.

    Defaults: the measurement backs the existing values, which are no longer provisional: 30000 ms request timeout, 5000 ms lock timeout, 1000-row cap, READ COMMITTED, pool of 2, 30000 ms idle close, and one process per registration.

    Done when:

    Not verified:

    • The run used a tedious that trusts the container's self-signed certificate, because config.v1 has no option for that.
    • The @@TRANCOUNT check was not reached. Through query, error 266 stops a statement that opens a transaction first.
    • Lock hold under a slow consumer was not measured.
    • The cause of the blocking at 4 and 8 processes was not separated.
    • IDLE_TIMEOUT_MS was not stressed.
    • Azure SQL Database was not measured.

    PR: #11686

    Target labels: add none; remove host-run.

  13. removed
    host-run
    on Oct 31, 2026
  14. kyle-sexton commented on Oct 31, 2026

    @kyle-sexton
    MemberAuthor

    Host run, correction. The figures in the earlier host-run comment came from a run before review fixes. The final script on #11686 head 21ef5ba was rerun: forced timeouts at the defaults read 5076 ms (lock) and 30154 ms (request), each with open transactions after timeout: 0; at 8 processes 1 request was briefly blocked and the writer's slowest update was 162 ms. The PR body and the plugin doc carry the committed results; the defaults are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: ready

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions