Skip to content

fix(backfill): openIssuesTotal under-counts when open PRs are subtracted from GraphQL issues - #162

Closed
glorysr1209-png wants to merge 6 commits into
JSONbored:mainfrom
glorysr1209-png:fix/open-issues-issue-types-filter
Closed

fix(backfill): openIssuesTotal under-counts when open PRs are subtracted from GraphQL issues#162
glorysr1209-png wants to merge 6 commits into
JSONbored:mainfrom
glorysr1209-png:fix/open-issues-issue-types-filter

Conversation

@glorysr1209-png

Copy link
Copy Markdown

Summary

Closes #159. Count open issues via GraphQL issueTypes: ISSUE instead of subtracting open PR totals from repository.issues, which under-counts repos that have open pull requests.

Changes

  • refreshRepoGithubTotals: issues(states: OPEN, filter: {issueTypes: ISSUE}).
  • supplementOpenIssuesFromGraphQl: same filter + skip PullRequest nodes.
  • Regression test: 10 open issues + 3 open PRs → openIssuesTotal stays 10.

Real Behavior Proof

  • Unit test asserts totals are not reduced by open PR count when issues and PRs are reported separately by GraphQL.

What I ran

npm test -- test/unit/backfill.test.ts -t "openIssuesTotal"

What I observed

openIssuesTotal matches the issues-only GraphQL total; supplementUnderCountIfNeeded can still run when REST under-counts below the authoritative issue total.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@glorysr1209-png This is still blocked by TypeScript.

A few notes:

  • Adding __typename and filtering PR-shaped nodes out of the GraphQL issue supplement is the right direction.
  • The response type was not updated, so npm run typecheck fails on src/github/backfill.ts: Property '__typename' does not exist.
  • Once the type is fixed, the test coverage should keep the issue-vs-PR distinction pinned.

Required changes:

  • Add __typename?: string | null to the relevant GraphQL issue-node type.
  • Keep the supplement path filtering pull requests before upserting issues.

Validation expected:

  • npm run typecheck
  • npm run test:coverage

@JSONbored JSONbored changed the title [Bug]: openIssuesTotal under-counts when open PRs are subtracted from GraphQL issues fix(backfill): openIssuesTotal under-counts when open PRs are subtracted from GraphQL issues Jun 3, 2026
@JSONbored
JSONbored self-requested a review June 3, 2026 22:15

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@glorysr1209-png this is still blocked by typecheck.

A few notes:

  • Counting issues without subtracting PR totals is the right problem to solve.
  • Current validate fails because src/github/backfill.ts reads __typename from a type that does not declare it.
  • The body has some proof, but CI needs to be green before this can move.

Required changes:

  • Fix the GraphQL payload typing for __typename, or avoid reading it from that typed object.
  • Keep the issues-only total regression test.

Validation expected:

  • npm run typecheck
  • Focused backfill tests
  • Full validate pipeline

@JSONbored

Copy link
Copy Markdown
Owner

This is now stale/have been awaiting changes for a few days with no response. Please feel free to try again based on current codebase status if interested.

@JSONbored JSONbored closed this Jun 4, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 4, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: openIssuesTotal under-counts when open PRs are subtracted from GraphQL issues

2 participants