feat: Add harbor hub job delete command#2204
Merged
Merged
Conversation
Adds a `harbor hub job delete <job_id>...` command for permanently deleting Hub jobs you own, including their trials and shares (which cascade in the database). There is no delete RPC on the Hub, so HubClient issues a direct table delete authorized by the existing owner DELETE RLS policy — the same approach update_job_visibility uses for its RLS-authorized update. The policies block deleting jobs linked to a leaderboard submission and hosted jobs that haven't finished; when a delete matches zero rows the CLI reports that and exits 1. The command verifies every job exists before deleting anything, prompts for confirmation (skippable with --yes/-y, required when stdin is not a TTY), de-dupes repeated ids, and reports per-job results. Note: uploaded archives stay in the storage bucket — storage.objects has no user DELETE policy, so reclamation needs a server-side cleanup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Enjoy a better diff viewing experience by clicking one of these URLs: |
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.
What
Adds a
harbor hub job delete <job_id> [<job_id>...]command for permanently deleting Hub jobs you own, including their trials and shares.Why
The Hub CLI could list, show, compare, and download jobs, but there was no way to remove a job from the Hub without going through the website or raw SQL.
How
HubClient.delete_job— there is no delete RPC on the Hub, so this issues a direct table delete authorized by the existing"Users can delete their own jobs"DELETE RLS policy (the same approachupdate_job_visibilityuses for its RLS-authorized update). Trials, shares, trial_model rows, and job caches all cascade viaON DELETE CASCADEFKs, so one row delete cleans up the database fully. Returns whether a row was actually deleted so the CLI can distinguish success from an RLS refusal.HubClient.get_job_header— minimal id + name fetch used for the confirmation prompt and to distinguish "not found / not visible" from "visible but not deletable".delete_cmdinharbor/cli/hub.py, registered asharbor hub job delete:--yes/-yskips it, and non-TTY stdin without--yeserrors instead of hanging (matches the existingjob_sharingprompt pattern).Reviewer notes
is_hosted = false OR finished_at IS NOT NULL) is restrictive, so they AND together — jobs linked to a leaderboard submission and still-running hosted jobs cannot be deleted, and the CLI's error message says exactly that.storage.objectshas no user DELETE policy — clients cannot remove them. Reclaiming that storage needs a server-side cleanup (trigger/queue or scheduled sweep) and is left as a follow-up.tests/unit/test_cli_hub_job_delete.pycovering success, missing job, RLS refusal, the non-TTY--yesrequirement, invalid UUIDs, de-duplication, and multi-job deletes. Full unit suite passes (4,628 passed); ruff + ty clean.🤖 Generated with Claude Code