Skip to content

test(dogfood): pin that the object-existence gates are WIRED, not just implemented (#4613) - #4615

Merged
os-zhuang merged 1 commit into
mainfrom
claude/gate-data-path-404-yk25mt
Aug 2, 2026
Merged

test(dogfood): pin that the object-existence gates are WIRED, not just implemented (#4613)#4615
os-zhuang merged 1 commit into
mainfrom
claude/gate-data-path-404-yk25mt

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Closes #4613. Test-only — no runtime change.

The gap, measured

#3770 (data path) and #3867 (analytics cube auto-inference) are both implemented and unit-tested. Neither implementation is what this protects. It protects the wiring, which nothing asserted.

Two deletion experiments, each removing only the lines that hand the probe to the service — implementation and unit tests untouched:

Experiment Deleted Result before this PR
A the 5 lines in service-analytics/src/plugin.ts passing isRegisteredObject service-analytics 299/299 green, dogfood 395/395 green
B this.assertObjectRegistered(request.object) in findData 4 red immediately

Experiment A means the #3867 gate could be deleted from production by one refactor and nothing in the repo would notice. It only logs a one-shot stand-down warn that nobody asserts, so /analytics/query silently reverts to "any table the connection can see is readable" — the exact state #3867 was filed for.

Why the asymmetry — it's the test shape, not luck

Prime Directive #10's closing line in mirror image: a case label is not enforcement, check the CALL SITE. (#3106 was the same lesson pointing the other way.)

This repo has already paid for this exact gap once. From analytics-rls.dogfood.test.ts's own header, verbatim:

Every pre-existing analytics RLS test injects getReadScope as a fake into a hand-built AnalyticsService. NONE booted the real plugin, so the getReadScope → security.getReadFilter auto-bridge had zero coverage — which is how the gap shipped.

That was #3597. #3867 sits in the identical position, and the pattern is spreading — measure-source-field-gate.test.ts is a newer gate wired the same injected way.

Verified to bite

With this test in place, the same two experiments now redden:

Experiment With this PR
A (#3867 wiring deleted) 3 cases red
B (#3770 call site deleted) 1 case red (plus the 4 unit ones)

Why sqlite_master and not an invented name

The harness boots sqlite-wasm, so sqlite_master is guaranteed to exist and hold rows while never being a registered object. That is the case that actually regressed — #3867's live repro read real rows out of it ({index: 262, table: 71, view: 1}) — and it keeps the gate honest: a 404 here cannot be explained away by "there was no table anyway", which is precisely the loophole the pre-#3770 driver-error-string 404 depended on.

What's asserted

Everything goes through bootStack (real plugin lifecycle, real Hono app, real HTTP) and never constructs a service by hand.

pnpm test green across the monorepo (132/132 turbo tasks).

Empty changeset — the CI check explicitly allows one for changes that release nothing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EWHv5StvA4KDkHhx19xufX


Generated by Claude Code

…t implemented (#4613)

#3770 (data path) and #3867 (analytics cube auto-inference) are both
implemented and unit-tested. Neither implementation is what this test
protects: it protects the WIRING, which nothing asserted.

Measured, not assumed. Deleting the five lines in
`service-analytics/src/plugin.ts` that hand `isRegisteredObject` to the
service — switching the #3867 gate off in production while leaving the
implementation and every unit test untouched — left the whole repo green:
service-analytics 299/299, dogfood 395/395. The gate only logs a one-shot
stand-down `warn`, which nobody asserts, so `/analytics/query` silently
reverts to "any table the connection can see is readable", the exact state
#3867 was filed for. Deleting #3770's call site from `findData`, by
contrast, reddens four tests immediately.

The asymmetry is the test SHAPE, not luck. #3770's suite drives the real
`protocol.findData`, so the call site is inside the object under test.
#3867's suite injects the probe as config (`new AnalyticsService({
isRegisteredObject })`), so it proves how the service behaves once handed a
probe — never that anyone hands it one. Prime Directive #10's closing line
in mirror image: a `case` label is not enforcement, check the CALL SITE.

This repo has already paid for this exact gap once — `analytics-rls`'s own
header records that every pre-existing analytics RLS test injected
`getReadScope` into a hand-built service, none booted the real plugin, and
"which is how the gap shipped" (#3597). #3867 sits in the identical
position, and the pattern is spreading: `measure-source-field-gate.test.ts`
is a newer gate wired the same injected way.

The new gate goes through `bootStack` (real plugin lifecycle, real Hono app,
real HTTP) and never constructs a service by hand. Verified to bite: with
this test in place, experiment A reddens 3 cases and experiment B reddens 1.

Probe target is `sqlite_master`, not an invented name: the harness boots
`sqlite-wasm`, so it is guaranteed to exist and hold rows while never being
a registered object. That is the case that actually regressed — #3867's live
repro read real rows out of it — and it keeps the gate honest, since a 404
here cannot be explained away by "there was no table anyway", the loophole
the pre-#3770 driver-error-string 404 depended on.

Also asserted: a premise check that the table IS readable straight through
the engine (ground truth, and it pins #3770's choice to gate at the protocol
ingress rather than the engine, so internal callers keep working), and
controls proving a registered object still serves on both surfaces — without
which a simply-broken boot would make every 404 above pass for the wrong
reason.

Test-only; releases nothing (empty changeset).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EWHv5StvA4KDkHhx19xufX
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Aug 2, 2026 11:09am

Request Review

@github-actions github-actions Bot added the size/m label Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

No hand-written docs reference the 0 changed package(s). ✅

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling labels Aug 2, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review August 2, 2026 11:12
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 2, 2026
Merged via the queue into main with commit 868718e Aug 2, 2026
22 checks passed
@os-zhuang
os-zhuang deleted the claude/gate-data-path-404-yk25mt branch August 2, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

#3770 / #3867 的存在性闸门只有注入式单测,生产接线没有任何断言 —— 删掉接线全仓库 694 个测试无一变红

2 participants