Skip to content

Store API documentation with short type names - #313

Merged
tnkuehne merged 1 commit into
mainfrom
feat/short-type-names
Nov 22, 2026
Merged

tnkuehne merged 1 commit into
mainfrom
feat/short-type-names

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

Extracted type names carry module paths, such as import("./src/api").Issue. The reference page shortens them for display, but MCP describe, the API and the CLI return them in full. In a generated API the prefix is about a fifth of every describe result, and callers must copy the qualified name to describe a type: in a usability test, an agent's natural first try was WorkflowStateFilter, while only import("./src/api").WorkflowStateFilter worked.

What changes

  • shortenTypeNames in contracts: removes the module path of each documented type reference where the short name is unambiguous among the documented types, and keeps the qualified name otherwise. It rewrites names, definitions, type parameters, signatures and uses together, so every reference still names its declaration. It is idempotent. The logic is the reference page's existing display shortening, moved unchanged.
  • Publishing: the control plane stores documentation after shortening it, for uploads from the CLI and the app builder alike. The extractor's output and the documentation format stay unchanged.
  • Reference page: shows names as stored instead of shortening on each render.

Documentation stored before this change keeps its qualified names until the app is deployed again.

On the Linear template, the stored document shrinks from 1.80 MB to 1.53 MB; describing viewer with issues from 38 KB to 31 KB, and issueCreate from 16 KB to 14 KB.

Verification

  • pnpm check
  • pnpm exec vitest run apps/control-plane packages
  • The publish integration test uploads documentation with qualified names and asserts the stored document and the agent package carry the short ones.
  • The shortening test asserts names, signatures and uses change together, ambiguous names stay qualified, and a second pass changes nothing.
  • RUN_CLI_TESTS=1 documentation extraction, app-services CLI and integration tests; RUN_SERVICE_TESTS=1 runtime service tests (workerd and celld); playwright test tests/e2e/auth.spec.ts

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues were found.

Summary

Moves type-name shortening from page rendering to publication, so stored documentation uses the same names across the reference page, API, CLI and MCP.

  • Published service docs use short names for unambiguous types.

tnkuehne explicitly acknowledges that existing documentation keeps qualified names until the app is deployed again.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[CLI upload] --> C[uploads.publish]
  B[App builder] --> C
  C --> D[shortenTypeNames]
  D --> E[Encode and store documentation]
  E --> F[Reference page]
  E --> G[API and CLI describe]
  E --> H[Agent package and MCP]
Loading

Reviews (1) · Last reviewed commit: "Store API documentation with short type ..." · Reviewed by Greptile

Extracted type names carry module paths, such as import("./src/api").Issue.
The reference page shortened them for display, but describe returned them in
full: about a fifth of a describe result, and callers had to copy the
qualified names to describe a type. Documentation is now stored with each
name shortened where it stays unambiguous, in names, definitions, signatures
and uses alike, so every reader shows and accepts the same short names.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
widefleet-docs 613bbcc Nov 22 2026, 10:08 PM

@tnkuehne
tnkuehne merged commit d2550d0 into main Nov 22, 2026
24 of 26 checks passed
@tnkuehne
tnkuehne deleted the feat/short-type-names branch November 22, 2026 22:23
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