Skip to content

Show time spent in draft on PR dashboard - #272

Open
trask wants to merge 2 commits into
mainfrom
trask-draft-pr-age
Open

Show time spent in draft on PR dashboard#272
trask wants to merge 2 commits into
mainfrom
trask-draft-pr-age

Conversation

@trask

@trask trask commented Aug 19, 2026

Copy link
Copy Markdown
Member

The draft PR table now shows how long each pull request has been in draft instead of GitHub's general updated timestamp, which dashboard status-comment edits can reset.

For PRs returned to draft, the clock starts at the latest conversion. For PRs opened as drafts, it starts at PR creation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da8d0334-64a0-4ae5-a6b4-1540971e8450
@trask
trask requested a balanced review from Copilot August 19, 2026 22:31

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Updates the pull request dashboard to show how long PRs have been in draft (based on the latest “convert to draft” event, with a creation-time fallback) instead of GitHub’s general updated timestamp.

Changes:

  • Render draft PRs with a new “Draft age” column sorted by draftSince (or createdAt fallback).
  • Add GitHub GraphQL support to fetch latest “convert to draft” transitions in batches.
  • Extend unit tests to cover rendering/sorting of draft age and draftSince enrichment behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/scripts/pull-request-dashboard/render.py Renders “Draft age” using draftSince / createdAt and sorts drafts accordingly.
.github/scripts/pull-request-dashboard/publish_dashboard.py Enriches draft PRs with draftSince using a GraphQL lookup (conditionally).
.github/scripts/pull-request-dashboard/github_cli.py Adds fetch_latest_draft_transitions() and switches list_open_prs to return createdAt.
.github/scripts/pull-request-dashboard/test_render.py Adds a test validating draft age rendering and sorting.
.github/scripts/pull-request-dashboard/test_publish_dashboard.py Adds a test for draftSince enrichment with fallback to creation time.
.github/scripts/pull-request-dashboard/test_github_cli.py Adds a test for consolidated GraphQL querying of draft transitions.

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

Comment thread .github/scripts/pull-request-dashboard/publish_dashboard.py
Comment thread .github/scripts/pull-request-dashboard/github_cli.py Outdated
Copilot comment:

The GraphQL query is built with large triple-quoted blocks per PR, which adds substantial whitespace and can significantly bloat query size for larger batches. To reduce the likelihood of hitting GitHub's GraphQL query size/complexity limits (and to speed up requests), consider generating a more compact query string (e.g., stripping/dedenting the per-PR block, or using a single-line template) and/or lowering `_DRAFT_TRANSITION_BATCH_SIZE` if needed.

Analysis: The previous implementation built each per-PR selection using a triple-quoted f-string with four levels of indentation plus leading/trailing blank lines, contributing roughly 200 bytes of whitespace per PR. For a batch of 50 PRs that is about 10 KB of pure whitespace in a single query string. The fix replaces the multi-line template with a single-line format that preserves the same GraphQL structure and spacing conventions that the existing tests assert (e.g. `pr_7: pullRequest`), joining selections with a single space rather than newlines and indentation.

Upsides: Reduces query payload size proportionally to batch size, lowering the chance of hitting GitHub GraphQL complexity or size limits. No semantic change to the query itself.

Downsides: The query is now a single long line, which is less readable in isolation, but the logic stays in one place and the tests still assert the exact alias and field structure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@trask
trask requested a balanced review from Copilot August 20, 2026 15:50

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 6 out of 6 changed files in this pull request and generated no new comments.

@trask
trask marked this pull request as ready for review August 20, 2026 17:18
@trask
trask requested a review from a team as a code owner August 20, 2026 17:18
@trask
trask requested a review from maryliag August 20, 2026 17:18
@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-08-20 17:29 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

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