Skip to content

fix(studio): declare 400 and 429 on the knowledge routes - #2313

Merged
kantord merged 1 commit into
mainfrom
studio-followups/03-knowledge-statuses
Oct 15, 2026
Merged

kantord merged 1 commit into
mainfrom
studio-followups/03-knowledge-statuses

Conversation

@kantord

@kantord kantord commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Summary

The validation hook and app.onError can return 400 and 429 on every knowledge route, but none documented them.

Part of #2303 ("Tiny follow-up fixes"); it does not close it. This is PR 3 of 14 in a stack of draft PRs, reviewed and merged in order.

What changed

  • One shared transportErrors constant spread into all 15 knowledge routes (the issue said 16).
  • A convention test reads the generated OpenAPI document and asserts every knowledge route declares 400 and 429.
  • openapi.json and the generated types regenerated with pnpm run generate.

Behavior changes

None at runtime. The OpenAPI document and generated types gain the two statuses.

Verification

Biome, typecheck, the full Studio test suite and pnpm generated:check pass on this branch, run on the assembled stack. The full Playwright suite passes on the stack tip (122 passed, 30 skipped, 0 failed, including chat-approval against a real mecated build). With the spreads removed, the convention test fails.

Not included

Other route groups.

Size note: about 44 hand-written lines. The other ~1,500 added lines are mechanical generated output (openapi.json, types.gen.ts), which is why generated files are excluded from the usual 500-line budget.

Fully or partially written by an AI agent.

🤖 Generated with Claude Code

@kantord
kantord added this pull request to stack #2325 October 14, 2026 13:27
@kantord kantord mentioned this pull request Oct 14, 2026
41 tasks done
@kantord
kantord marked this pull request as ready for review October 15, 2026 08:41

@peppescg peppescg 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.

Thanks Daniel. One shared constant plus a test built from the generated OpenAPI document is a good way to keep these routes in line.

Nits:

  • apps/server/src/routes/knowledge.ts:80: the comment says the hook and onError can answer any route with "these", but errorStatus also maps failed_precondition/conflict/aborted to 409 on every route, and routes like actOnLearnedSkill, reflectSession and generateMemoryConsolidationPlan don't declare it. Either add 409 to transportErrors, or reword the comment so it doesn't claim to cover everything.
  • apps/server/src/routes/knowledge.test.ts:279: toHaveLength(15) will fail with a bare count mismatch when #2155's /api/v1/skills/{name}/files route lands. Whichever PR merges second needs to add the spread and bump the count to 16.

@kantord
kantord force-pushed the studio-followups/03-knowledge-statuses branch from efa684b to 653ddf5 Compare October 15, 2026 09:25
Base automatically changed from studio-followups/02-compat-cache to main October 15, 2026 09:25
The validation hook and app.onError can return both on every knowledge
route, but none documented them. One shared constant now adds them to
all 15 routes; the generated OpenAPI document and types follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@kantord
kantord force-pushed the studio-followups/03-knowledge-statuses branch from 653ddf5 to a47cd53 Compare October 15, 2026 09:26
@kantord
kantord merged commit 9db6ddd into main Oct 15, 2026
1 check passed
@kantord
kantord deleted the studio-followups/03-knowledge-statuses branch October 15, 2026 09:26
kantord added a commit that referenced this pull request Oct 15, 2026
…ard-coding the route count

main's Studio job has been failing since the skill files route (#2155) landed
next to the knowledge-route convention test (#2313). Each change was fine on
its own: #2313 declared 400 and 429 on the 15 knowledge routes and pinned the
count at 15, and #2155 added a 16th route without them.

- Spread `transportErrors` into `listSkillFilesRoute` like the other knowledge
  routes. The OpenAPI document and generated types gain the two statuses.
- The convention test no longer asserts an exact route count, so the next
  knowledge route is checked without editing the test.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 20, 2026
2 tasks
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.

2 participants