Repository navigation
[quality] loadOwnersTree's failure arms (owners.ts L164/L197/L229) are unit-only — no bundle test drives a failing tree listing or blob read #382
Description
Finding
The complete-tree OWNERS loader, loadOwnersTree in src/utils/owners.ts, has three failure arms that no end-to-end test reaches:
| line | arm |
|---|---|
owners.ts:197 |
octokit.git.getTree of the base tip fails → error loading OWNERS files at <ref> |
owners.ts:229 |
octokit.git.getBlob of an OWNERS entry fails → error loading OWNERS files at <ref> |
owners.ts:164 |
decode of a blob answering without content/encoding → invalid OWNERS file returned from GitHub API for <path> |
Unit evidence: covered — __tests__/utils/owners.test.ts and the plugin unit tests assert both messages (npx vitest run --coverage on main @ aa6a0f8: owners.ts 100 % lines).
End-to-end evidence: not covered — npm run test:coverage:e2e on main @ aa6a0f8 (Node v26.10.0, vitest $(npx vitest --version 2>/dev/null | tail -1)): owners.ts 66.96 % lines (75/112), with 164, 197 and 229 at 0 hits. Re-measured on a scratch branch = main + the heads of all 31 open hold-gated bundle PRs (#283…#381, all merge clean, 218 tests pass): the three lines are still at 0 hits — the probe-path PR #320 covers the sibling arm at L261 (probeOwners) and #331 covers the issue-side auth.ts:494, neither of which is this loader.
Why it matters: these are the arms a flaky GitHub API or an unexpected blob shape takes on every /approve, /lgtm and tide pass over a repository with OWNERS files; today only unit mocks of octokit exercise them, so a regression in how the bundled @octokit surfaces a 500 (or in the error wrapping) would not be caught by the suite that runs the shipped bundle.
Recommendation
One new bundle test file, __tests__/bundle/ownersTreeLoadArms.test.ts, driving /approve by an approver on a pull request through dist/index.js against fakeGithub:
-
GET …/git/trees/basesha?recursive=true→ 500: exit 1,error loading OWNERS files at basesha, no blob read, no write -
GET …/git/blobs/<sha of OWNERS>→ 500: exit 1, same message, no write -
GET …/git/blobs/<sha of OWNERS>→ 200{ sha, size }withoutcontent: exit 1,invalid OWNERS file returned from GitHub API for OWNERS, no write
Files/functions claimed: __tests__/bundle/ownersTreeLoadArms.test.ts (new) only; loadOwnersTree/decode failure arms in src/utils/owners.ts. Disjoint from #320 (truncated-tree probes, probeOwners/probeBranchOwners), #331 (issue-side OWNERS fallback, auth.ts), #328 (pullRequestOwners) and #365 (parseOwners filters).
Priority
- Impact: medium (unit-covered, no e2e)
- Effort: low
Filed by quality agent (hold-gated mode)
🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: b003b2c
— hive: agent=quality backend=copilot model=claude-fable-5.1
Activity
github-actions commentedon Oct 8, 2026
Please add a kind label with
/kind failing-testor/kind cleanup.