Skip to content

feat: Add harbor hub job delete command#2204

Merged
alexgshaw merged 1 commit into
mainfrom
claude/cool-galileo-4eb598
Jul 5, 2026
Merged

feat: Add harbor hub job delete command#2204
alexgshaw merged 1 commit into
mainfrom
claude/cool-galileo-4eb598

Conversation

@alexgshaw

@alexgshaw alexgshaw commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

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 approach update_job_visibility uses for its RLS-authorized update). Trials, shares, trial_model rows, and job caches all cascade via ON DELETE CASCADE FKs, 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_cmd in harbor/cli/hub.py, registered as harbor hub job delete:
    • Accepts multiple ids, de-dupes repeats, and verifies every job exists before deleting anything (fail-fast, no partial surprises).
    • Prompts for confirmation listing each job's id + name; --yes/-y skips it, and non-TTY stdin without --yes errors instead of hanging (matches the existing job_sharing prompt pattern).
    • Reports per-job results and exits 1 if any delete was refused.
  • Docs: new "Deleting Jobs" section in the Hub docs page.

Reviewer notes

  • The DELETE RLS policies were verified against the live database: the owner policy is permissive, and the hosted-job guard (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.
  • Known limitation (pre-existing, not introduced here): uploaded archives stay in the storage bucket, because storage.objects has 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: 7 new unit tests in tests/unit/test_cli_hub_job_delete.py covering success, missing job, RLS refusal, the non-TTY --yes requirement, invalid UUIDs, de-duplication, and multi-job deletes. Full unit suite passes (4,628 passed); ruff + ty clean.

🤖 Generated with Claude Code


Open in Devin Review

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>
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
harbor-docs Ready Ready Preview, Comment Jul 5, 2026 11:16pm

Request Review

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Enjoy a better diff viewing experience by clicking one of these URLs:

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@alexgshaw alexgshaw merged commit 34e49f9 into main Jul 5, 2026
9 checks passed
@alexgshaw alexgshaw deleted the claude/cool-galileo-4eb598 branch July 5, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant