Skip to content

docs(workflows): verify a run through a route the guide actually creates - #3911

Merged
kojiwakayama merged 3 commits into
mainfrom
fix/dx-workflows-verify-section
Aug 21, 2026
Merged

kojiwakayama merged 3 commits into
mainfrom
fix/dx-workflows-verify-section

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

What

The workflows guide's "Verify it worked" section told readers to poll:

STATE=$(curl -s "http://localhost:3000/api/workflows/runs/$RUN")

The guide never shows that route, and the framework serves no /api/workflows/** handler (the only built-in workflow endpoint is /_dev/api/workflows, the dev dashboard). A reader who followed the page top to bottom got:

$ curl -s -w '%{http_code}' localhost:3000/api/workflows/runs/run_3b71be7d-5c5
Not Found
404

The page's own verification step could not be run. Observed on 0.1.1246-rc.13479.

Why the obvious fix isn't enough

Adding the missing route does not make the documented flow work. createWorkflowClient() defaults to a per-instance MemoryBackend, so a run started by one client is invisible to any other — including one in a different route file. Extracting a single shared client module does not help either.

The runtime itself is fine. Starting a run and reading it back inside one request reaches exactly what the guide promises:

{ "status": "completed", "nodeStates": [{ "start": "completed" }] }

So the defect is reachability, not execution.

Fix

Verify from the request that started the run, which is what the default client can actually support — and state the in-memory constraint outright rather than leaving readers to infer it. For the cross-request case the useWorkflow hook needs, point at a shared persistent backend.

Regression test

tests/docs/guide-content.test.ts pins the invariant behind the defect: every localhost API path the guide tells a reader to call must correspond to a route file the same guide shows them how to create.

Against the old text it fails with:

docs/guides/workflows.md calls /api/workflows/runs/$RUN but never shows the
route that serves it. Routes the guide creates: /api/start-content-workflow

Verification

  • Confirmed the test fails on the old text before changing it.
  • deno test --no-check -A tests/docs/ → 57 passed, 0 failed.
  • scripts/docs/validate-public-docs.ts clean across 126 files.
  • Copied the new route verbatim from the fixed guide into a scratch project and ran the guide's exact curl: status: "completed" with a completed node.
  • Full pre-push suite green.

Not addressed here

The workflow React hooks (useWorkflow, useWorkflowStart, useApproval, useWorkflowList) all default to apiBase = "/api/workflows" and depend on server routes that ship no handler factory and are documented nowhere. That is a framework gap rather than a doc fix, and wants its own issue.

Found while dogfooding the documented developer journey.

The "Verify it worked" section polled `GET /api/workflows/runs/$RUN`, but the
guide never showed that route and the framework serves no `/api/workflows/**`
handler, so the page's own verification step returned 404 for anyone who
followed it top to bottom.

Verify from the request that started the run instead, which is what the default
client can actually support: `createWorkflowClient()` keeps runs in a private
in-memory backend, so a second client never sees them. Say that outright, and
point readers at a shared persistent backend for the cross-request case the
`useWorkflow` hook needs.

The new test pins the invariant behind the defect: every localhost API path the
guide tells a reader to call must correspond to a route file the same guide
shows them how to create.
@coderabbitai

coderabbitai Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c424ec98-4bfb-461c-bfe4-0affa24105ec

📥 Commits

Reviewing files that changed from the base of the PR and between 23803a6 and 7aaa356.

📒 Files selected for processing (2)
  • docs/guides/workflows.md
  • tests/docs/guide-content.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 326 1949 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3133617130

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/guides/workflows.md Outdated
The verify route should return the durable run after any terminal outcome, not throw before readers can inspect failed or cancelled node state. Using the settled handle path matches the guide text and the executor contract.

Confidence: high

Scope-risk: narrow

Tested: git diff --check -- docs/guides/workflows.md

Tested: deno check docs/guides/workflows.md
The verification example now waits for settlement so failed and cancelled runs remain inspectable. A content contract prevents the guide from returning to the throwing result path.

Constraint: Public workflow guidance must cover terminal failures without hiding run state.

Rejected: Catch result() errors in the route | settled() expresses the documented intent directly.

Confidence: high

Scope-risk: narrow

Directive: Keep the verification route non-throwing for all terminal workflow states.

Tested: Deno 2.7.7 formatter, linter, and guide content contract, 45 steps passed.

Not-tested: Full documentation validation task.
@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 21, 2026
Merged via the queue into main with commit 6275c73 Aug 21, 2026
34 checks passed
@kojiwakayama
kojiwakayama deleted the fix/dx-workflows-verify-section branch August 21, 2026 07:05
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