Skip to content

fix(reports): correct workflow ID and add PR pagination#679

Merged
castrojo merged 2 commits intoprojectbluefin:mainfrom
castrojo:fix/report-pr-pagination-and-workflow-id
Mar 28, 2026
Merged

fix(reports): correct workflow ID and add PR pagination#679
castrojo merged 2 commits intoprojectbluefin:mainfrom
castrojo:fix/report-pr-pagination-and-workflow-id

Conversation

@castrojo
Copy link
Copy Markdown
Contributor

Random fixes I want to get in before the next automated report.

  • build-metrics.mjs: replace disabled workflow 141567601 (Bluefin LTS HWE DX) with active replacement 141569417 (Bluefin DX LTS HWE) which has been running successfully throughout March 2026
  • graphql-queries.mjs: split combined REPO_CLOSED_ITEMS_QUERY into separate REPO_CLOSED_ISSUES_QUERY and REPO_MERGED_PRS_QUERY to allow independent pagination; add hasNextPage loops so repos with >100 PRs in a month are not silently truncated

Assisted-by: Claude Sonnet 4.6 via OpenCode

…eports

- build-metrics.mjs: replace disabled workflow 141567601 (Bluefin LTS HWE DX)
  with active replacement 141569417 (Bluefin DX LTS HWE) which has been running
  successfully throughout March 2026
- graphql-queries.mjs: split combined REPO_CLOSED_ITEMS_QUERY into separate
  REPO_CLOSED_ISSUES_QUERY and REPO_MERGED_PRS_QUERY to allow independent
  pagination; add hasNextPage loops so repos with >100 PRs in a month are
  not silently truncated

Assisted-by: Claude Sonnet 4.6 via OpenCode
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates a workflow ID and refactors the GraphQL data fetching logic to implement independent pagination for closed issues and merged pull requests, preventing silent data truncation. Feedback was provided regarding a potential breaking change where the REPO_CLOSED_ITEMS_QUERY constant now only retrieves issues, which may cause data loss for external consumers who previously relied on it for both issues and pull requests.

Comment thread scripts/lib/graphql-queries.mjs Outdated
`;

// Keep for backward compatibility with any external consumers
const REPO_CLOSED_ITEMS_QUERY = REPO_CLOSED_ISSUES_QUERY;
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.

high

The line const REPO_CLOSED_ITEMS_QUERY = REPO_CLOSED_ISSUES_QUERY; redefines the REPO_CLOSED_ITEMS_QUERY constant to now only represent the query for closed issues. Previously, this constant was implicitly used to fetch both closed issues and merged pull requests. While the fetchClosedItemsFromRepo function now correctly handles both via separate paginated queries, direct consumers who import and use REPO_CLOSED_ITEMS_QUERY for GraphQL calls will now only retrieve issues, potentially leading to silent data loss for PRs. This constitutes a breaking change for such direct consumers. Consider explicitly deprecating REPO_CLOSED_ITEMS_QUERY or renaming it to REPO_CLOSED_ISSUES_QUERY_LEGACY to clearly indicate its changed scope, and guide users to fetchClosedItemsFromRepo for combined data or the new specific query constants.

- Remove REPO_CLOSED_ITEMS_QUERY alias: the constant had zero import
  consumers (all three callers use fetchClosedItemsFromRepo), so the
  backward-compat comment was inaccurate. Full removal is cleaner than
  a rename; a ReferenceError on import is preferable to a silently
  issues-only constant.

- Remove early-exit block from PR pagination loop: the query orders by
  UPDATED_AT DESC but the exit condition checked mergedAt, which is not
  the sort key. A PR merged inside the window but with an old updatedAt
  can appear on a later page; the exit firing on page 1 would silently
  skip it. The loop now terminates correctly on pageInfo.hasNextPage.

Fixes: #12, #13
Reviewed-by: Principal SE (claude-sonnet-4.6) + Doublecheck (gpt-5.3-codex)
Assisted-by: Claude Sonnet 4.6 via OpenCode
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@castrojo castrojo merged commit bff097a into projectbluefin:main Mar 28, 2026
2 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