Skip to content

Measure the $exists has-value cell on every driver-memory exit and on driver-mongodb - #13420

Merged
zhuangjianguo merged 1 commit into
mainfrom
claude/issue-13195-exists-has-value-measurement
Aug 30, 2026
Merged

Measure the $exists has-value cell on every driver-memory exit and on driver-mongodb#13420
zhuangjianguo merged 1 commit into
mainfrom
claude/issue-13195-exists-has-value-measurement

Conversation

@claude

@claudeclaudeBot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Part of #13195 — this delivers step 2 of that card only: the measurement, executed. It decides no direction and enrols nothing.

What the card asked for, and what changed by executing it

The card declares itself "Read, not re-measured" and predicts its own numbers will be optimistic. They were. Reading recorded one divergent column on two surfaces. Executing found three divergent cells on three surfaces (four exits), all on one of the two readings of "no value".

Fixture: rows 1 (name: 'alpha-one'), 2 (name: 'beta'), 3 (no value) — measured under both readings, name: null and the key absent. The platform ruling (#5298 leg 3 / #5369, landed in PR #5962) is that $exists means "has a value", so the ruling answers are ['1','2'] for $exists: true and ['3'] for $exists: false.

The measured table (D = divergent from the ruling)

cellreadingmemory reference matchermemory LIVE mingomemory analytics executedmemory analytics echoed SQLdriver-mongodb
$exists: truename: null['1','2']['1','2','3']D['1','2','3']Dname IS NOT NULL['1','2','3']D
$exists: truekey absent['1','2']['1','2']['1','2']name IS NOT NULL['1','2']
$exists: falsename: null['3'][]D[]Dname IS NULL[]D
$exists: falsekey absent['3']['3']['3']name IS NULL['3']
$not { $exists: true }name: null['3'][]Drefused, INVALID_FILTERrefused[]D
$not { $exists: true }key absent['3']['3']refused, INVALID_FILTERrefused['3']

The driver-mongodb column was executed against a real mongod 8.2.6 as well as against the strict stand-in this PR ships, and both returned the ids above. The real-mongod half is not repeated in CI — test-mongod.ts gates it behind #5517 and a 123 MB download — so what lands here is the always-run half.

Three findings the reading did not carry

  1. $exists: false diverges too, in the opposite and worse direction. The recorded column is $exists: true on a null value, whose divergence is surplus — a row the author can see and narrow. $exists: false and $not { $exists: true } return nothing where the ruling wants the no-value row: the row with no value is dropped from the query that asks for no-value rows. filter-logic-conformance.ts makes exactly that trade — "silent absence for visible surplus" — its stated reason for keeping the include direction on $ne / $nin. This cell sits on the wrong side of it and was invisible while only $exists: true was recorded.

  2. The name: null reading carries the whole divergence; the key-absent reading is already correct on every exit. So the fixture axis is load-bearing in the opposite way from the neighbouring cell in driver-memory's reference matcher still answers $notContains / $nin the pre-ruling way on a no-value row — the #5499 freeze that excused it dissolved 2026-08-11, so the divergence is now unexcused and untracked #13166, where $notContains diverged on both readings and $nin on the absent one only. A fixture that spells "no value" as an absent key measures zero of this. Both columns are kept, with the reason recorded.

  3. driver-memory is one driver with FOUR exits, not two faces. The reference matcher answers the ruling; the live mingo path and the analytics face's executed rows read key-presence; and the analytics face's echoed statement renders name IS NOT NULL / name IS NULL, which is the ruling. So the analytics face disagrees with itself: the rows a chart is drawn from and the SQL shown beside it answer the same query differently. That inequality is asserted here so it cannot be closed in silence.

What is deliberately NOT here

One measured input to the open direction is pinned, as a measurement rather than a proposal: this same translator already emits {$ne: null} / {$eq: null} for $null, and those documents return the ruling's answers on both readings. That narrows what the fork is about — not whether MongoDB can express has-value, but whether $exists should become an exact synonym for the negation of $null. That question is the maintainer's.

Reversibility

Every divergent expectation names the ruling's answer beside the measured one, and both file headers say it: when the direction is decided, invert these in place — do not delete them, and do not re-baseline them to whatever the new output happens to be.

Verification

All at 73a083c8, the final commit.

checkverdict line
driver-memory + driver-mongodb suitesTest Files 33 passed (33) / Tests 929 passed (929); Test Files 22 passed | 5 skipped (27) / Tests 496 passed | 143 skipped (639)
typecheck, both packagesDone, both
check:type-check-debt (ratchet)re-measure: OK — 29 ledger entr(ies) re-measured in 244.2s, 1547 raw tsc error(s) total, none above its recorded number
check:type-check-coverageOK — 66/78 workspace packages type-checked
check:driver-conformanceexit 0
check:dual-build-cjs-loads102 published require entry point(s) across 66 package(s) load
pnpm lint (whole repo)5488 files, 0 errors, 0 warnings

Also green: check:cross-package-test-inputs, check:doc-authoring, check:logger-receiver-detach, check:objectql-double-limit, check:page-declaration-shape, check:published-files, check:slot-lookup, check:test-source-alias, check:type-source-resolution, check:where-matcher, check:query-options-erasure, check:engine-double-contract, check:nul-bytes, and the ten standalone scripts/check-*.mjs / scripts/docs-audit/*.mjs in the derived family.

Two honest gaps, recorded rather than papered over:

  • scripts/check-test-completeness.mjs exits 3 = PREREQUISITE NOT MET locally — it grades a saved turbo run test log that only CI produces. NOT MEASURED, not a red.
  • driver-mongodb's own tsconfig.json excludes **/*.test.ts, so pnpm typecheck says nothing about the new file there. Measured separately with a temporary config that includes tests: the new file was in --listFiles and produced 0 errors; the 10 errors that config reports are pre-existing, in eight other test files, and match the ledger's recorded 10 exactly — which check:type-check-debt --re-measure then confirmed at zero surplus.

No changeset: the diff is two test files and publishes nothing, so skip-changeset applies.

Generated by Claude Code


Generated by Claude Code

…h no-value readings
Executes the cell the recorded table states as reading rather than measurement,
and pins what it found. Two files, no source change, no conformance enrolment.
driver-memory has FOUR exits and they do not agree: the reference matcher reads
has-value (the ruling, shipped by #5962), the live mingo path and the analytics
face's executed rows read key-presence, and the analytics face's echoed SQL
renders `IS NOT NULL` / `IS NULL` — so that face disagrees with itself.
driver-mongodb passes `$exists` through under its own name.
Executing widened the divergence threefold against the reading: `$exists: false`
and `$not { $exists: true }` diverge too, and in the opposite, worse direction —
the no-value row is dropped from the query that asks for no-value rows. Every
divergent cell is on the `name: null` reading; the key-absent reading already
answers the ruling everywhere, so a fixture that spells "no value" as an absent
key measures none of it.
The direction stays undecided here.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
@claudeclaudeBot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Aug 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing 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
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.

Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 94efa2a5a511c8d9e5447d8cba233864556cae9cpackageMentionDocs.

@zhuangjianguo
zhuangjianguo marked this pull request as ready for review August 30, 2026 11:36
@zhuangjianguo
zhuangjianguo added this pull request to the merge queueAug 30, 2026
Merged via the queue into main with commit 9268aecAug 30, 2026
37 checks passed
@zhuangjianguo
zhuangjianguo deleted the claude/issue-13195-exists-has-value-measurement branch August 30, 2026 12:09
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/mskip-changesetPR has no user-facing published change; bypasses the changeset gatetests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@zhuangjianguo@claude