Skip to content

Keep API documentation in artifact storage and raise its limits - #290

Merged
tnkuehne merged 4 commits into
mainfrom
feat/service-documentation-storage
Nov 22, 2026
Merged

tnkuehne merged 4 commits into
mainfrom
feat/service-documentation-storage

Conversation

@tnkuehne

@tnkuehne tnkuehne commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

API documentation travelled inside artifact.metadata. About twenty control-plane reads load that column (catalog, network, workflows, telemetry, jobs, uploads …) and validate the whole document each time. That was fine at the old 256 KiB limit, but generated clients for large APIs need far more: a GraphQL API such as Linear's has about 500 operations and 1,000 types, and single type definitions exceed 32,768 characters.

What changes

  • Storage: publishing writes the documentation to artifact storage at apps/{appId}/service-documentation/{artifactId}.json, the key the app runtime already reads, and stores a small summary in the new artifact.documentation column (hash plus, per entrypoint, whether it documents anything). metadata no longer carries the document.
  • Readers: the API/CLI service description and the agent package lease read the document from storage; the catalog decides from the summary which entrypoints to list. Hosted deployments no longer copy the document, because upload already wrote it to the runtime's bucket.
  • Upload: the CLI sends the documentation as its own multipart part, __widefleet_documentation (the platform prefix keeps it apart from module names), instead of a field inside the worker metadata. Metadata keeps its 64 KiB limit; the documentation part is bounded by the documentation limit. The metadata contract no longer has service_documentation, and publishing checks that the documentation only describes published entrypoints.
  • Retries: storage keeps the first object under a key, so publishing verifies the stored bytes by hash and rejects an upload session that tries to publish different documentation, or none after documentation was written.
  • Limits (contract and Rust extractor together): 1,024 methods per entrypoint, 4,096 types, 262,144 characters per text, 8 MiB per document.
  • Migration 0037: adds the column and removes the document from existing metadata. Artifacts published earlier keep no documentation in the control plane until the app is deployed again (Hosted runtimes still serve the copy written by their last deployment).

MCP describe still returns a whole entrypoint. Per-method search and describe follow in a separate PR, before any app publishes documentation of this size.

Verification

  • pnpm check
  • pnpm exec vitest run (all suites after pnpm -C apps/control-plane build and build:cloudflare)
  • RUN_SERVICE_TESTS=1 pnpm exec vitest run apps/control-plane/tests/app-services-runtime.test.ts
  • pnpm exec playwright test tests/e2e/auth.spec.ts
  • RUN_CLOUDFLARE_TESTS=1 pnpm exec vitest run apps/control-plane/tests/cloudflare
  • RUN_CLI_TESTS=1 pnpm exec vitest run apps/control-plane/tests/service-documentation.test.ts apps/control-plane/tests/app-services-cli.test.ts with a freshly built CLI
  • bash tools/cargo.sh test -p platform-service-docs -p platform-cli -p platform-core, clippy on those crates and platform-agent with --all-targets -D warnings, fmt --all --check

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable issues remain.

Summary

Moves API documentation from artifact.metadata into artifact storage, with a small summary in artifact.documentation.

  • API documentation lives in artifact storage, while artifact rows keep only a small summary.
  • Worker uploads send API documentation in its own multipart file part.
  • Generated API documentation can include far more methods, types, and text.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  CLI[CLI or template builder] --> Upload[Publish worker and documentation]
  Upload --> Storage[Artifact storage: full document]
  Upload --> Database[Database: hash and entrypoint summary]
  Database --> Catalog[Service catalog]
  Database --> Reader[Service description or agent packages]
  Storage --> Reader
  Storage --> Hosted[Hosted runtime]
Loading

Reviews (5) · Last reviewed commit: "Upload API documentation as its own part" · Reviewed by Greptile

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

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 7f2a0f3 Nov 22 2026, 03:22 PM

Comment thread crates/platform-service-docs/src/lib.rs Resolved
Service documentation was stored inside artifact metadata, which about twenty
control-plane reads load and validate. Publishing now writes the document to
artifact storage, under the key the app runtime already reads, and keeps only a
small summary in a new artifact column. The API description, the agent package
lease and the catalog read the document or summary where they need it, and
Hosted deployments no longer copy it.

The limits grow to 1,024 methods, 4,096 types, 262,144 characters per text and
8 MiB per document, so generated clients for large APIs can be documented.
Artifacts published before this change keep no documentation until the app is
deployed again.
The metadata part of a worker upload kept its 64 KiB limit including the
documentation, so documentation within the new limits failed the upload. The
documentation now counts against its own 8 MiB limit and the rest of the
metadata keeps 64 KiB.

A publish can write documentation and then roll back. A retry of that session
without documentation now fails instead of publishing an artifact whose runtime
key still holds the first attempt's document.

The browser test for service documentation publishes its fixtures through
storage and the artifact summary.
The service documentation test now writes documentation to artifact storage,
which the default bucket does not provide on a fresh test service.
The CLI now sends API documentation as a separate multipart part instead of a
field inside the worker metadata. Metadata keeps its 64 KiB limit unchanged, the
documentation part has its own 8 MiB limit, and the metadata contract no longer
carries documentation at all. Publishing checks that documentation describes
only the entrypoints the worker publishes, which the metadata schema checked
before.
@tnkuehne
tnkuehne force-pushed the feat/service-documentation-storage branch from 3e131ae to 7f2a0f3 Compare November 22, 2026 15:21
@tnkuehne
tnkuehne removed this pull request from stack #299 November 22, 2026 16:03
@tnkuehne
tnkuehne added this pull request to stack #304 November 22, 2026 16:03
@tnkuehne
tnkuehne merged commit 6c8cda7 into main Nov 22, 2026
17 checks passed
@tnkuehne
tnkuehne deleted the feat/service-documentation-storage branch November 22, 2026 16:57
tnkuehne added a commit that referenced this pull request Nov 22, 2026
## Why

With #290 an app can publish documentation for large APIs (hundreds of
methods, thousands of types). MCP `describe` and `widefleet services
describe` still returned an entrypoint's whole document with every type,
which floods an agent's context before it calls anything.

## What changes

**MCP**
- `search` returns **methods**: hostname, entrypoint, method and the
first line of its summary, best matches first. `hostname` and
`entrypoint` filters narrow a query or, without words, list every method
of a service. They replace the former "exact hostname as query" rule.
- `describe` takes `methods` (1–20) and returns the entrypoint's
documentation with only those methods, plus the types their signatures
use, directly or through other types.
- The service index stores one entry per method (format 2). Indexes of
the earlier format are rebuilt like expired ones. Entrypoints without
documented methods are not listed, since `call` only reaches methods.

**API and CLI**
- `GET /app-services/{service}` returns `documented`, the list of
methods with summaries, and `documentation: null`. With `entrypoint` and
`methods` (comma-separated), `documentation` holds the selected methods
and their types.
- `widefleet services describe APP [--entrypoint NAME] [--method NAME]…`
- The API reference page in the control plane keeps the complete
documentation (`connections.reference`).

Selecting methods and their types is shared contract logic
(`selectServiceMethods`, `listServiceMethods`), used by the runtime and
the control plane.

## Verification

- `pnpm check`
- `pnpm exec vitest run` (all suites)
- `RUN_SERVICE_TESTS=1 pnpm exec vitest run
apps/control-plane/tests/app-services-runtime.test.ts` (workerd and
celld)
- `RUN_CLOUDFLARE_TESTS=1 pnpm exec vitest run
apps/control-plane/tests/cloudflare`
- `RUN_CLI_TESTS=1 pnpm exec vitest run
apps/control-plane/tests/app-services-cli.test.ts
apps/control-plane/tests/service-documentation.test.ts` with a freshly
built CLI
- `pnpm exec playwright test tests/e2e/auth.spec.ts`
- `bash tools/cargo.sh clippy -p platform-cli --all-targets -- -D
warnings`, `fmt --all --check`


Documentation: #298 (draft until a release includes #290 and this PR).








<!-- greptile_comment -->

<!-- greptile_summary -->

<h2><a
href="https://app.greptile.com/api/retrigger?id=115781343&amp;sig=ba35fdbf0170c98e3c6618b2f7aae8f198a6e4dd455c4745161612814adb2ebf"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img
alt="Retrigger"
src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"
align="right"></picture></a><a
href="https://app.greptile.com/-/switch-tenant?tenant=mendra&amp;next=%2Fwidefleet%2Fwidefleet%2Fpull%2F297&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source
media="(prefers-color-scheme: light)"
srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img
alt="View in Greptile"
src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"
align="right"></picture></a>Confidence Score: 5/5</h2>

<!-- greptile-impact-verdict --> The PR appears safe to merge, with the
documentation updates supplied by PR #298.

<details open><summary><h3>Summary</h3></summary>

Changes API discovery from whole services to individual methods.
- MCP search returns matching app methods.
- MCP describe returns documentation for selected methods.
- The API and CLI list methods and describe selected ones.

No new actionable issues were found. Tests were inspected, not run.
</details>

<details open><summary><h3>Diagram</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Published API documentation] --> B[Method index]
  B --> C[MCP search]
  A --> D[selectServiceMethods]
  D --> E[MCP describe]
  D --> F[HTTP and CLI selected descriptions]
  A --> G[Complete reference page]
```
</details>

<!-- greptile_confidence_score:5 -->

<sub>Reviews (4) · Last reviewed commit: ["Match type names only as
whole
names"](1701c54)
· [Reviewed by
Greptile](https://www.greptile.com/?utm_source=greptile_review&utm_medium=github&utm_campaign=review_public&utm_content=widefleet/widefleet)</sub>

<!-- /greptile_comment -->
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