feat(agent-bff): serve the static OpenAPI document behind the agent gate - #1810
Open
Tonours wants to merge 3 commits into
Open
feat(agent-bff): serve the static OpenAPI document behind the agent gate#1810Tonours wants to merge 3 commits into
Tonours wants to merge 3 commits into
Conversation
Tonours
force-pushed
the
feature/prd-886-openapi-static-document
branch
from
August 6, 2026 17:19
ba29239 to
dc83756
Compare
Tonours
force-pushed
the
feature/prd-886-openapi-static-document
branch
3 times, most recently
from
August 6, 2026 17:48
595c4b6 to
ece634c
Compare
4 tasks
Tonours
force-pushed
the
feature/prd-886-openapi-static-document
branch
from
August 6, 2026 20:48
ece634c to
b11c332
Compare
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (6)
馃 Increase coverage with AI coding...馃殾 See full report on Qlty Cloud 禄 馃洘 Help
|
Tonours
force-pushed
the
chore/dedupe-zod-single-v4-resolution
branch
from
August 7, 2026 07:39
3e81c4b to
04d3ba9
Compare
Tonours
force-pushed
the
feature/prd-886-openapi-static-document
branch
from
August 7, 2026 07:42
d51081e to
9652148
Compare
Tonours
force-pushed
the
feature/prd-886-openapi-static-document
branch
from
August 7, 2026 13:01
9652148 to
ec8c3e0
Compare
4 tasks
nbouliol
reviewed
Aug 10, 2026
nbouliol
approved these changes
Aug 10, 2026
nbouliol
left a comment
Member
There was a problem hiding this comment.
Clean additive change, the gate placement and test coverage are solid.
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.

Stacked on #1809 (
chore/dedupe-zod-single-v4-resolution). Base is that branch, notmain; #1809 must be reviewed and merged first. Hard prerequisite:@asteasolutions/zod-to-openapitakes zod as a peer dependency, so without the dedupe yarn can bind it to a different zod copy than the one agent-bff builds its schemas from.fixes PRD-886
What
GET /agent/openapi.jsonserves an OpenAPI 3.1 document describing the six generic BFF routes (list, count, relation list/count, action form/execute). Generated from Zod, built once at boot, static: path placeholders only, no tenant data. The only environment-derived value is the package version.Why this mount point
The BFF has no deny-by-default gate: auth applies only to paths under
/agent. Mounting the route inside theagentScopedchain, right after the auth middlewares, inherits the existing gate, so an unauthenticated request gets a 401 before path matching. Root mounting would have made the document public. The route sits beforebuildAgentRouteMiddlewares, so it answers even whenAGENT_URLis unset and never calls the agent.How
src/openapi/module:extendZodWithOpenApiloaded once, request/response/error schemas, registry plusOpenApiGeneratorV31, and aserializeOpenApishared with the future CLI subcommand./agent/v1prefix, recursive condition-tree filter, PascalCase operators (required),sort[].directionoptional,page.offsetmust be a multiple oflimit,parentIdstring or number,recordIdsrequired even when empty.messagefield.src/openapi/is one line in thecli-core.tsmiddleware chain. No existing route, handler, or schema changed.Known limits: action
200responses are typedunknown(belongs with the action work); relation list/count skip capabilities validation, so their 422 field errors are unreachable, and theConditionTreedescription says so (#1801 fixes the validation gap). Per-collection unfolding is PRD-684/PRD-685.How to test
yarn workspace @forestadmin/agent-bff test yarn workspace @forestadmin/agent-bff lintAgainst a running agent:
Ran on this branch: 767 tests pass (41 added), lint and build clean.
redocly lintruns inside the suite, so the document cannot go invalid unnoticed. An end-to-end pass against a live agent covered the 401 gate (no leak in the body), the root 404, the authenticated 200, redocly validation over HTTP, and eight unauthenticated path variants (trailing slash, case change,%6f, dot segments,.., doubled slash): none serves the document.Definition of Done
General
Security