Skip to content

Review the generic and ambiguous example names - #4573

Open
evanchooly wants to merge 1 commit into
audits-match-filtersfrom
audits-example-names
Open

evanchooly wants to merge 1 commit into
audits-match-filtersfrom
audits-example-names

Conversation

@evanchooly

Copy link
Copy Markdown
Member

Step 5 of the operator-audit plan: reviewed names. Stacked on #4572.

Problem

After #4570 the inventory had 30 unnamed and 4 ambiguous examples, and neither kind can be generated or tracked:

  • Unnamed. Pages whose only example has no title get the generic name main from the extractor, for example $median's "calculate the median rating by year" pipeline.
  • Ambiguous. A documented example covered by several legacy variants. bucketAuto's "Multi-Faceted Aggregation" matches both multiFacetedAggregation and multiFacetedAggregationAsPipeline.

Change

  • audits/catalog/example-names.json holds the reviews. Each is keyed by page, title and the action block's SHA-256, and holds either a name or an owner, never both, plus a reason:
    • 30 names, such as median → "Calculate the Median Rating by Year" and sum → "Total the Votes by Rating";
    • 4 owners: the primary fixture of bucketAuto, currentOp (replica-set variant), planCacheStats and project. The variants keep their own tests.
  • The inventory applies them. A name stands in for the generic title when stemming and matching. An owner settles the match, but only while it's still among the candidates. A review whose example changed upstream no longer applies; it's counted as reviews.stale (summary and discovery report), and the example goes back to UNNAMED or AMBIGUOUS. Ambiguous examples now keep their source blocks, so they can be reviewed.
  • Generator:
    • a reviewed name is the case's title and @DisplayName;
    • a hyphenated page name like maxN-array-element becomes TestMaxNArrayElement, where it used to produce an invalid class name;
    • it declares NAMED_ARGUMENTS for every named-argument operator it emits. Integration showed Morphia writes $maxN as {input, n} where the page writes {n, input}. The server ignores that order, and the generator can't know Morphia's, so the reviewed rule applies. This also adds the rule to the 10 cases from Generate $match, $group and $sort pipelines and sample-dataset cases #4572.
  • The regenerated inventory reads 437 owned and 145 unowned, with none unnamed or ambiguous.

Decisions for review

  • The 30 names and 4 owners are my proposals. Please read example-names.json. A name says what the pipeline does; an owner is the fixture whose name matches the example, with the variants noted in the reason.
  • Reviews are keyed by action digest, so a page edit that changes the example invalidates its review rather than silently keeping a name that no longer fits.
  • NAMED_ARGUMENTS is declared by operator, not by observed difference. The alternative, declaring it only when a generated case fails on key order, would need a second integration round for each case.

Result

One more generated case: maxN-array-element, "Find the Top Two Cast Members". It was integrated under both mappers and promoted, for 12 generated cases in all. The remaining gaps for named examples are bindings: $first, $push, $addToSet, $median, $limit, $setWindowFields, $similarity*, and others.

Verification

  • New GeneratorTest.reviewedNamesResolveGenericTitles covers: a name applied, its stem and display name, a stale review counted, and a review with both a name and an owner rejected.
  • Audits suite: 457 pass under Critter, then reflection.
  • Core operator tests: 690 pass under both mappers.

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

example-names.json gives 30 examples titled main a descriptive name and
picks the owner of 4 examples that several legacy variants match. Each
review is keyed by page, title and action digest, so an example that
changes upstream comes back for review; stale reviews are counted.

The generator uses a reviewed name as the case's title, turns hyphenated
page names into valid class names, and declares NAMED_ARGUMENTS for the
named-argument operators it emits, since Morphia picks their order. One
more case is generated, integrated under both mappers and promoted.

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