feat: add include_related option to client.Workspace in codersdk - #29284
Open
spikecurtis wants to merge 1 commit into
Open
spikecurtis wants to merge 1 commit into
spikecurtis wants to merge 1 commit into
Conversation
spikecurtis
added this pull request to stack #29285
September 14, 2026 12:29
spikecurtis
force-pushed
the
spikecurtis/workspace-sdk-include-related
branch
from
September 14, 2026 14:13
cb631bd to
3282bbe
Compare
spikecurtis
force-pushed
the
spikecurtis/workspace-sdk-include-related
branch
from
September 14, 2026 15:33
3282bbe to
d4ec4af
Compare
spikecurtis
marked this pull request as ready for review
September 15, 2026 07:24
spikecurtis
force-pushed
the
spikecurtis/workspace-sdk-include-related
branch
from
September 15, 2026 12:16
d4ec4af to
144f8a9
Compare
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.
Part of the lite
codersdk.Workspacework (GRU-82, RFC). Stacked on #29233, which wiredinclude_relatedintoGET /api/v2/workspaces/{workspace}.Adds
include_relatedsupport to thecodersdkclient, expressed with the typed selection tree so only supported selections are representable:wsrelatedpackage fromcoderd/tocodersdk/so both the server and the client can sharewsrelated.Config.coderdalready depends oncodersdk, so this only changes import paths on the server side.Config.QueryParam, which encodes a selection into theinclude_relatedvalue: the dotted path of each selected node that has no selected descendants. Selecting a node implies its ancestors, soParseround-trips the result back into an equalConfig(covered by a round-trip test).WorkspaceOptionsgainsIncludeRelated *wsrelated.Config. A nil value omits the parameter (server returns everything, unchanged); a non-nil value is encoded viaQueryParam, and a zeroConfigloads only the workspace.Client.Workspacenow accepts optionalWorkspaceOptions, backward compatible with existingclient.Workspace(ctx, id)calls.Testing
codersdkinternal test assertsWorkspaceOptions.asRequestOptionsetsinclude_relatedfrom the selection, following the existingWorkspaceFiltertest pattern rather than spinning up a server.wsrelatedtests coverQueryParamoutput and aParse/QueryParamround trip.make genregenerated theWorkspaceOptionsTypeScript type. Because the wire representation ofinclude_relatedis a comma-separated string,scripts/apitypingsmapswsrelated.Configtostringin TypeScript, soinclude_related?: stringrather than a nested object the frontend cannot serialize.api.getWorkspacealready forwardsWorkspaceOptionsas query params, and a frontend test inapi.test.tsconfirmsinclude_relatedis sent through.Generated by Coder Agents on behalf of @spikecurtis.