Skip to content

Add -Environment and make -ProjectName optional for catlet name lookups - #125

Merged
fw2568 merged 1 commit into
mainfrom
feature/catlet-environment-lookup
Jul 17, 2026
Merged

Add -Environment and make -ProjectName optional for catlet name lookups#125
fw2568 merged 1 commit into
mainfrom
feature/catlet-environment-lookup

Conversation

@fw2568

@fw2568 fw2568 commented Jul 17, 2026

Copy link
Copy Markdown
Member

Catlets are unique per project + environment, so name-based lookups can no longer assume a name is unique within a project.

  • -Environment filter added to the 11 catlet name-lookup cmdlets — query (Get-Catlet, Get-CatletIp, Get-CatletGuestServiceStatus/Config, Get-CatletProvisioningStatus/Log) and action (Start/Stop/Remove/Update-Catlet, Set-CatletGuestServiceConfig, Remove-CatletGuestServiceAccessKey). Empty = all environments; specified = client-side filter. Mirrors Get-VNetwork/Get-CatletDisk.
  • -ProjectName no longer required for name lookups: ResolveActionTargets now resolves an exact name across all accessible projects, with -ProjectName/-Environment as narrowing filters. A name matching several projects/environments errors as ambiguous with a hint naming the filters not yet applied. A wildcard still requires -ProjectName so a mutation can't fan out across projects. A GUID id bypasses everything.
  • Safety guard: an empty/whitespace name/id target is rejected instead of degrading to a match-everything filter.
  • Shared ListCatlets(projectId, environment) helper + CatletResourceKind/EnvironmentHintIfUnset on CatletCmdLet.
  • Name-lookup Pester tests updated and extended (env surface across all catlet cmdlets, relaxed project resolution, empty-target guard, cross-name ambiguity). 120/120 pass.

Catlets are unique per project + environment, so name lookups can no longer
assume project uniqueness. Add an optional -Environment filter to the catlet
query and action commands (empty = all environments), mirroring Get-VNetwork
and Get-CatletDisk, and route every catlet listing through a shared
ListCatlets helper.

Rework ResolveActionTargets so an exact name is resolved across all accessible
projects and -ProjectName only narrows the search; a name matching several
projects/environments is reported as ambiguous with a hint to narrow with
-ProjectName / -Environment. A wildcard still requires -ProjectName so a
mutation cannot fan out across projects.

Update and extend the name-lookup Pester tests for the new -Environment
surface and the relaxed project resolution.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates catlet name-based resolution to account for catlets being unique per project + environment, by adding an -Environment narrowing filter across catlet cmdlets and relaxing -ProjectName requirements for exact-name mutations (while retaining safety guards against accidental fan-out).

Changes:

  • Adds -Environment filtering to catlet list/name lookup paths (client-side filtering via a shared helper).
  • Updates mutating cmdlet resolution to allow exact-name lookups across accessible projects, with ambiguity/empty-target safeguards and better disambiguation hints.
  • Extends/updates Pester coverage for parameter surfaces and the updated name-resolution semantics.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/pester/ResourceNameLookup.Tests.ps1 Extends Pester coverage for new -Environment surface and updated name-resolution behavior.
src/Eryph.ComputeClient.Commands/ComputeCmdLet.cs Updates ResolveActionTargets semantics (cross-project exact-name resolution, wildcard scoping, empty-target guard, ambiguity hinting).
src/Eryph.ComputeClient.Commands/Catlets/UpdateCatletCommand.cs Adds -Environment narrowing filter and uses shared catlet listing helper for resolution.
src/Eryph.ComputeClient.Commands/Catlets/StopCatletCommand.cs Adds -Environment narrowing filter and routes listing through shared helper.
src/Eryph.ComputeClient.Commands/Catlets/StartCatletCommand.cs Adds -Environment narrowing filter and routes listing through shared helper.
src/Eryph.ComputeClient.Commands/Catlets/SetCatletGuestServiceConfigCommand.cs Adds -Environment narrowing filter and routes listing through shared helper.
src/Eryph.ComputeClient.Commands/Catlets/RemoveCatletGuestServiceAccessKeyCommand.cs Adds -Environment narrowing filter and routes listing through shared helper.
src/Eryph.ComputeClient.Commands/Catlets/RemoveCatletCommand.cs Adds -Environment narrowing filter and routes listing through shared helper.
src/Eryph.ComputeClient.Commands/Catlets/GetCatletProvisioningStatusCommand.cs Adds -Environment list filter and uses shared helper + consistent resource-kind messaging.
src/Eryph.ComputeClient.Commands/Catlets/GetCatletProvisioningLogCommand.cs Adds -Environment list filter, uses shared helper, and avoids Environment name collision with System.Environment.
src/Eryph.ComputeClient.Commands/Catlets/GetCatletIpCommand.cs Adds -Environment list filter and uses shared helper + consistent resource-kind messaging.
src/Eryph.ComputeClient.Commands/Catlets/GetCatletCommand.cs Adds -Environment list filter and uses shared helper + consistent resource-kind messaging.
src/Eryph.ComputeClient.Commands/Catlets/CatletGuestServiceGetCmdlet.cs Adds -Environment list filter and uses shared helper + consistent resource-kind messaging.
src/Eryph.ComputeClient.Commands/Catlets/CatletCmdLet.cs Introduces shared ListCatlets(projectId, environment) helper and ambiguity-hint constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (hasProject && !TryGetProjectId(projectName, out projectId))
yield break;

var matches = FilterByName(listInProject(projectId), nameOrId, nameSelector, resourceKind).ToList();
Comment on lines 44 to +45
foreach (var catlet in ResolveActionTargets(nameOrId, ProjectName, GetSingleCatlet,
projectId => client.List(projectId: projectId), c => c.Name, "catlet"))
projectId => ListCatlets(projectId, Environment), c => c.Name, CatletResourceKind, EnvironmentHintIfUnset(Environment)))
@fw2568
fw2568 merged commit 2d0a871 into main Jul 17, 2026
6 checks passed
@fw2568
fw2568 deleted the feature/catlet-environment-lookup branch July 17, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants