feat(blueprints): scope get to one field or set - #51
Merged
sylvesterdamgaard merged 1 commit intoSep 9, 2026
Merged
Conversation
The format spec for a page builder is proportional to every set it can hold, so on a real blueprint `get` runs to hundreds of kilobytes at the default depth and a client cannot take the response at any depth that is also useful: deep enough to describe a component is too large, small enough to return leaves the nested groups and bard empty. Add a `field` parameter taking a dot path — "page_builder", "page_builder.ContentSection", "page_builder.ContentSection.media" — that narrows the response to that subtree. Segments are the handles the spec already publishes, so an agent can walk down from allowed_set_types and group_fields. Both include_config and include_format_spec are scoped with it, so the config a client needs for one component no longer costs a whole blueprint. A path that does not resolve reports the valid segments at the level it failed, which makes the parameter self-teaching. The truncation message now points at `field` rather than telling callers to raise max_format_depth, which on a large blueprint walks them into the response size guard. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
11 tasks
This was referenced Sep 9, 2026
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.
Description
The format spec for a page builder is proportional to every set it can hold, so on a real blueprint
getruns to hundreds of kilobytes and there is no depth that is both usable and returnable: deep enough to describe a component is too large, small enough to return leaves nested groups and bard empty.Adds a
fieldparameter taking a dot path that narrows the response to one field or set:Both
include_configandinclude_format_specare scoped with it.Type of Change
Related Issue
None. Found trying to write a page-builder entry from the tools alone. On a blueprint with eleven component sets,
getwithinclude_format_specreturns 193KB at the defaultmax_format_depth: 2and 217KB on a sibling collection — past the response guard, and past what a client will accept even with the guard raised. Dropping to depth 1 fits at 51.5KB but returnsgroup_fields: []and no bard set definitions, which is exactly the part you need to write a component.Testing
composer test)composer quality)tests/Feature/Routers/BlueprintFieldScopeTest.php— 10 cases: the whole blueprint still comes back without the parameter, a field path, a set path, a path descending into a group, config scoped, format spec scoped, a scoped response smaller than the whole, and three error paths (unknown top-level segment, unknown set, descending into a leaf).Full gate green — pint, PHPStan level 9, 1116 tests / 5633 assertions.
Environment
Checklist
Notes
Segments are the handles the spec already publishes —
allowed_set_typesfor a set,group_fieldsfor a group — so an agent can walk down from what it has already read. A path that does not resolve reports the valid segments at the level it failed, which makes the parameter self-teaching in the same way the field-handle errors are.The truncation message changes with it. It currently says to re-fetch with a higher
max_format_depth, which on a large blueprint walks the caller straight into the size guard; it now points atfieldinstead.Shape: a field path returns
blueprint.field, a set path returnsblueprint.fields, and both carryblueprint.field_pathso a response is self-describing. Without the parameter nothing changes.Bard is handled by the
Replicatorcheck, sinceBard extends Replicator.Touches the same method as #43, so whichever merges second will want the
icon_setsblock re-applied inside the scoped branch — one line, no semantic conflict.