feat(cli): add harbor hub leaderboard create/show/list commands#2205
Merged
Conversation
Adds a `harbor hub leaderboard` command group over the Hub's curated leaderboard APIs: - `create` — POSTs the leaderboard-create edge function; definition comes from a YAML/JSON --config file (schemas, columns, rank_by) with flag overrides, unknown config keys rejected client-side by name. - `show <ref>` — accepts a leaderboard UUID or org/package/name slug via the leaderboard-read edge function (anonymous works for public boards); renders rows ranked by the board's own rank_by rules and displayed through its columns config. - `list [package]` — optional package UUID or org/name filter; reads the leaderboard table via PostgREST (RLS scopes to public + caller's orgs) with an !inner package/organization embed for slugs, paginated. The client layer (harbor/hub/leaderboards.py) follows the auth/keys.py edge-function pattern and hub/models.py tolerant parsing; rank_by ordering is applied client-side (direction, nulls first/last, multi-rule tie-breaks, string fallback for mixed types). 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: |
…flag The client-side visibility check only inspected the --visibility flag, so an invalid value in the --config YAML (e.g. visibility: everyone) skipped the friendly error and surfaced as an opaque server-side 400. Validate the merged body instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 leaderboardcommand group for the Hub's new curated-leaderboard system:harbor hub leaderboard create— creates a leaderboard for a dataset package you own. Definition comes from a YAML/JSON--configfile (metadata_schema,metrics_schema,columns,rank_by, …) with--package/--name/--title/--description/--visibilityflag overrides. Unknown config keys are rejected client-side by name before any network call.harbor hub leaderboard show <ref>—<ref>is a leaderboard UUID or anorg/package/nameslug. Renders board info plus rows ranked by the board's ownrank_byrules and displayed through its owncolumnsconfig (fallback columns derived from row data when unconfigured). Anonymous reads work for public boards.harbor hub leaderboard list [package]— lists visible leaderboards, optionally scoped by a package UUID ororg/nameslug. Supports--jsonand-q(slugs for piping).How
src/harbor/hub/leaderboards.py— client + tolerant models.create/getcall theleaderboard-create/leaderboard-readedge functions over httpx following theauth/keys.pypattern (bearer only when a credential exists, TLS-enforced).listhas no edge function, so it reads theleaderboardtable via PostgREST — RLS already scopes it to public + caller's orgs — with an!innerpackage/organization embed and.range()pagination.src/harbor/cli/hub_leaderboards.py— the Typer group, registered underhub_appasleaderboard(hiddenleaderboardsalias, mirroringjob/jobs).rank_byordering is applied client-side: rule order = precedence, asc/desc, nulls sink unlessnulls: first, string-comparison fallback for mixed types.Reviewer notes
listerrors (oldleaderboardtable shape) andshow/create404. Should merge after the platform migrations land.list(anon + authenticated, slug and UUID filters),showby slug with ranked rows,create→show→ row submit round-trip, and error paths (not-authenticated, malformed refs).leaderboard-read/leaderboard-submitedge functions have a brokenUUID_RE(missing a group), soshow <uuid>400s until the fixed functions are deployed (fix is in the platform repo, separate from this PR).tests/unit/test_cli_hub_leaderboard.py; full unit suite, ruff, and ty are green.🤖 Generated with Claude Code