Skip to content

feat(cli): add harbor hub leaderboard create/show/list commands#2205

Merged
alexgshaw merged 2 commits into
mainfrom
claude/suspicious-mclaren-a59ca5
Jul 7, 2026
Merged

feat(cli): add harbor hub leaderboard create/show/list commands#2205
alexgshaw merged 2 commits into
mainfrom
claude/suspicious-mclaren-a59ca5

Conversation

@alexgshaw

Copy link
Copy Markdown
Collaborator

What

Adds a harbor hub leaderboard command 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 --config file (metadata_schema, metrics_schema, columns, rank_by, …) with --package/--name/--title/--description/--visibility flag 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 an org/package/name slug. Renders board info plus rows ranked by the board's own rank_by rules and displayed through its own columns config (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 or org/name slug. Supports --json and -q (slugs for piping).

How

  • src/harbor/hub/leaderboards.py — client + tolerant models. create/get call the leaderboard-create / leaderboard-read edge functions over httpx following the auth/keys.py pattern (bearer only when a credential exists, TLS-enforced). list has no edge function, so it reads the leaderboard table via PostgREST — RLS already scopes it to public + caller's orgs — with an !inner package/organization embed and .range() pagination.
  • src/harbor/cli/hub_leaderboards.py — the Typer group, registered under hub_app as leaderboard (hidden leaderboards alias, mirroring job/jobs).
  • rank_by ordering is applied client-side: rule order = precedence, asc/desc, nulls sink unless nulls: first, string-comparison fallback for mixed types.

Reviewer notes

  • Draft because the backend isn't in prod yet: the curated-leaderboard schema + edge functions currently exist only on the lb-dev Supabase branch. Against prod today, list errors (old leaderboard table shape) and show/create 404. Should merge after the platform migrations land.
  • Verified live against the lb-dev branch: list (anon + authenticated, slug and UUID filters), show by slug with ranked rows, createshow → row submit round-trip, and error paths (not-authenticated, malformed refs).
  • Found while testing: the platform's leaderboard-read/leaderboard-submit edge functions have a broken UUID_RE (missing a group), so show <uuid> 400s until the fixed functions are deployed (fix is in the platform repo, separate from this PR).
  • 22 unit tests in tests/unit/test_cli_hub_leaderboard.py; full unit suite, ruff, and ty are green.

🤖 Generated with Claude Code

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>
@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 7, 2026 3:08am

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:

@alexgshaw alexgshaw marked this pull request as ready for review July 7, 2026 03:01
devin-ai-integration[bot]

This comment was marked as resolved.

…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>

@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 found 1 new potential issue.

Open in Devin Review

Comment thread tests/unit/test_cli_hub_leaderboard.py
@alexgshaw alexgshaw merged commit d024469 into main Jul 7, 2026
15 checks passed
@alexgshaw alexgshaw deleted the claude/suspicious-mclaren-a59ca5 branch July 7, 2026 03:56
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