fix(api): populate volume mounts and normalize alias for paused sandboxes in GetSandboxesSandboxID - #3576
Open
chill-czar wants to merge 1 commit into
Open
Conversation
…oxes in GetSandboxesSandboxID
chill-czar
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
August 17, 2026 19:50
Contributor
Author
|
@claude review |
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.
Closes #3575
Summary
VolumeMountsfromlastSnapshot.Snapshot.Config.VolumeMountsinGetSandboxesSandboxIDfor paused sandboxes usingconvertFromDBMountsToAPIMounts, matchingGET /v2/sandboxes.sandbox.Aliasso it remainsnil(omitted from JSON) whenlen(lastSnapshot.Aliases) == 0instead of pointing to an empty string&"".a.orchestrator != nilbefore querying active sandboxes.packages/api/internal/handlers/sandbox_get_test.go(TestGetSandboxesSandboxID_PausedWithVolumeMountsAndNilAlias).Why
In
packages/api/internal/handlers/sandbox_get.go,GET /sandboxes/{id}did not populateVolumeMountsfor paused sandboxes, causing a discrepancy withGET /v2/sandboxeswhere snapshot volume mounts are properly returned. Furthermore,firstAliasreturns""when there are no aliases; assigning a pointer to this string caused JSON output to serialize"alias": ""instead of omitting the field or returningnull.Diff Overview
var alias *string if len(lastSnapshot.Aliases) > 0 { first := lastSnapshot.Aliases[0] alias = &first } + var volumeMounts []queries.VolumeMount + if lastSnapshot.Snapshot.Config.VolumeMounts != nil { + volumeMounts = *lastSnapshot.Snapshot.Config.VolumeMounts + } + sandbox = api.SandboxDetail{ ClientID: lastSnapshot.Snapshot.BaseTemplateID, TemplateID: lastSnapshot.Snapshot.BaseTemplateID, Alias: alias, + VolumeMounts: convertFromDBMountsToAPIMounts(volumeMounts), SandboxID: sandboxID,Test Plan
go test -v ./packages/api/internal/handlers -run TestGetSandboxesSandboxID_PausedWithVolumeMountsAndNilAliasgo test -v ./packages/api/internal/handlers/...make fmtandmake lintVolumeMountsis preserved on paused sandboxes andAliasis omitted when empty/cc @jakubno @dobrac @ValentaTomas @arkamar @tvi