Skip to content

Fix exact-ID explain assertions across MongoDB plans - #105

Merged
AGiorgetti merged 2 commits into
developfrom
fix/94-explain-id-lookup
Nov 6, 2026
Merged

AGiorgetti merged 2 commits into
developfrom
fix/94-explain-id-lookup

Conversation

@AGiorgetti

@AGiorgetti AGiorgetti commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #94.

  • Recognize IDHACK without requiring a redundant indexName, while retaining classic, SBE and EXPRESS named-index support.
  • Verify the built-in _id_ index definition, exactly one returned document/key/document examined, and no COLLSCAN for the seeded exact-ID lookup.
  • Add a live forced-natural-scan negative control and synthetic regression coverage for nested/array plans, unrelated indexes and rejected plans.
  • Update the changelog. Test-only change: no breaking API/schema changes, migration or change to the MongoDB 4.2 minimum. Existing CI is unchanged.

Test-first validation

Regression commit 9486d022d23ae0dd10ebe81fbf790209d6b5a1e1 preserved the old decision. CI run 41856735204 built on Ubuntu and Windows, then produced exactly the two new IDHACK failures on each of net8.0/net9.0/net10.0: 582 passed, 2 failed, 0 skipped per target.

With the fix:

  • Full net10.0 suite on MongoDB 7.0.45: 585 passed, 0 failed, 0 skipped.
  • Focused explain tests on MongoDB 4.2.25, 4.4.31, 5.0.34, 6.0.29 and 7.0.45: 14 passed, 0 failed, 0 skipped per server, using net10.0.
  • MongoDB 8.0.34 was downloaded from the official source but aborted before startup at TCMalloc CPU detection (NumPossibleCPUsNoCache). No live MongoDB 8 result is claimed.
  • Final-head CI run 41859991687 passed for 1f8bb2cca135c459f3586e18ac946c49acd163b9: Ubuntu/Windows builds and all MongoDB 9.0.4 test jobs. Each of net8.0/net9.0/net10.0 passed 585 tests, 0 failed, 0 skipped. Existing CI is unchanged. net472 runtime tests were not run.

Co-authored by Alessandro Giorgetti and Codex (OpenAI).

AGiorgetti and others added 2 commits November 4, 2026 16:20
Extract the existing explain reader without changing its index-name-only decision, then cover IDHACK, classic, SBE, EXPRESS and rejected plans.

Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com>
Co-authored-by: Codex (OpenAI) <codex@openai.com>
Accept the implicit built-in IDHACK access path without coupling the audit to one engine layout. Verify the index catalog, one returned document, one examined key/document, and no COLLSCAN. Add a forced-natural-scan negative control and changelog entry. Production behavior and MongoDB 4.2 minimum are unchanged.

Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com>
Co-authored-by: Codex (OpenAI) <codex@openai.com>
@AGiorgetti
AGiorgetti marked this pull request as ready for review November 6, 2026 11:27
@AGiorgetti
AGiorgetti merged commit 8f580f1 into develop Nov 6, 2026
5 checks passed
@AGiorgetti
AGiorgetti deleted the fix/94-explain-id-lookup branch November 6, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Exact-ID explain assertion rejects MongoDB 7 IDHACK despite using the _id index

1 participant