Skip to content

perf(dashboard): replace timelineItems with top-level updatedAt to reduce API calls#5537

Open
q404365631 wants to merge 3 commits into
asyncapi:masterfrom
q404365631:improve/updatedAt-5168
Open

perf(dashboard): replace timelineItems with top-level updatedAt to reduce API calls#5537
q404365631 wants to merge 3 commits into
asyncapi:masterfrom
q404365631:improve/updatedAt-5168

Conversation

@q404365631

@q404365631 q404365631 commented Jun 4, 2026

Copy link
Copy Markdown

What

Replaces the deeply-nested timelineItems(first: 1) { updatedAt } GraphQL lookup with the top-level updatedAt field that's already available on every Issue / PullRequest node. This eliminates a separate resource fetch per item.

Why

Per #5168, Issue and PullRequest already expose updatedAt at the top level, so the nested timelineItems traversal was redundant. As the dashboard docstring notes (docs/DASHBOARD_GITHUB_DATA_COLLECTION.md), the script makes 30 timeline lookups per query run — a pure win to drop.

Changes

  • scripts/dashboard/issue-queries.ts: 3 query fragments (PR ... on PullRequest, recent discussions, hot discussions) no longer fetch timelineItems.
  • scripts/dashboard/build-dashboard.ts: References item.updatedAt directly.
  • types/scripts/dashboard.ts: Removed the TimelineItems interface and the timelineItems: TimelineItems fields on PullRequestById, IssueById, HotDiscussionsIssuesNode, HotDiscussionsPullRequestsNode.
  • tests/fixtures/dashboardData.ts and tests/dashboard/build-dashboard.test.ts: Updated fixtures and test mocks to use updatedAt directly.
  • docs/DASHBOARD_GITHUB_DATA_COLLECTION.md: Updated cost analysis table.

Net diff

6 files changed, 10 insertions(+), 27 deletions(-)

Closes #5168

Summary by CodeRabbit

  • Improvements

    • Refined hot-discussion ranking so recency (top-level "last updated" timestamp) influences scores more accurately.
  • Documentation

    • Clarified the query-complexity illustration in dashboard docs for simpler understanding.
  • Refactor

    • Streamlined dashboard data shapes and fixtures for more consistent and efficient processing.

@netlify

netlify Bot commented Jun 4, 2026

Copy link
Copy Markdown

Deploy Preview for asyncapi-website failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 0eca57c
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/6a219d7388e14f0008b643d5

@asyncapi-bot asyncapi-bot requested a review from CBID2 June 4, 2026 00:35
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9fabd33d-1b59-4302-86dd-d3239d53ce18

📥 Commits

Reviewing files that changed from the base of the PR and between cb7c08f and 0eca57c.

📒 Files selected for processing (1)
  • .changeset/perf-updatedAt-5168.md
✅ Files skipped from review due to trivial changes (1)
  • .changeset/perf-updatedAt-5168.md

📝 Walkthrough

Walkthrough

Replaces nested timelineItems(...){ updatedAt } with the top-level updatedAt field across GraphQL queries, TypeScript types, scoring logic, test fixtures, and documentation.

Changes

Dashboard updatedAt field simplification

Layer / File(s) Summary
Type contract updates
types/scripts/dashboard.ts
TimelineItems interface removed and timelineItems fields deleted from PullRequestById, IssueById, HotDiscussionsIssuesNode, and HotDiscussionsPullRequestsNode.
GraphQL query refactoring
scripts/dashboard/issue-queries.ts
pullRequestById, issueById, hotDiscussionsIssues, and hotDiscussionsPullRequests now select top-level updatedAt instead of timelineItems(first: 1) { updatedAt }.
Score calculation update
scripts/dashboard/build-dashboard.ts
Hot discussion score recency term changed from monthsSince(item.timelineItems.updatedAt) to monthsSince(item.updatedAt).
Test fixtures and assertions
tests/fixtures/dashboardData.ts, tests/dashboard/build-dashboard.test.ts
Fixtures mockDiscussion and discussionWithMoreComments now provide updatedAt at the top level; score-calculation test inputs updated accordingly.
Query documentation update
docs/DASHBOARD_GITHUB_DATA_COLLECTION.md
Query-complexity diagram text updated to reference top-level updatedAt instead of timelineItems.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

ready-to-merge

Suggested reviewers

  • derberg
  • bandantonio
  • thulieblack
  • akshatnema
  • sambhavgupta0705
  • TRohit20
  • vishvamsinh28

Poem

🐰 I hopped through queries, types, and tests,
found updatedAt waiting at the top, no nests.
No more timeline tunnels to descend,
the code looks cleaner from end to end.
A tiny hop, a tidy fix, and joy expressed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: replacing nested timelineItems GraphQL lookups with top-level updatedAt to improve performance by reducing API calls.
Linked Issues check ✅ Passed All coding requirements from issue #5168 are met: GraphQL queries updated to use top-level updatedAt, score calculation refactored, types updated, and tests adjusted accordingly.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the stated objective of replacing timelineItems with top-level updatedAt; no unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/dashboard/build-dashboard.test.ts`:
- Around line 502-513: The object literals recentDiscussion and olderDiscussion
are malformed due to extra closing braces/commas after the updatedAt properties;
open the objects defined by recentDiscussion and olderDiscussion (referencing
the constants recentDiscussion and olderDiscussion in build-dashboard.test.ts),
remove the stray "}," that closes the object early, and ensure each object
contains all intended spread properties, id (for olderDiscussion), and updatedAt
followed by a single closing brace and comma separating declarations so the test
file parses correctly.

In `@tests/fixtures/dashboardData.ts`:
- Line 18: The fixture objects for the discussion entries are malformed due to
an extra closing brace placed immediately after the updatedAt property (e.g.,
the line containing "updatedAt: new Date().toISOString() }"), which prematurely
ends the object and leaves the reviews array outside the literal; remove that
stray "}" so the object contains updatedAt and reviews together (ensure the
object opening brace that defines the discussion fixture and its closing brace
encompass reviews), then run the tests to confirm the fixture parses correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5e6a07e-72bf-4f70-a7fe-5f21ee2270f9

📥 Commits

Reviewing files that changed from the base of the PR and between b1beb34 and 161c2e4.

📒 Files selected for processing (6)
  • docs/DASHBOARD_GITHUB_DATA_COLLECTION.md
  • scripts/dashboard/build-dashboard.ts
  • scripts/dashboard/issue-queries.ts
  • tests/dashboard/build-dashboard.test.ts
  • tests/fixtures/dashboardData.ts
  • types/scripts/dashboard.ts
💤 Files with no reviewable changes (1)
  • types/scripts/dashboard.ts

Comment thread tests/dashboard/build-dashboard.test.ts Outdated
Comment thread tests/fixtures/dashboardData.ts Outdated
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b1beb34) to head (0eca57c).
⚠️ Report is 54 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #5537   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        23           
  Lines          931       931           
  Branches       180       180           
=========================================
  Hits           931       931           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

[Improve]:Use top-level updatedAt instead of timelineItems connection for score calculation

1 participant