feat(quarantine): add ak quarantine hold, and document the command group - #157
Open
brandonrc wants to merge 2 commits into
Open
feat(quarantine): add ak quarantine hold, and document the command group#157brandonrc wants to merge 2 commits into
brandonrc wants to merge 2 commits into
Conversation
`ak quarantine` was added in #102 and released in v1.2.0, but it never made it into the README command list or the CHANGELOG, so the only way to discover it was `ak --help`. Add it to both. The CHANGELOG entry goes under 1.2.0 rather than Unreleased because that is the release it actually shipped in. Refs #156
`ak quarantine` covered status/release/reject but had no way to place a
hold, so an admin responding to a bad artifact had to hand-roll an HTTP
call. Add `ak quarantine hold <artifact-id> [--reason]` against
POST /api/v1/quarantine/{artifact_id}/quarantine.
`--reason` is optional, matching `QuarantineNowRequest.reason` on the
backend (the server records a default reason when the field is absent)
and matching the existing `reject` subcommand.
The vendored SDK's ClientQuarantineExt predates this route and exposes
no quarantine-now operation, so the call goes over the raw HTTP path
already used for post-SDK endpoints rather than blocking on an SDK
regen. That path exposes the status code, so 403, 404, and 409 get
actionable messages instead of a bare transport error.
Refs #156
|
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.



Summary
Two gaps in the quarantine command group, which shipped in v1.2.0 (#102) with
status,release, andreject.No
holdsubcommand. The backend registers four quarantine routes and the CLI covered three, so placing a manual admin hold was the one quarantine operation with no command and an admin responding to a bad artifact had to hand-roll an HTTP call. Addsak quarantine hold <artifact-id> [--reason]againstPOST /api/v1/quarantine/{artifact_id}/quarantine.--reasonis optional, matchingQuarantineNowRequest.reasonon the backend (the server records a default when the field is absent) and matching the existingrejectsubcommand. It is deliberately not required.The vendored SDK's
ClientQuarantineExtpredates this route and exposes no quarantine-now operation, so the call goes over the raw HTTP path already used for post-SDK endpoints rather than blocking on an SDK regen. That path exposes the status code, so 403, 404, and 409 get actionable messages instead of a bare transport error.Undocumented.
ak quarantinenever made it into the README command list or the CHANGELOG, so the only way to discover it wasak --help. Added to both. The CHANGELOG entry for the existing subcommands goes under 1.2.0 rather than Unreleased, because that is the release it actually shipped in.completion.rsneeds no change; it derives from the clap tree viaCli::command().Testing
cargo test quarantine: 26 passed, 0 failed.cargo fmt --checkclean,cargo clippyno errors.New tests follow the module's existing style (clap parse tests plus wiremock-backed handler tests):
Not manually tested against a running instance.
Notes for review
ak quarantine listis deliberately not implemented. The backend has no endpoint listing quarantined artifacts; all four routes are keyed by a singleartifact_id. It needs a backend counterpart first.The
rejectsignature is unchanged.RejectRequest.reasonisOption<String>on the backend, and making--reasonrequired there would be a breaking change to a released command.No dependency on the other quarantine work in flight:
POST /quarantine/{id}/quarantinealready exists on the backend'smain. This PR can merge independently.Closes #156