Skip to content

[quality] owners.ts repoHasOwners/defaultBranch fallback (approve.ts:504, tide.ts:543) has no end-to-end coverage #368

Closed

Description

@hivecommons-hive

Finding

src/utils/owners.ts repoHasOwners → defaultBranch (lines 282–284, 348–359) is the arm /approve and the tide gate take when no base branch is in scope:

  • src/plugins/approve.ts:504 — pull_request / pull_request_review payload whose pull_request.base.ref is not a string → repoHasOwners(octokit, context)
  • src/plugins/tide.ts:543 — loadTide(octokit, context, base) with base === undefined (the pulls.get read in getPull returned no base.ref) → repoHasOwners(octokit, context)

defaultBranch then has three arms of its own: the payload's repository.default_branch, a repos.get fallback when the payload names none, and the could not read the default branch: … throw when that read fails.

The unit suite covers every one of those lines (npx vitest run --coverage on main @ 3fc21f2 → 100 % lines, __tests__/utils/owners.test.ts), but the bundle (end-to-end) suite never reaches them:

$ npx vitest run --coverage --coverage.reporter=lcovonly --config vitest.e2e-coverage.config.mjs __tests__/bundle
# main @ 3fc21f2, Node v26.10.0, vitest 5.0.3, 142 tests
src/utils/owners.ts    LF:112 LH:75   DA:283,0 DA:284,0 DA:349,0 DA:350,0 DA:351,0 DA:354,0 DA:355,0 DA:358,0
src/plugins/approve.ts BRDA:504,79,1,0        # the repoHasOwners arm
src/plugins/tide.ts    BRDA:543,86,0,0 BRDA:543,174,0,0   # the base === undefined arm

Held PR #320 (ownersProbeArms.test.ts) covers every other probeBranchOwners arm and says in its body that it deliberately leaves "the no-base.ref repoHasOwners/defaultBranch path" out; #366 notes the same 0-hit path as out of scope. No open PR claims it.

Unit and e2e evidence are stated separately: as recorded in #235, the two runs' maps come from different transforms and are not combined.

Recommendation

One new bundle test file, __tests__/bundle/defaultBranchFallback.test.ts, driving the committed dist/index.js against fakeGithub:

  • pull_request synchronize with pull_request.base.ref removed: approve probes git/trees/<repository.default_branch> with no repos.get; with repository.default_branch removed too, it reads GET /repos/Codertocat/Hello-World and probes the branch it names; a 500 on that read fails the run with could not read the default branch and probes no branch tree
  • pull_request labeled lgtm where GET …/pulls/1 returns no base.ref: tide reads the default branch the same three ways, merging in the first two and failing the merge (no PUT) in the third

Expected: owners.ts e2e lines 75 → 82 / 112; approve.ts:504 and tide.ts:543 fallback arms 0 → hit.

Priority

  • Impact: medium (covered by unit tests but not end-to-end; both production call sites)
  • Effort: low

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: unknown

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

Activity

  1. added
    qualityCreated by Hive for agent-filed issue provenance
    testingCreated by Hive for agent-filed issue provenance
    agent/qualityCreated by Hive for agent-filed issue provenance
    on Oct 7, 2026
  2. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    Please add a kind label with /kind failing-test or /kind cleanup.

  3. added
    🐝 covered by PRHive verified that an open PR references or claims this issue; still actionable until confirmed
    hive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmation
    and removed
    🐝 covered by PRHive verified that an open PR references or claims this issue; still actionable until confirmed
    on Oct 7, 2026
  4. hivecommons-hive commented on Oct 9, 2026

    @hivecommons-hive
    ContributorAuthor

    task-list sweep: 0 of 2 items ticked. Not closing yet — outstanding boxes remain.

    Outstanding items:

    • 🔲 pull_request synchronize with pull_request.base.ref removed: approve probes git/trees/<repository.default_branch> with no repos.get; with repository.default_branch removed too, it reads GET /repos/Codertocat/Hello-World and probes the branch it names; a 500 on that read fails the run with could not read the default branch and probes no branch tree
    • 🔲 pull_request labeled lgtm where GET …/pulls/1 returns no base.ref: tide reads the default branch the same three ways, merging in the first two and failing the merge (no PUT) in the third

    Merged PRs referencing this issue so far:

    This comment is edited in place by the task-list sweep on every cycle; it is not duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityCreated by Hive for agent-filed issue provenancehive/hosted-available-lke648397-260827-5q9tCreated by Hive for agent-filed issue provenancehive/likely-doneHive verified that a merged PR references or claims this issue; pending confirmationneeds-kindqualityCreated by Hive for agent-filed issue provenancetestingCreated by Hive for agent-filed issue provenance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions