Skip to content

test(bundle): drive owners.ts' truncated-tree probes and the base-branch OWNERS probe's arms through dist/index.js - #320

Merged
github-actions[bot] merged 3 commits into
mainfrom
quality/test-bundle-owners-probe-arms
Oct 9, 2026
Merged

github-actions[bot] merged 3 commits into
mainfrom
quality/test-bundle-owners-probe-arms

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds __tests__/bundle/ownersProbeArms.test.ts (new file only; nothing else touched), driving /approve by an approver on a pull request through the committed dist/index.js against fakeGithub to reach the arms of src/utils/owners.ts that a complete tree listing never does:

probeOwners — the base tip's tree is truncated

  • root OWNERS 200, sdk/OWNERS 404: bob approves from the root file; the probes run root-first, one at a time (GET …/contents/OWNERS?ref=basesha, GET …/contents/sdk%2FOWNERS?ref=basesha), and no git/blobs read happens
  • a probe answering 500: /approve fails with error loading OWNERS files at basesha, no label or comment write

probeBranchOwners — the tide gate's probe of the base branch

  • a complete tree without an OWNERS blob: the gate wants lgtm alone and the pull request merges (PUT …/pulls/1/merge), no contents/OWNERS read
  • a truncated tree without an OWNERS blob + root OWNERS 200: the gate wants approved too → skipping pr #1: missing approved
  • a truncated tree without an OWNERS blob + root OWNERS 404: lgtm alone, merges
  • a truncated tree + root probe 500: the merge fails with error probing for a root OWNERS file at master
  • a tree listing answering 500: the merge fails with error listing the tree of master, no root probe

Evidence (main @ 3fc21f2, Node v26.10.0, vitest 5.0.3, npm run test:coverage:e2e): src/utils/owners.ts e2e 66.96 → 86.61 % lines (75 → 97 of 112), 68.66 → 85.07 % branches; probeOwners 0 → hit, every probeBranchOwners arm except the no-base.ref repoHasOwners/defaultBranch path (a defensive arm GitHub payloads never take) now reached. Bundle suite 6 files / 149 tests green; npx eslint and npx tsc --noEmit clean.

Disjoint from the open hold-gated PRs: #283 (ownersAuth.test.ts, auth.ts OWNERS arms on complete trees), #286 (approveReview.test.ts), #289 (mergeGateLabels.test.ts), #291, #293, #296, #298 (ownersLabelArms.test.ts), #300, #302, #304, #306, #308, #310, #312, #314, #316, #318, #242, #244, #246 (helpers.ts, labelCommands.test.ts, bundle.test.ts), #230, #287 — none drives a truncated tree or a contents/OWNERS?ref= probe.

Related Issue

Closes #319


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

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

…ex.js

Adds __tests__/bundle/ownersProbeArms.test.ts, driving /approve on a pull
request through the committed bundle against the fake GitHub to reach the
arms of src/utils/owners.ts that a complete tree listing never does:

- probeOwners: a truncated base-tip tree makes loadOwnersTree read each
  candidate OWNERS path directly (root 200 + sdk/OWNERS 404 approves with
  no blob read; a 500 probe fails /approve naming the base tip)
- probeBranchOwners, the tide gate's base-branch probe: a complete tree
  without an OWNERS blob (gate wants lgtm alone, the pull request merges),
  a truncated tree with and without a root OWNERS file, a 500 root probe
  and a 500 tree listing

owners.ts e2e coverage (npm run test:coverage:e2e, main@3fc21f2):
66.96% -> 86.61% lines, 68.66% -> 85.07% branches.

Closes #319

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

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

All seven cases add coverage, but the file declares its own copies of shared helpers.

  • ownersProbeArms.test.ts:68–70 declares its own calls(). Take it from helpersFor(() => gh).
  • :73–80: afterConfig re-implements expectCommandThenConfig, and its local start shadows the imported start. Use expectCommandThenConfig([...ownersReads, ...ownersTail], tail) at :102 and :138.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed: calls and expectCommandThenConfig come from helpersFor(() => gh); the local calls() and afterConfig (with its shadowing start) are gone. 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Addressed in d92399e: calls() comes from helpersFor(() => gh), the local afterConfig and shadowing start are gone, and both sites use expectCommandThenConfig([...ownersReads, ...ownersTail], tail).

CI is green on the new head.


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

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

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

Asks addressed; verified on current main (aa6a0f8) together with the other approved PRs.

@jeefy

jeefy commented Oct 9, 2026

Copy link
Copy Markdown
Member

/kind cleanup
/lgtm
/approve
/hold cancel

@github-actions github-actions Bot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed hold Indicates that a PR should not merge because someone has issued a /hold command. labels Oct 9, 2026
@github-actions github-actions Bot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed needs-kind labels Oct 9, 2026
@github-actions
github-actions Bot merged commit 195b441 into main Oct 9, 2026
10 checks passed
@mrbobbytables
mrbobbytables deleted the quality/test-bundle-owners-probe-arms branch October 9, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] owners.ts truncated-tree probes (probeOwners, probeBranchOwners arms) are never driven through dist/index.js

1 participant