Skip to content

Convert the $topN, $bottomN and $fill named-argument cases - #4567

Open
evanchooly wants to merge 1 commit into
audits-milestonefrom
audits-named-arguments
Open

evanchooly wants to merge 1 commit into
audits-milestonefrom
audits-named-arguments

Conversation

@evanchooly

Copy link
Copy Markdown
Member

Follows up the #4548 finding ("sortBy before n"), as you asked. Stacked on #4566.

Problem

Three cases were recorded in cutover.json as legacy-only because of a serialization difference in the order of named arguments:

  • topN/computingNBasedOnTheGroupKeyForGroup: the page prints output, n, sortBy, and Morphia emits output, sortBy, n;
  • bottomN/computingNBasedOnTheGroupKeyForGroup: the same difference;
  • fill/fillDataForDistinctPartitions: the page prints sortBy, partitionBy, output, and Morphia emits partitionBy, sortBy, output.

What I found

  • Fixing Morphia's order isn't possible. The pages disagree with themselves. The other two $topN examples, and both other $bottomN examples, print output, sortBy, n, which is what Morphia emits, and they pass today. Reordering Morphia to match these three pages would break those cases.
  • The rule was already declared. All three cases declare NAMED_ARGUMENTS in form-review.json. That rule exists for exactly this: the server ignores the order of named arguments, so sorted keys are compared on both sides, while nested values such as the sortBy spec keep their order.
  • They pass now. Retried with the procedure the README documents (convert, run both mappers), all three convert and pass under Critter and reflection. They were recorded legacy-only before later changes in the stack; I didn't pin down which change fixed them.
  • The check is live. Removing NAMED_ARGUMENTS from the $topN scenario makes the test fail with "serialization differs".

So the recommended change is the declared rule, not a change to Morphia: these cases leave the legacy path.

Change

  • The three fixtures convert: each fixture directory now holds only scenario.json, and fixture-migration.json records the moves.
  • Their declarations move from declarations to migrated in form-review.json, and cutover.json drops them.
  • manifest.json and form-migration.json are regenerated. Regenerating example-bindings.json and the repair inventory left them unchanged.
  • FormMigrationTest's count of open overrides goes from 9 to 6.
  • The README and progress counts are updated: 349 cases on the runner, 207 legacy directories, 25 legacy-only.

Verification

  • TestTopN, TestBottomN, TestFill, GeneratedCasesTest and ExampleBindingsTest pass under Critter, then reflection.
  • Audits suite: 452 tests pass under both mappers.

Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.

The three cases recorded as legacy-only for key order already declare
NAMED_ARGUMENTS, which the server's treatment of named arguments
justifies, and on retry they convert and pass under both mappers. The
pages order these arguments inconsistently, so changing Morphia's order
would break the cases that pass today. Their declarations move to
migrated, cutover.json drops them, and the derived catalogs are
regenerated.

This branch has not been deployed

No deployments
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.

1 participant