Found while implementing #14083, which aligned the three raw-SQL resolvers in packages/metadata-protocol to execute-first. This is a fourth site that carries the same predicate but is deliberately not part of that card, and it is recorded rather than folded in.
The site
packages/metadata/src/loaders/database-loader.ts, line 403, inside the engine branch of the schema-ready path:
if (c && (typeof c.raw === 'function' || typeof c.execute === 'function')) {
driver = candidate as IDataDriver;
break;
}
Why this is NOT the #14083 defect
⛔ It is not an order divergence, and #14083 was right to leave it alone. The check is an OR used to pick which candidate out of engineAny.drivers is raw-SQL-capable; it selects a driver, never a surface. The surface decision happens one call later, inside migrateProjectIdToEnvironmentId(driver), which already routes through packages/metadata/src/migrations/driver-exec.ts (resolveDriverExec, execute-first). Swapping the two operands here changes nothing.
What is worth recording
The predicate is spelled inline, a third time, in the same package that already owns the canonical answer. resolveDriverExec is the definition of "this driver can run raw SQL" — resolveDriverExec(d) !== undefined — and driver-exec.ts is one directory away from this file. Two consequences, both small today:
⚠️ Deliberately not claiming a live defect: the current operands are exactly the two surfaces resolveDriverExec tries, so the predicate and the resolution agree today. This is a drift-risk observation, not a measured misbehaviour.
Known limitation this inherits, unchanged
typeof driver.execute === 'function' cannot separate "declares the surface" from "can actually run SQL" — two shipped drivers satisfy the non-optional declaration and execute nothing. That is #14082's subject, is unaffected by anything above, and would be the thing to fix first if this predicate is ever revisited.
Re-run
sed -n '395,410p' packages/metadata/src/loaders/database-loader.ts
git grep -n "resolveDriverExec" -- packages/metadata/src
Whole-tree sweep for the dual-surface shape, which is how this was found:
for f in $(git grep -lE "typeof [A-Za-z_.()]*\braw\b[^=]*=== ?'function'" -- packages apps examples); do
grep -qE "typeof [A-Za-z_.()]*\bexecute\b[^=]*=== ?'function'" "$f" && echo "$f"
done
⚠️ That sweep needs a firing pathspec. The packages/*/src form used in #14083's original re-run block matches zero files under git's pathspec rules, so it reports a clean zero whatever the tree contains; the positive control is the same regex for execute, which finds 327 member definitions under packages.
At the time of writing the dual-surface sweep returns exactly three files: this one, packages/metadata/src/migrations/driver-exec.ts and packages/metadata-protocol/src/migrations/driver-exec.ts (the two canonical helpers). The five other raw probes in the tree are local variables named raw on HTTP headers and request objects, not driver surfaces.
Dedup declaration
Repo-scoped REST listing of all 282 open issues, bodies included, grepped locally for database-loader, resolveDriverExec, driverCanRunSql, driver-exec and capability predicate. Only database-loader matched, returning #14037 and #14038 — both members of the #13973 driver-Date-materialisation census, neither about driver-capability probing. Control: the same fetched list grepped for metadata-protocol returned 16 issues, so the channel was answering. No duplicate found.
Backlink: #14083, where the sibling package's three copies were collapsed.
Generated by Claude Code
Generated by Claude Code
Found while implementing #14083, which aligned the three raw-SQL resolvers in
packages/metadata-protocoltoexecute-first. This is a fourth site that carries the same predicate but is deliberately not part of that card, and it is recorded rather than folded in.The site
packages/metadata/src/loaders/database-loader.ts, line 403, inside the engine branch of the schema-ready path:Why this is NOT the #14083 defect
⛔ It is not an order divergence, and #14083 was right to leave it alone. The check is an
ORused to pick which candidate out ofengineAny.driversis raw-SQL-capable; it selects a driver, never a surface. The surface decision happens one call later, insidemigrateProjectIdToEnvironmentId(driver), which already routes throughpackages/metadata/src/migrations/driver-exec.ts(resolveDriverExec,execute-first). Swapping the two operands here changes nothing.What is worth recording
The predicate is spelled inline, a third time, in the same package that already owns the canonical answer.
resolveDriverExecis the definition of "this driver can run raw SQL" —resolveDriverExec(d) !== undefined— anddriver-exec.tsis one directory away from this file. Two consequences, both small today:packages/metadata. [finding] metadata-protocol's three driver raw-SQL resolvers tryrawandexecutein two different orders, and therawlimb is dead on every driver this repo ships #14083 collapsed the three copies inmetadata-protocolinto one helper and defined that package's predicate as the resolution succeeding, precisely so the two cannot disagree; the same move is available here and is a one-line change.resolveDriverExectries, so the predicate and the resolution agree today. This is a drift-risk observation, not a measured misbehaviour.Known limitation this inherits, unchanged
typeof driver.execute === 'function'cannot separate "declares the surface" from "can actually run SQL" — two shipped drivers satisfy the non-optional declaration and execute nothing. That is #14082's subject, is unaffected by anything above, and would be the thing to fix first if this predicate is ever revisited.Re-run
Whole-tree sweep for the dual-surface shape, which is how this was found:
packages/*/srcform used in #14083's original re-run block matches zero files under git's pathspec rules, so it reports a clean zero whatever the tree contains; the positive control is the same regex forexecute, which finds 327 member definitions underpackages.At the time of writing the dual-surface sweep returns exactly three files: this one,
packages/metadata/src/migrations/driver-exec.tsandpackages/metadata-protocol/src/migrations/driver-exec.ts(the two canonical helpers). The five otherrawprobes in the tree are local variables namedrawon HTTP headers and request objects, not driver surfaces.Dedup declaration
Repo-scoped REST listing of all 282 open issues, bodies included, grepped locally for
database-loader,resolveDriverExec,driverCanRunSql,driver-execandcapability predicate. Onlydatabase-loadermatched, returning #14037 and #14038 — both members of the #13973 driver-Date-materialisation census, neither about driver-capability probing. Control: the same fetched list grepped formetadata-protocolreturned 16 issues, so the channel was answering. No duplicate found.Backlink: #14083, where the sibling package's three copies were collapsed.
Generated by Claude Code
Generated by Claude Code