Skip to content

test(bundle): drive the repoHasOwners/defaultBranch fallback of approve and the tide gate through dist/index.js - #369

Open
hivecommons-hive[bot] wants to merge 3 commits into
mainfrom
quality/test-default-branch-fallback
Open

hivecommons-hive[bot] wants to merge 3 commits into
mainfrom
quality/test-default-branch-fallback

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/defaultBranchFallback.test.ts (one new file; no change to helpers.ts, fakeGithub.ts, runBundle.ts, source or dist/). It drives the committed dist/index.js against the fake GitHub through the arm both OWNERS consumers take when no base branch is in scope, which falls to src/utils/owners.ts repoHasOwners → defaultBranch:

approve.ts:504 — pull_request synchronize whose payload carries no pull_request.base.ref

  • repository.default_branch present: approve probes GET …/git/trees/master?recursive=true with no repos.get read; approve: the base branch has no OWNERS files, exit 0
  • repository.default_branch removed too: GET /repos/Codertocat/Hello-World → { default_branch: 'trunk' }, then GET …/git/trees/trunk?recursive=true
  • that read answers 500: exit 1, ::error:: carries could not read the default branch, no branch tree is probed (owners-label's trees/basesha listing is the only tree read)

tide.ts:543 — pull_request labeled lgtm by a human, GET …/pulls/1 returning no base.ref

  • payload default branch: [bind, pulls/1, trees/master, commit status, graphql, merge], merged pr #1
  • payload names none: [bind, pulls/1, GET /repos/…, trees/trunk, commit status, graphql, merge], merges
  • repos.get 500: exit 1, could not read the default branch, no tree probe and no PUT

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3, vitest run --coverage --coverage.reporter=lcovonly --config vitest.e2e-coverage.config.mjs __tests__/bundle):

Cluster claimed: owners.ts repoHasOwners/defaultBranch via approve.ts:504 and tide.ts:543. Disjoint from the held OWNERS PRs: #320 (probeOwners/probeBranchOwners truncated-tree arms — its body leaves this path out by name), #328/#331 (pullRequestOwners, issue-side fallback), #365 (parseOwners filters), #283 (root-OWNERS authorization), #333/#363 (approve evaluation arms, syncApprovalReview), #322/#347 (tide merge-queue and verdict arms).

Related Issue

Closes #368


Filed by quality agent (hold-gated mode). Human review required.

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

…ve and the tide gate through dist/index.js

Adds __tests__/bundle/defaultBranchFallback.test.ts, running the committed
bundle against the fake GitHub for the arm approve.ts:504 and tide.ts:543
take when no base branch is in scope: a pull_request payload without
base.ref, and a pulls.get read without base.ref. Each reaches owners.ts
repoHasOwners -> defaultBranch three ways: the payload's
repository.default_branch, the repos.get fallback, and that read's 500.

owners.ts e2e lines 75 -> 82 of 112; both call-site fallback arms 0 -> hit.

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive
hivecommons-hive Bot requested a review from jpmcb as a code owner October 7, 2026 19:45
@hivecommons-hive hivecommons-hive Bot added the hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 7, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Important

Held for human review by the hive's ACMM level gate.

This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the outreach agent is always held because it publishes project-facing communication.

Hive will keep the hold label until a human removes it. Operators can make a deliberate one-off release during an ACMM level change with release_level_holds=true, but level changes never release this hold automatically.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

@jeefy jeefy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I measured each case's new end-to-end coverage. The approve cases at L43/55/67 cover the three default-branch paths, and L100 covers the tide.ts:543 fallback. The two tide cases after those reach nothing new.

  • Drop defaultBranchFallback.test.ts:113–125 and :127–140. owners.ts:354–358 is already reached by L55/L67, and tide.ts:543 by L100.

quality added 2 commits October 7, 2026 21:50
…by the approve cases

Signed-off-by: quality <quality@hive.kubestellar.io>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: dropped the two tide cases after L100; the approve cases and the tide.ts:543 case remain. Merged main too (it brings #287's meow network fix, which is what build-test was failing on).


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

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

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

Labels

hold Indicates that a PR should not merge because someone has issued a /hold command. needs-kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant