---
title: Wire the data-view SQL validity gate into CI
type: task
status: planned
description: >-
  check-data-view-sql-validity.mjs is a required manual gate that is not in CI, so an emitted-SQL
  break can land on master and deploy before anyone runs it by hand.
base_uri: user:task/league/data-views/wire-data-view-sql-validity-gate-into-ci.md
created_at: '2026-09-22T15:33:06.551Z'
entity_id: 3a9244da-5630-4b9c-a1bc-2c80e6860f2b
observations:
  - ████████████████████████████████████████████████
owner_identity_uri: █████████████████████████
priority: Medium
public_read: true
tags:
  - user:tag/league-xo-football.md
  - user:tag/software-task.md
updated_at: '2026-10-09T21:14:11.489Z'
visibility_analyzed_at: '2026-11-05T23:49:05.215Z'
---

## Problem

`db/adhoc/check-data-view-sql-validity.mjs` is a required manual gate documented in league `CLAUDE.md` and it is not wired into CI. It is detective rather than preventive today: a break can land on master and deploy before anyone runs it by hand.

This was recorded only as a `[decision]` observation on the now-Completed `████████████████████████████████████████████████████████` and was carried forward by a continuation with no task of its own, so it had no ranked home until now.

## Why this is CI wiring, not a new test

The gate provisions its own throwaway database precisely because it is incompatible with `test/global.mjs`, which drops and reloads tables on a shared one. Nothing needs to be written; it needs a job.

## Cost, which is the reason it was deferred

The gate takes about 40s and EXPLAINs about 4500 statements, so it is not free per push. Weigh against [[user:guideline/software/conserve-ci-minutes.md]] — note that guideline's per-push billing premise has LAPSED, since league runs CI on self-hosted runners, so the argument against wiring it is weaker than when this was first deferred. Re-read the current runner setup before deciding cadence.

## A known blind spot that must be recorded wherever it lands

The gate never exercises `sort`. It reported GATE OK on the same tree where three production URLs failed to EXPLAIN. Wiring it into CI must not be allowed to read as full coverage of the emitted-SQL surface.

## Plan

- [ ] **Decide the cadence** — every push, or a scheduled run. The self-hosted runner changes this calculus from what the original deferral assumed.
- [ ] **Wire the job**, giving it its own throwaway database rather than the shared test one.
- [ ] **Record the `sort` blind spot** in the job description or the workflow file, so a green gate is not misread as full coverage.
- [ ] **Decide whether to close the blind spot** or leave it stated — a separate call from wiring the gate.

## Verification

A deliberately broken emitted statement on a scratch branch turns the job red; the same branch with the break reverted turns it green.
