Skip to content

fix(labels): ensurePullRequestLabel misses labels beyond first page - #161

Closed
glorysr1209-png wants to merge 10 commits into
JSONbored:mainfrom
glorysr1209-png:fix/pr-label-direct-lookup
Closed

fix(labels): ensurePullRequestLabel misses labels beyond first page#161
glorysr1209-png wants to merge 10 commits into
JSONbored:mainfrom
glorysr1209-png:fix/pr-label-direct-lookup

Conversation

@glorysr1209-png

Copy link
Copy Markdown

Summary

Closes #160.

Look up repository labels by name instead of scanning only the first labels page.

Changes

  • GET /repos/{owner}/{repo}/labels/{name} with 404 → create when allowed.
  • Update label unit tests for direct lookup.

Test plan

  • npm test -- test/unit/github-labels.test.ts

@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 The direct label lookup is a good API-level fix, but the branch currently breaks webhook accounting.

A few notes:

  • Switching to GET /labels/{name} avoids the first-page-only repository-label lookup problem.
  • CI now fails because the queue webhook test expected labelsCreated: 1 and received labelsCreated: 0.
  • That means the missing-label creation path is no longer reflected correctly in the visible queue stats.

Required changes:

  • Preserve direct lookup for existing labels.
  • Preserve missing-label creation and labelsCreated accounting when the label does not exist.
  • Keep both cases covered in tests.

Validation expected:

  • npm run test:coverage

@JSONbored JSONbored changed the title [Bug]: ensurePullRequestLabel misses labels beyond first page fix(labels): ensurePullRequestLabel misses labels beyond first page Jun 3, 2026
@JSONbored
JSONbored self-requested a review June 3, 2026 22:14

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

A few notes:

  • Direct label lookup by name is a reasonable fix for first-page pagination misses.
  • Current validate fails in test/unit/queue.test.ts because labelsCreated is 0 where the test expects 1.
  • The body needs current validation/safety evidence.

Required changes:

  • Fix the label-create/lookup behavior or update the test only if the expected behavior has intentionally changed.
  • Update the PR body to the current template.

Validation expected:

  • Focused label 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]: ensurePullRequestLabel misses labels beyond first page

2 participants