Repository navigation
Inventory documented examples with the structured extractor - #4587
Open
evanchooly wants to merge 1 commit into
Open
evanchooly wants to merge 1 commit into
evanchooly wants to merge 1 commit into
Conversation
The example inventory came from the line-based RST extractor over pages fetch.py copied out of a docs checkout. It read one example per section and matched owners largely by title, so rewritten examples kept stale owners and sections that show several examples lost all but one. GenerateMainKt plan drafts the committed scenario-plan.json from the parsed operator pages, and inventory extracts the planned pages with the structured extractor, keeping the owner matching. discover.sh parses the operator pages instead of running fetch.py, and reports plan drift. The extractor gives a section's inserts to its input/output groups, lets a query inherit the inserts into its collection from an earlier section, and marks reads that follow a write. Sibling examples that share a title get reviewed names; three page errors are excluded with their evidence. Generation adds 27 cases, integrated under both mappers.
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 2 of retiring the legacy RST extractor. Stacked on #4586.
Problem
The example inventory,
documented-examples.json, came from the line-based RST extractor (FormMigration.pageExamples) over pages thatfetch.pycopied out of a docs checkout. That extractor reads one example per section and matches owners largely by title, and that hid several problems:$grouppage's "Pivot Data" now groupsdb.movies, but the inventory still recorded the olddb.booksfixture as its owner, because the title survived. 16 owners were stale this way.$project's "Exclude Fields from Embedded Documents" shows the same exclusion with dot notation and with an embedded document.$regexFindshows each option form. Only one of each was in the inventory.discover.shranfetch.pyand the RST extractor, so it couldn't retire.Change
GenerateMainKt plandraftsaudits/catalog/scenario-plan.jsonfrom the parsed operator pages. It's reviewed policy, now committed. Each page that declares one operator (.. expression:: $add, read from the parser's target node) and has an examples section gets a rule:bashhighlighting as shell;GenerateMainKt inventorytakes a source bundle and the parsed pages (DocumentsMainKt). It extracts the planned pages with the structured extractor (Classify section blocks by the shell grammar #4586) and keeps the existing owner matching:main,<section> :: <tab>);UNSUPPORTED, records why an example has no program.discover.shpins the manual into a bundle, parses the operator pages, inventories them under the committed plan, and reports a freshly drafted plan'splan.diffnext toinventory.diff.fetch.pyno longer runs.Extraction fixes this needed
$graphLookuplost its data before.$elemMatch's later sections query "the survey collection" from the section before.$merge,$out, or abulkWritethe page shows but no scenario runs) reportsAFTER_EARLIER_WRITEinstead of asserting the write's effect without running it.$setIntersection's query run for two users, is listed once.UNSUPPORTED_SETUPinstead of running them without data. Inherited data never crosses such an insert, and inherited copies count against the extraction budgets.sqlcounts as a foreign language (pages show SQL equivalents).PROJECT_ID_FIRSTwhen a projection's_idisn't its first key, since Morphia writessuppressId()first.Result at docs e4b0c153
Generation produces 25 new cases. Three generated cases are replaced by better-named ones:
$project's embedded-field and array examples, and$group's "Calculate Count, Sum, and Average", which the docs split into "Group by Year" and "Group by null".Decisions for review
example-names.json. They're for examples that share a section's title, for example "Exclude an Embedded Field with Dot Notation" and "Exclude an Embedded Field with a Nested Document". A shared title names no owner. Please read through them.$bucketAutoowner review is kept with the same digest.$reduce's "Probability" inserts intoeventsbut aggregatesprobability. Two other page errors don't need exclusions:$mod's "Negative Dividend" and the positional "Update Documents in an Array" pass an array toinsertOne, and the extractor now reports them asUNSUPPORTED_SETUPby itself.BitwiseORwith Two Integersreads "Bitwise OR with Two Integers". Stems don't change, but one display name does.Verification
GeneratorTestnow builds parsed pages throughParsedPages), setup inheritance, native group setup, skipped writes and reads across groups.Self-reviewed only: the independent reviewers are out of quota until 2026-11-26.