Repository navigation
fix(core): batch multi-kind route entries as B4_E1008 - #722
Merged
Merged
Conversation
A route `index.ts` exporting more than one of `agent`, `workflow`, `graph` or `chain` threw a plain `Error` from inside the recursive route walk: the message did not name the offending file, it carried no registry code so no `[B4_Exxxx]` footer rendered, and an app with several of them surfaced one per run. `classifyRouteExports` now returns this outcome instead of throwing, the walk collects every offending entry, and `collectRouteDefinitions` throws once as the new `B4_E1008`, naming each file and the kinds it exported. The two discovery defects carry different codes and so cannot share one error. When an app has both, the unrecognised entries (`B4_E1007`) are reported first and the message states how many multi-kind entries are queued behind them, so the second round is not a surprise. The wording `must export exactly one of "agent", "workflow", "graph", or "chain"` is preserved: the runtime's `isBoundaryError` classifier and three CLI suites match on it. Co-Authored-By: Claude Opus 5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
blove
temporarily deployed
to
vercel-preview
September 18, 2026 00:48 — with
GitHub Actions
Inactive
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #705, which batched the "no recognisable export" defect. This closes the same gap one layer over.
Problem
A route
index.tsexporting more than one ofagent,workflow,graphorchainthrew a plainErrorfrom inside the recursive route walk:route-module-shape.tsdoes),[B4_Exxxx]footer rendered — the oneb4 checkdiagnostic with no docs link,Change
classifyRouteExports(wasinferRouteKind) returns a discriminated outcome —kind/multiple/unrecognised— instead of throwing. The walk collects every offending entry, andcollectRouteDefinitionsthrows once as the newB4_E1008, naming each file and the kinds it exported.On the two codes.
B4_E1007(unrecognised) andB4_E1008(too many kinds) are distinct defects with distinct codes, and one error carries one code — so an app with both cannot report everything in a single error. Rather than leave that as a silent second round, theB4_E1007message states what is queued behind it:Message compatibility. The substring
must export exactly one of "agent", "workflow", "graph", or "chain"is preserved deliberately:isBoundaryErrorinpackages/cli/src/lib/runtime/execute-route-core.tsclassifies errors by matching it, andcheck-command,verify-commandandrun-commandtests assert it.Tests
workflow-and-graphcase now asserts theB4_E1008code, the file path, andfound: workflow, graphB4_E1007first, with the queuedB4_E1008countB4_E1008added to the registry assertions inpackages/sdk/test/errors.test.tsverify-command.test.tsupdated:b4 verify's JSON error now carriescode: "B4_E1008", which is theverify-carries-error-codesbehaviour working as intended on a defect that previously had no codeerrors.mdxregenerated viapnpm docs:errors;cli.mdxdocuments the code and the two-code hand-off.Verification
@b4run/coretestsdiscover-routes.test.ts20/20)@b4run/clitests@b4run/sdk/@b4run/langgraph@b4run/webtestspnpm lint/pnpm typecheckBoth rendered messages were also checked through the built CLI's discovery path, not just in-process.
🤖 Generated with Claude Code