Repository navigation
Allow a space id to be used wherever a space name is accepted - #293
Open
NickJosevski wants to merge 1 commit into
Open
NickJosevski wants to merge 1 commit into
NickJosevski wants to merge 1 commit into
Conversation
resolveSpaceId queried /spaces?partialName= and then required an exact Name match, so a space id such as "Spaces-1795" always failed with "No spaces exist with name 'Spaces-1795'". This is surprising given push-package-action documents its space input as "The name or ID of a space", and a caller in this repo already passes spaceName: "Spaces-1". Name matching is tried first and the id lookup only runs when the value is shaped like a space id, so existing behaviour is unchanged and a space that happens to be named like an id still resolves by name. Mirrors the CLI, which prefers name then falls back to id (OctopusDeploy/cli#30). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 16, 2026
This branch has not been deployed
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.
Problem
resolveSpaceIdis the single choke point every space-scoped call goes through (client.tsdoCommand/request/del,packageRepository,observabilityRepository,kubernetesMonitorRepository). It queries/spaces?partialName=<value>and then requires an exactNamematch:So passing a space id fails.
Spaces-1795returns zero results from apartialNamefilter and throwsNo spaces exist with name 'Spaces-1795'.That is surprising for two reasons:
OctopusDeploy/push-package-actiondocuments itsspaceinput as "The name or ID of a space", which is currently untrue for the ID half.createReleaseCommandV1.test.tspassesspaceName: "Spaces-1".The practical cost: every consumer has to hardcode a space name, so renaming a space silently breaks every pipeline referencing it. We just had to raise PRs across 5 repos for exactly this.
Change
Try the name match first, then fall back to an id lookup, and only when the value is shaped like a space id (
/^Spaces-\d+$/).This mirrors the CLI, which deliberately prefers name and falls back to id β see OctopusDeploy/cli#30 and
client_factory.go'sSpaceNameOrID.Properties worth calling out:
Spaces-9999still resolves by name, so this cannot silently retarget an existing caller. Covered by a test.spaceNameβspaceNameOrIdfor clarity.Verification
src/spaceResolver.test.tsadded β 6 tests covering exact name, non-exact partial name, id fallback, name-preferred-over-id, no id lookup for non-id-shaped input, and unmatched id. All pass.tsc --noEmitclean.eslintclean onspaceResolver.ts. The test file reports the sameconsistent-type-assertionserror thatversionCheck.test.tsandcreateReleaseCommandV1.test.tsalready report for the identicalas unknown as Clientstub pattern β I followed the existing convention rather than diverge from it.Follow-up
Once this ships,
push-package-actionandcreate-release-actioncan take a space id, andcreate-release-action'saction.ymldescription can be corrected to matchpush-package-action's.π€ Generated with Claude Code