feat(agent): support get-one projection via the Forest-Projection header - #1813
Open
PMerlet wants to merge 1 commit into
Open
feat(agent): support get-one projection via the Forest-Projection header#1813PMerlet wants to merge 1 commit into
PMerlet wants to merge 1 commit into
Conversation
The get-one route now reads the projection from the Forest-Projection header (format: `field1,field2,relation:subfield`), taking precedence over the `fields[...]` query params. This lets the frontend send large projections without hitting query string size limits enforced by common WAF rules (e.g. AWS WAF SizeRestrictions_QUERYSTRING, 2KB). The agent announces a new `canUseProjectionViaHeader` capability so the frontend only sends the header to agents that understand it. The existing query-string parsing is kept as fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 new issue
|
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (2)
🛟 Help
|
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.

Motivation
The get-one projection currently travels in the query string (
fields[Collection]=...&fields[relation]=id). On large collections it exceeds query string size limits enforced by common WAF configurations (e.g. the AWS WAF managed ruleSizeRestrictions_QUERYSTRING, 2,048 bytes), which blocks the CORS preflight and breaks the details view.fixes PRD-892
Changes
QueryStringParser.parseProjectionFromHeader: reads the projection from theForest-Projectionheader. Contract:field1,field2,relation:subfield(e.g.id,title,author:id), whitespace around commas tolerated, repeated header supported;a:b:c) are rejected, strict parity with whatfields[...]can express;fields[...]query params; the query-string parsing is kept as fallback.canUseProjectionViaHeader: true(next tocanUseProjectionOnGetOne, which is kept — the frontend does the prioritization).@koa/corswithout anallowHeadersoption echoesAccess-Control-Request-Headers, so the preflight already allows the header. An integration test pins this across all 8 supported mount targets (standalone, express, koa, fastify v2/v3/v4, nestjs express/fastify).Tests
🤖 Generated with Claude Code
Note
Add
Forest-Projectionheader support for GET one record field selectionGetRoute.handleGetreads projection from theForest-ProjectionHTTP header first, falling back to query string params when the header is absent or empty; primary keys are always appended viaprojection.withPks.QueryStringParser.parseProjectionFromHeaderis a new static method that parses and validates the header value, supporting single-level relation notation (e.g.relation:field) and throwing aValidationErrorfor invalid or deeply nested paths./_internal/capabilitiesendpoint now includescanUseProjectionViaHeader: trueinagentCapabilitiesto signal this feature to clients.Macroscope summarized bceed7c.