Skip to content

[finding] metadata-protocol's three driver raw-SQL resolvers try raw and execute in two different orders, and the raw limb is dead on every driver this repo ships #14083

Description

@claude

Found while implementing #14023. That card resolved one half of a three-way divergence; this records the other half, which is out of its scope.

The divergence

Three sites in packages/metadata-protocol resolve a raw-SQL entry point off a driver, and they do not agree on the order:

site order
src/migrations/partial-index-probe.ts raw first, then execute
src/migrations/seed-tenancy-backfill.ts execute first, then raw
src/protocol.ts (ensureOverlayIndex) raw first, then execute

packages/metadata/src/migrations/ was a fourth shape — raw only, refusing everything else — and #14023 made it execute-first on the 2026-08-07 meta-criterion (one operation, several implementations, inconsistent behaviour, decide by the declaration-bound side). IDataDriver declares execute non-optionally and has never declared raw.

Why the raw-first sites are not merely a style difference

No data driver in this repo defines raw — measured on origin/main, the only raw( member outside a test double is an HTTP harness in packages/verify whose signature is (path, init). So on every driver the platform ships, the raw limb of a raw-first resolver is dead and the execute limb is what actually runs. The consequences are small today and worth naming anyway:

  • The dead limb reads as live. Someone maintaining partial-index-probe.ts sees raw as the preferred surface and can reasonably conclude the drivers have it.
  • A host or third-party driver that defines BOTH would be driven through raw at two of these sites and execute at the other two — the same operation, two surfaces, in one process.
  • seed-tenancy-backfill.ts's raw fallback is unreachable for the same reason, in the opposite direction.

This is an observation about consistency, not a live defect: nothing measured here misbehaves on a shipped driver today. Recording it so the convergence is a decision someone makes rather than a thing that quietly stays split.

Not folded into #14023

#14023 remains open on its own terms was not the situation — it is delivered — but its scope was the four files under packages/metadata/src/migrations/, fixed by the PM's dispatch, and metadata-protocol was explicitly outside it. Changing these three sites also has a wider blast radius: ensureOverlayIndex runs on every boot.

Re-run

git grep -n "typeof driver.raw === 'function'" -- packages/metadata-protocol/src
git grep -n "typeof driver.execute === 'function'" -- packages/metadata-protocol/src
git grep -nE "^\s*(public |protected |private )?(async )?raw\s*\(" -- 'packages/*/src' 'packages/*/*/src'

Dedup declaration

Repo-scoped REST listing of the 62 open domain:engine issues plus a local keyword grep (partial-index-probe, seed-tenancy-backfill, ensureOverlayIndex, raw-first, execute-first). Control: grepping the same fetched list for metadata-protocol returned 12 issues, so the channel was answering. domain:metadata is folded into domain:engine and lists zero open issues. No duplicate found.

Backlink: #14023, where the sibling directory was converged.

Generated by Claude Code


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions