Repository navigation
Generate operator cases for unowned documented examples - #4558
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
Inventory every example on the current operator pages with its owner, check reviewed DSL bindings against core's API, and generate a test and scenario for each bound, unowned expressions example through the candidate, integrate and promote path. Every other example is a named gap.
This was referenced Nov 22, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 5, slice 7 of the operator-audit plan: the generator. Stacked on #4557.
Problems solved
Nothing knew which documented examples had no test. Ownership was only known from the fixtures' side.
fetch.py currentnow lists every operator page at one pinned mongodb/docs commit (e4b0c153), andGenerateMainKt inventorywritesaudits/catalog/documented-examples.json. It matches each example to its owner by title, or by action text when the page renamed it after the fixture was written. Example:$bitOr's "Bitwise OR with a Long and Integer" has no fixture, so it isUNOWNED. Statuses areOWNED,UNOWNED,UNNAMED(generic titles like "main", which need a reviewed name) andAMBIGUOUS(two examples share a name, or one matches several owners).Result: 197 pages read; 300 examples owned, 32 unowned, 11 unnamed.
The generator had no reviewed way to turn MQL into Morphia calls.
audits/catalog/dsl-bindings.jsonmaps each operator to its factory in one of four forms: positional, named (with chained options), projection, or fields.GenerateMainKt candidatecapturesMorphiaApiInventoryof core's current source and stops on any stale binding: wrong owner, method, parameter types or varargs, or an option method missing from the factory's return type or its supertypes. Integration's compile step remains the real contract test.Generation needed a path that never guesses.
CaseGeneratoremits one class per operator underdev.morphia.test.generated.expressions, plus ascenario.jsonper case. It works from the inventory's recorded source text only, so it needs no pages. A value is emitted only in the form its parameter type takes. Anything else becomes a gap ingaps.jsonbeside the candidate, naming its reason or its first unbound node. For example,/pipeline/0: stage $match has no bindingis the next adapter task.First run
Four expressions cases were generated and integrated (
$add,$bitOr,$dateDiff,$filter). Only$add's "Add Non-Integer Values to a Date" passes, and it is promoted: 443 tests pass under each mapper. The other three are excluded inaudits/catalog/generation-review.jsonwith their evidence:$bitOr, a docs error. The page prints$bitAnd's results:Long("0"),Long("2")andLong("3"), wherea | 63is 63 each time. Serialization and behavior both pass.$dateDiff. The server returns a long, which mongosh prints asLong('1'), but the page prints1.$filterwith$$IDX. It is rejected by MongoDB 8.2, which is what the tests run, and 8.3 cannot start on these kernels.Decisions for review
.. input:: /code-examples/...). The legacy extractor cannot resolve those, so the inventory lists them as skipped with that reason. A snippet resolver is the largest next unlock for generation.// spotless:offand// spotless:on. The manifest pins each file's bytes, and Eclipse's 120-column wrapping would otherwise rewrite them. Imports are emitted in the configured order.minimumServerrequirement would skip the$$IDXcase on every host we run, so nothing would check it.legacy-references.jsonalready does. Pages themselves are still not committed.FormMain manifestand the manifest test now go throughCandidates.manifest, so regenerating the manifest keeps generated cases.$bitOrand$dateDiffpage errors upstream without your go-ahead.Review status
Self-reviewed only: the independent reviewer is at its weekly limit until Nov 26, and Codex and Copilot are out of quota. I'll rerun real reviews after the reset.
Verification
Follow-up for you: #4563 tracks reporting the
$bitOrand$dateDiffpage errors to mongodb/docs. Nothing has been filed upstream.