Skip to content

fix(gate): require whitespace after select in the raw-query shape#186

Merged
veksen merged 1 commit into
mainfrom
fix-gate-loose-select-shape
Jul 21, 2026
Merged

fix(gate): require whitespace after select in the raw-query shape#186
veksen merged 1 commit into
mainfrom
fix-gate-loose-select-shape

Conversation

@veksen

@veksen veksen commented Jul 21, 2026

Copy link
Copy Markdown
Member

Goal

Stop the untested-data-access CI gate from reporting false positives to users. Tracked in Query-Doctor/Site#3615 (dogfooding); the triggering PR was Site#3614, a TanStack Router route-tree regeneration.

What

Before: a PR that regenerated apps/app/src/routeTree.gen.ts was flagged as changing an untested query, listing that file under "changed data-access files with no related data-layer test". The file has no data access — it is route wiring.

After: the regeneration is not flagged. A route path no longer reads as a SQL query.

How

The gate's raw-query heuristic included /\bselect\b[\s\S]{0,300}?\bfrom\b/i. \bselect\b matched the /membership/select-plan route path because the hyphen is a word boundary, and an import from two lines down completed the shape — so a route path parsed as SELECT … FROM.

The one-line fix requires whitespace after select, as real SELECT … FROM has:

- /\bselect\b[\s\S]{0,300}?\bfrom\b/i
+ /\bselect\s[\s\S]{0,300}?\bfrom\b/i

select-plan (hyphen), select.foo (dot), select/x (slash) no longer match. Camel/underscore identifiers (selectPlan, select_plan) never matched \bselect\b, so they are unaffected. Read src/gate/test-presence.ts first (the pattern), then the tests.

Tests

src/gate/test-presence.test.ts:

  • the select-plan route path is not classified as data-access (the reported case);
  • a raw SELECT id, name FROM users still is — recall guard, so the tightening doesn't blind the raw-SQL shape;
  • the end-to-end Site#3614 regeneration produces no verdict.

Full suite green (310 tests), typecheck clean.

Refs Query-Doctor/Site#3615

The untested-data-access gate flagged apps/app/src/routeTree.gen.ts on a
route-tree regeneration PR (Site#3614). Cause: the raw `select … from` shape
matched the `/membership/select-plan` route path — `\bselect\b`'s right
boundary is the hyphen — with an import `from` two lines down completing the
shape. A route path read as a SQL query.

Require whitespace after `select`, as real `SELECT … FROM` has, so a hyphenated
(or dotted, slashed) identifier no longer reads as a query. Camel/underscore
identifiers (`selectPlan`, `select_plan`) never matched `\bselect\b` and are
unaffected.

Refs Query-Doctor/Site#3615

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Doctor Analysis

3 queries analyzed

0 regressed · 0 improved · 0 new · 0 removed

2 pre-existing issues

Using assumed statistics (10000000 rows/table). For better results, sync production stats.

More detail → get_ci_run({ runId: "019f86ed-7a5a-7a1a-82f1-23837447076e" }) · view run · docs

@veksen
veksen merged commit eb30787 into main Jul 21, 2026
6 checks passed
@veksen
veksen deleted the fix-gate-loose-select-shape branch July 22, 2026 00:41
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