Skip to content

Move team activity metrics to /team - #514

Merged
redreceipt merged 4 commits into
mainfrom
agent/team-metrics-page
Aug 27, 2026
Merged

Move team activity metrics to /team#514
redreceipt merged 4 commits into
mainfrom
agent/team-metrics-page

Conversation

@redreceipt

@redreceipt redreceipt commented Aug 26, 2026

Copy link
Copy Markdown
Member

Issue

Replace the ranked homepage score with a neutral team activity view that can optionally include the full configured roster.

Solution

  • adds /team with one sortable column per raw metric, defaulting to engineering and PRs merged descending
  • adds a Show everyone toggle while preserving the time window and canonical sort choice
  • moves CSV export beside the table and makes it match the visible cohort and ordering
  • removes the homepage leaderboard UI and its old public partial/export routes; Projects remains at /projects
  • adds Team to the navigation menu

To Test

  • confirm / has no leaderboard and /team defaults to PRs merged descending
  • change columns, time windows, and Show everyone; confirm the choices persist
  • load /team?sort=bogus&everyone=1, then choose 7d; confirm it uses and persists sort=-prs_merged
  • export CSV and confirm its cohort and ordering match the table

Validation

  • ruff format --check .
  • ruff check .
  • mypy .
  • vulture . --config pyproject.toml
  • python -m unittest discover -s tests -p 'test_*.py' (195 tests)

Proof

Playwright against exact head 9377fa2 verified Person ascending and descending order, matching arrows, and matching CSV links. It also verified that an invalid sort fetches /partials/team/metrics?days=30&sort=-prs_merged&everyone=1 and that 7d navigation persists the canonical sort. The partial request carried HX-Request: true and the full Team URL in HX-Current-URL; OAuth coverage verifies an expired session returns the full-page login target in HX-Redirect. The live CSV attachment name, raw metric schema, full-roster cohort, and selected ordering were also verified.

Default engineering view:

Team activity defaults to engineering and PRs merged descending

Show everyone with PR reviews sorting:

Team activity showing everyone and sorted by PRs reviewed

Copilot AI lite review requested due to automatic review settings August 26, 2026 22:17
@redreceipt
redreceipt enabled auto-merge (squash) August 26, 2026 22:18

Copilot AI 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.

Pull request overview

This PR replaces the homepage “Leaderboard” UI with a dedicated /team activity page that presents raw team metrics (sortable columns, optional full roster) and a CSV export that matches the visible cohort and ordering.

Changes:

  • Adds /team page + /partials/team/metrics partial to render a sortable team metrics table with an “everyone” toggle and time-window persistence.
  • Reworks export logic to emit raw metric columns (no score/stdev) via /team.csv, aligned to the current table filters and sort.
  • Removes homepage leaderboard section and updates navigation, styling, docs, and tests accordingly.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_navigation.py Updates header navigation expectations and validates /team page wiring.
tests/test_leaderboard_export.py Updates export/table tests to assert raw-metric schema and /team.csv + /partials/team/metrics behavior.
tests/test_leaderboard_cache.py Repoints Redis-cache behavior tests from homepage leaderboard partial to team metrics partial.
tests/test_github_oauth.py Updates OAuth redirect expectations for the new partial route and /team URL.
templates/team_metrics.html Adds the /team page template and client-side fetch of the team metrics partial.
templates/partials/time_window_controls.html Preserves additional query params (e.g., sort/everyone) across time-window form submissions.
templates/partials/index_leaderboard.html Repurposes the old leaderboard partial into the sortable team metrics table + export link.
templates/index.html Removes the leaderboard section and client-side loading for it on the homepage.
templates/base.html Adds “Team” to the local pages navigation menu.
static/styles.css Introduces styling for the team metrics header/table and removes leaderboard-specific selectors.
README.md Updates Redis caching docs to refer to team metrics instead of homepage leaderboard.
leaderboard_export.py Replaces score-based export rows with raw team metric rows and CSV rendering.
app.py Adds /team, /partials/team/metrics, and /team.csv; introduces shared context building and sorting/filtering logic.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread app.py
@redreceipt
redreceipt temporarily deployed to bug-board-agent-team-me-xhrnc4 August 26, 2026 22:21 Inactive
Copilot AI review requested due to automatic review settings August 27, 2026 00:34
@redreceipt
redreceipt temporarily deployed to bug-board-agent-team-me-xhrnc4 August 27, 2026 00:34 Inactive

Copilot AI 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.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

templates/team_metrics.html:19

  • The metrics section is loaded via fetch() without HTMX headers. If the GitHub OAuth session is missing/expired, the auth middleware will treat this as a normal HTML request and return a full sign-in page (200) or a redirect, which will be injected into #team-metrics instead of navigating the browser to /login (and the next URL may become the partial route). Sending HX-Request/HX-Current-URL and honoring HX-Redirect avoids broken embedded-auth HTML and preserves the correct return URL.
  const teamMetrics = document.getElementById('team-metrics');
  fetch({{ url_for("team_metrics_partial", **table_query) | tojson }})
    .then((response) => response.ok ? response.text() : Promise.reject())
    .then((html) => { teamMetrics.innerHTML = html; teamMetrics.removeAttribute('aria-busy'); })
    .catch(() => { teamMetrics.innerHTML = '<article>Unable to load team metrics.</article>'; teamMetrics.removeAttribute('aria-busy'); });

Copilot AI review requested due to automatic review settings August 27, 2026 00:41
@redreceipt
redreceipt temporarily deployed to bug-board-agent-team-me-xhrnc4 August 27, 2026 00:42 Inactive

Copilot AI 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.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

app.py:1139

  • When sorting by person, the secondary stable sort currently uses the raw string (row[sort_key]) rather than the casefolded key used on the prior line. This makes sort=person / sort=-person case-sensitive and effectively overrides the intended case-insensitive ordering. Consider special-casing the person sort to use the same casefolded key (and reverse when needed), while keeping the initial casefolded sort as a tie-breaker for metric columns.
    rows.sort(key=lambda row: str(row["person"]).casefold())
    rows.sort(key=lambda row: row[sort_key], reverse=sort.startswith("-"))

Copilot AI review requested due to automatic review settings August 27, 2026 00:48
@redreceipt
redreceipt temporarily deployed to bug-board-agent-team-me-xhrnc4 August 27, 2026 00:48 Inactive

Copilot AI 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.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.

@redreceipt
redreceipt disabled auto-merge August 27, 2026 00:54
@redreceipt
redreceipt merged commit 5728a25 into main Aug 27, 2026
6 checks passed
@redreceipt
redreceipt deleted the agent/team-metrics-page branch August 27, 2026 00:54
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.

2 participants