fix: sweep last context.octokit.repos.getBranch in app.js to .request() form#44
Open
fix: sweep last context.octokit.repos.getBranch in app.js to .request() form#44
Conversation
…() form ## Why Wave-1 Probot/Octokit expert flagged this as Bug #16 in `docs/agent-fleet/bugs.md`: `src/app.js:268` was the one remaining `context.octokit.repos.getBranch(...)` call after PR #22 / #29 / #30 swept `.issues.X` to `.request()`. Same root cause — Probot v14 sometimes ships `context.octokit` without the namespaced REST plugin, so the `.repos` namespace is undefined at runtime and the call throws synchronously inside the `repository.created` handler retry loop. Note: `dashboard.js` also uses namespaced calls (`octokit.repos.X`, `octokit.pulls.list`, etc.) but it builds its OWN `@octokit/rest@22` client (`dashboard.js:31-36`) where the namespaces are reliably loaded; those calls are intentionally left as-is. ## What Replace the lone `context.octokit.repos.getBranch({owner, repo, branch})` with `octokit.request('GET /repos/{owner}/{repo}/branches/{branch}', {...})`. Identical behaviour, idiomatic v14, immune to the namespace issue. Test mock retrofit: `createMockOctokit` in `__tests__/integration/app.test.js` now also dispatches `GET /repos/{owner}/{repo}/branches/{branch}` into the existing `repos.getBranch` jest.fn() so tests asserting on `context.octokit.repos.getBranch.mockRejectedValue(...)` still work. ## Test plan - [x] 834 tests pass — including the existing `repository.created` tests that assert the 404-retry loop and the `skipBranchScopedWork` path - [x] eslint clean ## Risk & rollout - Risk: low. Pure call-shape change. Same endpoint, same params. - Rollout: self-update on merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Bug #16 from
docs/agent-fleet/bugs.md(wave-1 Probot/Octokit expert).src/app.js:268was the one remainingcontext.octokit.repos.getBranchcall — same Probot-v14 namespace failure mode as PRs #22/#29/#30. Swept to.request()form. Test mock retrofitted so existing assertions onrepos.getBranch.mockXkeep working via route dispatch.(
dashboard.jsis intentionally not touched — it uses its own@octokit/restclient where namespaces are reliable.)🤖 Generated with Claude Code