Skip to content

docs(tooling): Enforce JSDoc for public APIs [skip chg] - #12282

Closed
Timothee Guerin (timotheeguerin) wants to merge 4 commits into
microsoft:mainfrom
timotheeguerin:eng/public-jsdoc-ratchet
Closed

Timothee Guerin (timotheeguerin) wants to merge 4 commits into
microsoft:mainfrom
timotheeguerin:eng/public-jsdoc-ratchet

Conversation

@timotheeguerin

@timotheeguerin Timothee Guerin (timotheeguerin) commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

New public JavaScript APIs can currently add undocumented surface while documentation backfills are in flight. Add an identity-based no-regression check: fixing an old gap cannot offset a new undocumented member.

pnpm check:public-jsdoc checks all 74 resolved public entry points across 31 publishable packages independently; check:eng includes it. --prune only retires existing debt and cannot approve a new gap. The generated baseline is explicit debt, not a permitted count.

A later Box<Metadata> result still requires Metadata documentation even if Box<string> was checked first. Mapped types expose their selected members, not omitted implementation details.

This is source-level summary enforcement, accepting inherited/linked documentation and excluding internal/nonpublic declarations. The four client emitters are excluded; shared http-client and all emitter-framework components remain included. Existing unavailable tspd root, protobuf/testing, and http-specs root entries are visible, target-pinned exceptions, invalidated when their source/artifact appears. CSS, JSON and TypeSpec assets have no JavaScript documentation surface.

Validation uses the actual command with temporary public-member, inheritance, internal-export, alias/signature-type, mapped-type, augmentation and unresolved-entry changes—not committed build-script fixtures. No package sources or dependencies are changed.
Windows path handling was also validated on real Windows builds with Node 22, 24 and 26.

Part of #12228.

@azure-sdk-automation

azure-sdk-automation Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Identity collisions and traversal omissions allow new undocumented APIs to bypass the check.

3 open findings
What changed in this PR

Adds a public JavaScript documentation check to prevent new undocumented APIs while existing documentation gaps are addressed.

Changes:

  • Checks public entry points and exposed types against an identity-based baseline.
  • Integrates enforcement into check:eng.
  • Documents exclusions, source mappings, and baseline pruning.
File Description
package.json Adds the documentation command and engineering-check integration.
eng/​common/​scripts/​check-public-jsdoc.ts Implements API discovery, documentation traversal, and baseline enforcement.
eng/​common/​scripts/​check-public-jsdoc.md Explains coverage, exceptions, and contributor workflow.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +454 to +458
const names = [qualifiedDeclarationName(decl, symbol.name)!];
for (let node = decl.parent; node && !ts.isSourceFile(node); node = node.parent) {
const name = qualifiedDeclarationName(node);
if (name !== undefined) names.unshift(name);
}
Comment on lines +582 to +589
if (symbol.flags & ts.SymbolFlags.Module) {
for (const child of checker.getExportsOfModule(symbol)) visitSymbol(child);
} else {
if (symbol.flags & ts.SymbolFlags.Type) visitType(checker.getDeclaredTypeOfSymbol(symbol));
if (symbol.flags & ts.SymbolFlags.Value) {
visitType(checker.getTypeOfSymbolAtLocation(symbol, declarations(symbol)[0]));
}
}
Comment on lines +685 to +692
const decl = declarations(property)[0];
if (!decl) continue;
if (owned(property) && !seenSymbols.has(property)) {
seenSymbols.add(property);
record(property);
}
context = identity(property);
visitType(checker.getTypeOfSymbolAtLocation(property, decl));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants