Repository navigation
refactor(agent-bff): extract the agent edge out of build-bff.ts - #2037
Merged
Merged
Conversation
2 new issues
|
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (3)
馃洘 Help
|
Tonours
marked this pull request as ready for review
October 23, 2026 12:17
PMerlet
approved these changes
Oct 23, 2026
PMerlet
left a comment
Member
There was a problem hiding this comment.
Approved after /validator run 2037-20261023150648-PMerlet: nothing blocking posted, 0 preferential or code style, 0 suppressed below all.
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.

Moves the agent edge (read model, transport, unfold source, agent and AI middlewares) out of
build-bff.tsintoagent-edge.ts. Pure move: middleware order unchanged, no public export change.fixes PRD-1544
What
packages/agent-bff/src/agent-edge.ts(new, 297 lines)resolveReadModelBundle,resolveTransport,toUnfoldSource,resolveUnfoldSource,buildAgentRouteMiddlewares,buildAiMiddlewares,buildAgentMiddlewares,agentScoped, copied verbatim with their commentspackages/agent-bff/src/api-key/api-key-edge.ts(new, 59 lines)resolveApiKeyConfig,buildApiKeyMiddleware,createApiKeyUnavailableGuardpackages/agent-bff/src/build-bff.ts(635 to 313 lines)buildBff. Re-exportsresolveUnfoldSource, sorender-openapi.tsis untouchedpackages/agent-bff/test/openapi/openapi-mount-invariant.test.tsopenapi/*imports move frombuild-bff.tstoagent-edge.tswith the codeWhy
build-bff.tsmixed body guards, the OAuth edge, the API key edge and the agent routes.build-bff.ts, but only the agent edge calls it: leaving it there would makebuild-bff.tsandagent-edge.tsimport each other at runtime. It moves to a leaf module next to the otherapi-key/files instead.agent-edge.tsreadsOAuthEdgefrombuild-bff.tsas a type import only, erased at compile time.openapi/files may importopenapi/*, and that import moved with the code. The rule it guards is unchanged.How to test
yarn workspace @forestadmin/agent-bff testgit diff --stat origin/main -- packages/agent-bff/testopenapi-mount-invariant.test.ts, +2/-1chaininbuildAgentMiddlewaresandmiddlewaresinbuildBffvsorigin/maindiffidenticalnpx tsc --noEmit -p packages/agent-bff,npx eslinton the three files4ac5d17vs baselinee98f1bd(main), real stack:smoke(forest-bffCLI against a v1-express agent, API key) andgateway-api-rename(cli, bff, gateway, boot mounts)git diff origin/main -- packages/agent-bff/src/index.tsDefinition of Done
General
Security