Skip to content

Recommendations: per-database RCSI consent cards (reader/writer-gated, contention-scored)#1069

Merged
erikdarlingdata merged 2 commits into
devfrom
feature/recs-rcsi-consent
Jun 7, 2026
Merged

Recommendations: per-database RCSI consent cards (reader/writer-gated, contention-scored)#1069
erikdarlingdata merged 2 commits into
devfrom
feature/recs-rcsi-consent

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Per-database RCSI (enable READ_COMMITTED_SNAPSHOT) recommendation cards, each Apply-able behind the existing two-sided informed-consent gate. Reuses RcsiHandler + SetDatabaseOptionAsync + FactRiskDisclosure unchanged — the new code only carries data + fans cards.

  • RemediationAction gains RcsiTarget (db + RcsiInactionFigures) carried on the DB_CONFIG action for the reader (never executed from there — DbConfigHandler ignores it). CollectRcsiTargets collects qualifying rcsi-off dbs; BuildAction populates them; BuildRcsiAction builds from the same list. DTO round-trips them.
  • Reader fans each into a per-db RCSI card whose Apply reconstructs a FactKey="RCSI" action with the db's figures → dispatches to RcsiHandler + the consent gate rendering real numbers.

Reader/writer contention gate

RCSI only relieves reader-vs-writer blocking. The gate is the reader/writer share (>= FactRiskDisclosure.ReaderWriterMeaningfulPct), classified from the blocked-process report's lock modes — not raw blocking/deadlock counts. Writer/writer-dominant contention (X/IX/U) does not trigger an RCSI card.

Contention-based severity

The RCSI card's severity reflects the blocking it would relieve (its inaction risk), not the flat config band: ≥100 blocking events or ≥10 deadlocks → Critical; ≥10 or ≥1 → Warning; else Info. (An RCSI rec was sitting at Info next to a Warning blocking-spike.)

Bundled: ignore TRANSACTION_MUTEX

TRANSACTION_MUTEX (internal synchronization wait — MARS / shared transaction; not DBA-actionable) was missing from config.ignored_wait_types despite 6 other *_MUTEX waits being ignored. Added to install/03 (fresh) + an idempotent upgrade script (existing servers).

Verification

  • Security-reviewed clean (no consent bypass; db re-validated/bracketed at apply; real figures rendered; gate enforced).
  • 358 Dashboard.Tests pass (fan-out, DTO round-trip, reader/writer gate incl. writer/writer-dominant excluded, severity bands, affordance). Verified live on sql2022 (clock fix now lets windowed enrichment feed it): RCSI card surfaces Critical with 150 reader/writer blocking events; TRANSACTION_MUTEX no longer surfaced.

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits June 6, 2026 19:23
Surface per-database RCSI (enable READ_COMMITTED_SNAPSHOT) recommendation cards,
each Apply-able behind the EXISTING two-sided informed-consent gate. Reuses the
proven RcsiHandler + SetDatabaseOptionAsync + FactRiskDisclosure unchanged; the
new code only carries data + fans cards.

- RemediationAction gains RcsiTarget (db + RcsiInactionFigures) carried on the
  DB_CONFIG action purely for the reader; never executed from there (DbConfigHandler
  ignores it). FactRemediation.CollectRcsiTargets collects all qualifying rcsi-off
  dbs; BuildAction populates RcsiTargets; BuildRcsiAction builds from the same list.
- Reader fans each RcsiTarget into a per-db RCSI card (Setting=Rcsi) whose Apply
  reconstructs a FactKey="RCSI" action with the db's RcsiFigures -> dispatches to
  RcsiHandler (IsDestructive) + the two-sided consent gate, rendering REAL figures.
- AlertContext DTO round-trips RcsiTargets.
- CONTENTION GATE: RCSI is recommended only where there is meaningful READER/WRITER
  blocking (rcsi_reader_writer_pct >= FactRiskDisclosure.ReaderWriterMeaningfulPct).
  Writer/writer-dominant blocking (X/IX/U) and raw deadlock counts do NOT trigger it
  -- RCSI does not relieve those. The reader/writer share is classified from the
  blocked-process report's lock modes.

Tests: 351 Dashboard.Tests pass (fan-out, DTO round-trip, contention gate incl.
writer/writer-dominant excluded, affordance). Security-reviewed clean.

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

Two refinements from testing the RCSI cards:
- RCSI card severity now reflects the reader/writer blocking it would relieve (its
  inaction risk), not the flat config-advisory band: >=100 blocking events or >=10
  deadlocks -> Critical, >=10 or >=1 -> Warning, else Info. An RCSI rec was sitting at
  Info next to a Warning blocking-spike, which read wrong.
- TRANSACTION_MUTEX added to config.ignored_wait_types -- it is an internal
  synchronization wait (MARS / multiple requests sharing one transaction), not a
  DBA-tunable condition, and belongs with the other *_MUTEX waits already ignored. It
  was omitted from the seed. Added to install/03 (fresh) + an idempotent upgrade script
  (existing servers, listed in upgrade.txt); the wait collector filters on the list so
  it stops being collected/surfaced.

358 Dashboard.Tests pass (incl. RcsiSeverityBand boundary cases).

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