Skip to content

Add stale PR indicators with configurable thresholds#396

Open
Mash4-4-4-4 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Mash4-4-4-4:add-stale-pr-indicators-clean
Open

Add stale PR indicators with configurable thresholds#396
Mash4-4-4-4 wants to merge 3 commits into
Priyanshu-byte-coder:mainfrom
Mash4-4-4-4:add-stale-pr-indicators-clean

Conversation

@Mash4-4-4-4
Copy link
Copy Markdown

Summary

Added stale PR indicators in the PR Analytics section to help users quickly identify pull requests that have been open for too long.

Closes #257

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added stale PR detection logic based on configurable thresholds
  • Added threshold selector for 7 / 14 / 30 days
  • Added stale PR count chip in the PR Analytics section
  • Added stale PR list with orange "Stale" badges
  • Added clickable links to open stale PRs directly
  • Extended PR metrics API response to include PR metadata required for stale calculations

How to Test

Steps for the reviewer to verify this works:

  1. Open the dashboard page
  2. Navigate to the PR Analytics section
  3. Verify stale PR count appears above the metrics cards
  4. Change the threshold dropdown between 7 / 14 / 30 days
  5. Confirm stale PR count updates correctly
  6. Verify stale PRs display orange "Stale" badges
  7. Click a stale PR entry and verify it opens the corresponding GitHub PR link

Screenshots (if UI change)

Screenshot 2026-05-18 183221 Add screenshots showing:
  • stale PR count chip
  • threshold selector
  • stale PR list with badges

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@Mash4-4-4-4 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes Required

1. Interface concatenation — missing newline

+interface PullRequest {
+  ...
+}interface PRMetricsBase {   // ← no newline between closing } and next interface

Add a blank line between the two interface declarations.

2. Indentation inconsistency throughout
Multiple code blocks are misaligned relative to the surrounding code:

  • items: Array<{ block in the inline type (4-space instead of matching outer indent)
  • const prs = data.items.map(...) block is indented as if inside the previous if but sits at function scope
  • return { open, merged, ... } block is unindented vs the function body
  • const [staleDays, setStaleDays] in PRMetrics.tsx placed at wrong indent level
  • const isStale and const stalePRs appear at file scope instead of component scope

Run a formatter (Prettier) before submitting — the inconsistent indentation will cause lint failures.

3. Performance: 30 parallel GitHub API calls per dashboard load
getAverageFirstReviewHours does Promise.all(prs.slice(0, 30).map(fetchFirstReviewTimestamp)) — 30 concurrent API calls every time the PR Analytics card loads. For users with many PRs this is slow and risks hitting GitHub rate limits. The result should be wrapped in withMetricsCache (from PR #311) with a reasonable TTL.

4. Missing EOF newline in PRMetrics.tsx
File ends with } and no trailing newline.

5. Extra blank lines in fetchPRMetrics

async function fetchPRMetrics(token: string): Promise<PRMetricsBase> {
+
+  
  const searchRes = ...

Remove the two extra blank lines at the start of the function.

The stale PR feature (threshold selector + stale list) is a solid addition — address the above and this can merge.

@Priyanshu-byte-coder Priyanshu-byte-coder mentioned this pull request May 19, 2026
9 tasks
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.

[FEAT] Add stale PR detector — highlight PRs open for more than N days

2 participants