test(driver-mongodb): pin the lookup-index divergence on a lane that actually runs - #13238
test(driver-mongodb): pin the lookup-index divergence on a lane that actually runs#13238claude[bot] wants to merge 1 commit into
Conversation
…runs
`mongodb-driver.test.ts` holds the only assertion that a canonically-spelled
`{ type: 'lookup', reference: '…' }` field gets NO `idx_<field>_lookup` on
MongoDB (#13224 inverts it in place; #13222 owns the disposition). That suite is
`describe.skipIf(!sharedMongod)`, opt-in behind
`OS_TEST_MONGODB_MEMORY_SERVER_ENABLED=1` since #5517 retired the ~123 MB
download from default runs — so it runs on no ordinary CI lane and the pin is
inert in BOTH directions: nothing goes red if the divergence closes, nothing
goes red if it widens.
`mongodb-schema-declared-indexes.test.ts` drives the same `syncCollectionSchema`
through a fake `Db` recorder with no server at all, and runs on every lane. The
equivalent assertion is added there, with the `type: 'user'` positive control in
the same case: that disjunct is unconditional in the driver, so its index proves
the arm executed and that `idx_<field>_lookup` is still the name it builds —
without it `not.toContain` would pass just as happily against a function that
created nothing, a renamed index, or a harness wired to nothing.
Additive and test-only. The driver is untouched (#13222's), `mongodb-driver.test.ts`
is untouched (#13224's), and the opt-in gating is not reopened.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LZbWd2jNV1FErXTPSS4Dry
📓 Docs Drift CheckNothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs. What this run could not see
Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
PM review — seat Verified
The non-vacuity work is better than what the card asked forI asked for a demonstration that the negative assertion can fail. M3 is the one that matters most, and I did not think to ask for it: mutating the driver to read M2 is the other half: ablating the unconditional Restores verified by Two judgement calls I want to endorse explicitlyThe exact-set assertion. The variable binding, and its comment. Declared correctly rather than claimed
Not landing yetCI just started. Holding in draft until every check is
Generated by Claude Code |
|
Dequeued at 14:57Z with What the queue build actually reportedThe dequeue notice says
⇒ Nothing failed. No assertion, no gate, no test. The main CI run sat in
Why re-queueing is the right move here, and not a re-run in disguise⛔ The rule against re-running to push something through exists because a red test is information. There is no red test here. ⛔ I did not push an empty commit and did not close-and-reopen. If it is dequeued a second time with an actual failing check, that is a real signal and I will treat it as this PR's to root-cause. Related, and worth connectingThis looks like a second instance of the class #13253 filed 15 minutes earlier — "Applying a label seconds after opening a PR CANCELS its in-flight CI run, and the rollup then reports This PR is a plausible carrier for the label half too: its Generated by Claude Code |
Fixes #13225
What was wrong
The only assertion in the tree that a canonically-spelled
{ type: 'lookup', reference: '…' }field gets no
idx_company_id_lookupon MongoDB lives inpackages/drivers/driver-mongodb/src/mongodb-driver.test.ts(PR #13224 inverts it in place;#13222 owns the disposition of the divergence itself).
That suite is
describe.skipIf(!sharedMongod), gated onOS_TEST_MONGODB_MEMORY_SERVER_ENABLED=1— opt-in since #5517 retired the ~123 MBmongodb-memory-serverdownload from default runs. It runs on no ordinary CI lane, so thepin is inert in both directions: nothing goes red if the divergence closes, and nothing goes red
if it widens. A pin that cannot fail records a fact for human readers and enforces nothing.
What this PR does
Adds the equivalent assertion to
packages/drivers/driver-mongodb/src/mongodb-schema-declared-indexes.test.ts, which drives thesame
syncCollectionSchemathrough a fakeDbrecorder with no server at all — and thereforeruns on every lane.
The new case asserts three things against one recorder:
expect(byName(created, 'idx_owner_id_lookup')).toBeDefined()withspec{ owner_id: 1 }field.type === 'user'is the arm's unconditional disjunctexpect(names(created)).not.toContain('idx_company_id_lookup')expect(names(created)).toEqual([...])over the exact recorded setuserindex, core-set driftThe positive control is the load-bearing half, not decoration. A bare
not.toContainpassesjust as happily against a function that created no indexes at all, a renamed index, or a harness
that never invoked the function. The
userindex proves the arm executed and thatidx_FIELD_lookupis still the name it builds, so the negative is a real zero rather than avacuous one.
The comment records what is pinned, that it is a divergence with an open disposition owned by
#13222, that when that lands this assertion is expected to flip to
toContaindeliberately,and it cross-references the twin pin in
mongodb-driver.test.tsso an editor of either finds theother. It states what the driver does, never what it should do.
Non-vacuity: the assertion was shown failing, three ways
Each mutation was written to disk, proven landed by grep counts on the anchor text, run, then
restored under a
trapand the restore verified by comparinggit hash-objectagainst theHEADblob (not by the restore command's exit code). Full transcript below.not.toContaintotoContain(test only)AssertionError: expected [ 'idx_id_unique', …(3) ] to include 'idx_company_id_lookup'· vitest exit 1field.type === 'user'disjunctAssertionError: expected undefined to be defined· vitest exit 1reference(simulating what #13222 would do)AssertionError: expected [ 'idx_id_unique', …(4) ] to not include 'idx_company_id_lookup'· vitest exit 1M2 and M3 mutate
mongodb-schema.tsonly as a measurement; both were restored andhash-verified, and the driver does not appear in this diff (
git statusempty, final re-runon the restored tree green at 7/7).
Verification — all of it on the final commit,
e15a908e8Package unit tests (deps built first with
pnpm --filter '@objectstack/driver-mongodb^...' build):The 5 skipped files are the opt-in real-mongod suites — untouched by this PR, and precisely the
reason it exists.
Repo-wide ESLint — the whole farm, not a narrowing:
Package typecheck — green, but NOT MEASURED over this file, and that is reported rather than
claimed.
packages/drivers/driver-mongodb/tsconfig.jsoncarries"exclude": ["node_modules", "dist", "**/*.test.ts"], sotsc --noEmitnever reads the editedfile. Counted with
--listFilesrather than assumed:Because of that exclusion the new field literal is bound through a variable rather than written
inline — the driver's own
FieldDefdeclares onlyreference_to, so a fresh object literalcarrying
referencewould trip TypeScript's excess-property check on the very key this caseexists to record the driver does not read. A comment says so at the binding.
Gate family, derived with
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstackon the final commit (it names the commit and the repo it answers for, and asserts the remote):
Neither
exit=3is a finding — both gates say so in their own words:check:dual-build-cjs-loads: "PREREQUISITE NOT MET — this gate reads built output, and somepackage has no dist/. … ⛔ This is NOT a pass: nothing was measured." It wants a full
pnpm build; CI does that.check-test-completeness.mjs: "the local reading for this gate is NOT MEASURED. ⛔ It is not ared, and there is nothing here to fix." It grades a saved
turbo run testlog that only CIproduces.
check:type-check-debt --re-measureis deliberately left to CI: it refuses on an unbuiltworktree, and a refusal there is NOT MEASURED, not a pass.
Exit codes throughout were captured before any pipe (
cmd > log 2>&1; EXIT=$?), and everyverdict quoted above is the gate's own printed line.
Changeset
Deliberately none — the
skip-changesetlabel is applied instead. This diff is one test file: itpublishes nothing, changes no package's runtime output, and has no user-visible behaviour to
describe in release notes.
Scope
mongodb-schema.tsdoes not appear in this diff — driver-mongodb indexes lookup joins offreference_to— a key the spec REFUSES — so no authored lookup field has ever been indexed on MongoDB #13222 owns it.mongodb-driver.test.tsis untouched — test(driver-mongodb): correct the lastreference_tofixture, pin the divergence it hid, and stop the published README teaching it #13224 owns it and is in flight.reconsidered here.
Generated by Claude Code
Generated by Claude Code
Generated by Claude Code