Skip to content

fix(leaderboard): restore per-language drilldown on row click#6

Merged
malteos merged 2 commits into
mainfrom
fix/leaderboard-drilldown
Jun 10, 2026
Merged

fix(leaderboard): restore per-language drilldown on row click#6
malteos merged 2 commits into
mainfrom
fix/leaderboard-drilldown

Conversation

@malteos

@malteos malteos commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two changes that together get the deployed Space back into working order and keep it in sync with main going forward.

1. Restore the per-language drilldown on row click (src/commonlid/leaderboard/app.py)

Row clicks on the leaderboard table stopped opening the per-language drilldown after #5 merged and commonlid-results was bumped to schema v3.

Cause: #5 wired inputs=[leaderboard] into the row-select handler and read model_id out of the assumed {"data", "headers"} dict. Gradio 6's Dataframe.preprocess converts component values to pandas.DataFrame before handing them to callbacks (default type="pandas"), so isinstance(table_value, dict) was always False and the handler silently returned the "Click a row to load per-language metrics." placeholder.

Fix: read the clicked row from gr.SelectData.row_value (Gradio docs: "the value of the entire row that the selected item belongs to, as a 1-D list"). model_id = evt.row_value[0] works for both the "all" and "(cov.)" scopes because row_value always reflects the row at its post-toggle position. inputs=[leaderboard] is dropped.

2. Install commonlid from GitHub main in the HF Space (hf-space/requirements.txt)

The Space was pulling commonlid[leaderboard] from PyPI, which forced a release for every Space-affecting change. Switch to commonlid[leaderboard] @ git+https://github.com/commoncrawl/commonlid-eval.git@main so the next Space rebuild picks up main directly. Pinning to a tag or SHA stays a single edit away.

Test plan

  • make lint && make typecheck — clean.
  • make test — 249 passed, 95.83% coverage. New tests: test_row_select_handler_loads_drilldown_from_row_value (regression on the click → drilldown payload pipe) and test_row_select_handler_returns_placeholder_when_index_missing.
  • commonlid leaderboard serve --repo-id commoncrawl/commonlid-results loads the live HF dataset and the app comes up clean.
  • Post-merge: trigger a Space rebuild and confirm it picks up main (drilldown clicks now work end-to-end against the live dataset).

malteos added 2 commits June 10, 2026 08:45
Read the clicked row's model_id from `gr.SelectData.row_value` directly
instead of resolving it via the Dataframe component as an event input.
Gradio 6's `Dataframe.preprocess` converts the value to a `pandas.DataFrame`
before handing it to the callback, so the `isinstance(table_value, dict)`
branch I added in #5 never fired and every row click silently returned the
"click a row" placeholder.

`row_value` carries the full clicked row (Gradio docs: "the value of the
entire row that the selected item belongs to, as a 1-D list"), so the
post-toggle ordering is still respected without us having to thread the
Dataframe through the input list.

Add a regression test that hands `_on_select` a mock SelectData with an
`index` + `row_value` and asserts the drilldown payload comes back
populated.
Point the HF Space at git+https://github.com/commoncrawl/commonlid-eval@main
so deployment picks up runtime fixes without waiting on a PyPI release.
Pinning to a tag or commit SHA stays a single requirements-file edit away.
@malteos malteos merged commit c00b427 into main Jun 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant