Repository navigation
docs(emitters): design the docs emitter and its shared examples - #1337
Open
OmarAlJarrah wants to merge 7 commits into
Open
OmarAlJarrah wants to merge 7 commits into
OmarAlJarrah wants to merge 7 commits into
Conversation
The docs emitter reused the SDK's primary response and content, had no design for URLs, links, collisions or versions, spelled usage examples it could only re-derive, and left documentation extensions and agent documents unaddressed. Every artifact would also synthesize its own example values. The docs now render every response, error case and content, the primary only ordering them, and each type's request and response shapes apart. A route plan derives every URL from an ID-keyed catalog through templates, refuses any two entities on one URL after the templates apply, resolves links as ID requests, and keeps one entity's identity across version snapshots through route tables the engine passes in. Agent Markdown and llms.txt share those routes and escape spec text. SDK emitters return a usage sample per operation for the docs, and the plan holds one set of examples, declared first and otherwise seeded from each entity's correlation key, for docs, samples, tests and mocks. Documentation extensions are read by mapping, internal markers left to the filter pass, and a CLI is planned as an extension point built from IR facts.
…docs/emitters-docs-artifacts
The docs emitter now receives every SDK target's usage samples and every version snapshot's route table, but the shared refiner context carried neither, so a docs refine step could not read them. Ctx holds both.
…docs/emitters-docs-artifacts
…docs/emitters-docs-artifacts
…docs/emitters-docs-artifacts
…docs/emitters-docs-artifacts
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.
Summary
The docs emitter was one bullet: it "reuses the shared plan verbatim (primary response/content, …)" and lowers to a
docast. Every docs target hits the questions below on its first build, and so do the samples, tests and mocks that share its values. They are one contract: what the non-SDK artifacts render, and from which shared facts.Response,ErrorCaseandContentis rendered. A type is rendered per direction through itsModelShape, so a write-only property is in no response table and requiredness reads in its own direction.OpIDand page-worthy type has a route and everyPropIDan anchor, with a diagnostic for anything left;EmitterInput.RoutesbehindCapabilities.CrossVersion, so a switcher links one entity across versions, and an absent entity resolves to a "not in this version" page.llms.txtat site, service, version and target scope go through the same route plan. "Safe" comes fromOpPlan.Effects, and "destructive" only from a declared hint or promoted extension, as the issue's comment corrected. Spec text is escaped and raw HTML is never passed through.EmitterOutput.Samplesper operation, and the engine runs the SDK targets first and hands the docs emitterEmitterInput.Samples, so a call is spelled by the target that generates it. A sample that fails to render is a diagnostic. The templates table now says so.Plan.Examplesholds, per type, property, parameter and operation, the declared examples, else one synthesized underplan.Policy.Examples: valid against the constraints, bounded in depth and items,Inferred, and seeded from the correlation key. Docs, samples, SDK tests and the mock share it. This departs from the issue's "persisted in the manifest": seeding makes a value reproducible from its inputs, and a value that changes because its schema did had to change, so persistence would add state without adding stability. A value the synthesizer cannot make valid, such as an unsatisfiablepattern, is reported, never emitted invalid.milestones.mdandarchitecture.md§2.3 name it. A table maps each CLI behavior to the IR or plan fact it reads. Flag constraints come from union branches byPropIDand flag names from ID-keyed collision resolution, which designs out the failure modes the issue reproduced (leaf-name keys,foo_baragainstfoo.bar, dropped deep fields, unions beside properties).T-39 pins the docs rules and T-40 the shared examples.
Closes #720
Closes #585
Closes #586
Closes #699
Closes #722
Closes #703
Closes #587
Test plan
Sample,RouteTable,ExampleandExamplePolicydeclarations, extracted verbatim, passgo vet.ModelShape,Docs.Refs,ResourceInfo,ir.Example, the filter and version-slice passes) checked against its document.Stacked on #1336 (#1329 ← #1331 ← #1332 ← #1334 ← #1335 ← #1336). Merge in order. After each base lands, "Update branch" is a merge of
mainthat conflicts nowhere.