Skip to content

Add show_deleted support to SP resource list and get commands#20

Merged
ygalblum merged 3 commits into
dcm-project:mainfrom
ygalblum:add-show-deleted-sp-resource
Apr 10, 2026
Merged

Add show_deleted support to SP resource list and get commands#20
ygalblum merged 3 commits into
dcm-project:mainfrom
ygalblum:add-show-deleted-sp-resource

Conversation

@ygalblum

@ygalblum ygalblum commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

What

Add --show-deleted flag to SP resource list and get commands to include soft-deleted resources in results.

Why

The service-provider-manager resource API now supports a show_deleted query parameter that allows retrieving soft-deleted instances alongside active ones. The CLI needs to expose this capability to users.

Changes

  • Updated service-provider-manager dependency to pick up the new ShowDeleted param on list/get and the GetInstanceParams type
  • Added --show-deleted boolean flag to both sp resource list and sp resource get
  • When --show-deleted is set, passes show_deleted=true query parameter to the API
  • When --show-deleted is set, displays an additional DELETION STATUS column in table output
  • Updated import paths for provider packages to match upstream restructuring

Testing

Added unit tests verifying the show_deleted query parameter is sent for both list and get, and that the DELETION STATUS column appears only when the flag is used.

## What
Add `--show-deleted` flag to SP resource list and get commands to include soft-deleted resources in results.

## Why
The service-provider-manager resource API now supports a `show_deleted` query parameter that allows retrieving soft-deleted instances alongside active ones. The CLI needs to expose this capability to users.

## Changes
- Updated service-provider-manager dependency to pick up the new `ShowDeleted` param on list/get and the `GetInstanceParams` type
- Added `--show-deleted` boolean flag to both `sp resource list` and `sp resource get`
- When `--show-deleted` is set, passes `show_deleted=true` query parameter to the API
- When `--show-deleted` is set, displays an additional `DELETION STATUS` column in table output
- Updated import paths for provider packages to match upstream restructuring

## Testing
Added unit tests verifying the `show_deleted` query parameter is sent for both list and get, and that the `DELETION STATUS` column appears only when the flag is used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
## What
Updates project documentation to cover the new --show-deleted flag on SP resource commands.

## Why
The implementation added in the previous commit needs corresponding spec requirements, test plan entries, and a checkpoint for traceability.

## Changes
- Added REQ-SPR-035/060/070 and AC-SPR-035/036/045/046 to the spec for show-deleted behavior
- Updated table output section in the spec to show both default and --show-deleted column layouts
- Added TC-U154–TC-U157 to the unit test plan covering list and get with/without --show-deleted
- Updated coverage matrix and test case totals
- Created checkpoint documenting the feature scope, design decisions, and files changed

## Testing
No new code tests — documentation only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
Comment thread .ai/specs/dcm-cli.spec.md
| REQ-SPR-040 | Missing `INSTANCE_ID` argument for `get` MUST result in a usage error (exit code 2) | MUST | |
| REQ-SPR-050 | All SP resource commands MUST use the generated SP Resource Manager client | MUST | |
| REQ-SPR-060 | When `--show-deleted` is set, `list` and `get` MUST pass `show_deleted=true` as a query parameter to the API | MUST | |
| REQ-SPR-070 | When `--show-deleted` is set, table output MUST include an additional `DELETION STATUS` column displaying the `deletion_status` field | MUST | |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't really like to add a new column DELETION STATUS, IMO the already present STATUS should be self explanatory

Now, based on my comment on another PR for the SPRM, I know that PENDING is re-used as a status for deletion which may cause collision and lost of meaning for this status (has the resource just been created or is it pending its deletion). This should be fixed in the SPRM and we should use a dedicated status when deletion is pending and thus, here we should not introduce this new column that will show empty entry for a lot of rows and that will change the layout of the response

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure I agree. I understand the desire to have a single unified status field. But, a resource can have a status (running, failed, unknown) regardless to it being pending deletion. BTW this is why K8S added the Conditions array to the status.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see your point, then "pending deletion" would make more sense as a boolean rather than a status dedicated to delete status: when the resource is deleted it will not be returned anymore (hard delete)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, but in the current implementation a deletion status may also be Failed since the SPRM has a retry limit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, but in the current implementation a deletion status may also be Failed since the SPRM has a retry limit

right

As you mentioned K8s, why not have it displayed like an array in the status then? Also, maybe we can introduced a more generic tag to show the extended details of the resource instead of --show-deleted (which should be --show-deferred-delete)
If you feel that's not needed at this stage, it's fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think a lot will change in the next version. Especially if we move to async internal communication (that is event based).
Furthermore, the CLI is only meant to reflect the API (instead of writing cURL). So, any such discussion will need to take place at the service level not the CLI's

@gciavarrini gciavarrini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

small nits, but overall LGTM

Comment thread internal/commands/sp_resource.go
Comment thread internal/commands/sp_resource_test.go
Comment thread internal/commands/sp_resource.go
Add ID verification to Get and List calls

Signed-off-by: Ygal Blum <ygal.blum@gmail.com>
@ygalblum ygalblum merged commit a27366c into dcm-project:main Apr 10, 2026
4 checks passed
@ygalblum ygalblum deleted the add-show-deleted-sp-resource branch April 10, 2026 15:09
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.

5 participants