Repository navigation
Compare documented projections and convert the cases that use them - #4576
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
A find scenario carries the page's projection, and the runner compares Morphia's projection with it after the filter, then runs the projected query on both sides. Converted tests pass their legacy findOptions, now a mapped option. The $in and $nin cases convert after their bodies gain the page's _id exclusion, recorded as reviewed edits, and $text's relevance-score case converts unchanged; $rand's stays legacy-only because its test omits the _id exclusion the page projects.
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.
One of the plan's deferred cutover features. Stacked on #4575.
Problem
Two cases were legacy-only with "the page documents a projection, which needs the unmapped findOptions":
The scenario format had no place for a projection, and conversion refused one. The runner also refused any converted test that passed
findOptions. The legacy tests approximated{_id: 0}withremoveIds(true), which strips_idfrom the results instead of projecting it away.Change
Scenario: a find action carries
projectionwhen the page documents one.Runner: a new
find(case, dsl, FindOptions)builds the query from those options. It:[filter, projection]with Morphia's query and the mappedFindOptionsprojection, strictly, after the declared rules;The existing
findoverloads delegate to it.Converted tests:
findOptionsis now a mapped legacy option. It changes nothing in the scenario, since the projection comes from the page. A test may pass it only when the scenario has a projection; any non-projection option would change the results, which the behavior check compares with the documented query's.Converted cases:
$inuseTheInOperatorToMatchValuesand$ninselectOnUnmatchingDocuments: each body gainsfindOptions(new FindOptions().projection().exclude("_id")), recorded in the ledger as a reviewed body edit;$textrelevanceScoreExamples: became convertible oncefindOptionswas mapped, and passes unchanged;$randselectRandomItemsFromACollectionstays legacy-only, with its failing check recorded. The page projects{_id: 0, name: 1, registered: 1}, but the test includesnameandregisteredand drops_idwithremoveIds, so its projection lacks the_idexclusion. Fixing it means combining an_idexclusion with inclusions in the page's key order, which belongs in its own change.Result
373 legacy cases are on the runner, 183 legacy directories are left, and 15 cases are legacy-only.
Decisions for review
removeIds(true)beside the projection in the two edited bodies. It's now redundant, but keeping it leaves their scenarios exactly as converted._id-exclusion question as$rand.Verification
TestIn,TestNin,TestTextandTestRandpass under Critter, then reflection.Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.