Repository navigation
test(owners): pin parseGroup's segment limit, loadOwnersTree's OWNERS-directory and encoding-less blob arms, probeOwners' empty hasOwners and the empty default_branch fallback - #525
Conversation
…d encoding-less blob arms of loadOwnersTree, the empty probe's hasOwners and the empty default_branch fallback A single-operator mutation probe of src/utils/owners.ts (25 mutants against the 31 suites that exercise the file) left five survivors although the file is 100 % line-covered. Each gets a test that fails on its mutant: - parseGroup: a third path segment (`@myorg/a/b`) is malformed, not a group of org "myorg/a"; a direct parseGroup table plus the exact diagnostic - loadOwnersTree: a tree entry named OWNERS of type `tree` is skipped and never fetched as a blob, and does not count as an OWNERS file - decode: a blob returned without `encoding` is rejected - probeOwners: a truncated tree whose every ancestor probe is 404 reports hasOwners false, so authorization falls back to membership instead of failing with "no OWNERS file covers" - defaultBranch: an empty `repository.default_branch` in the payload falls back to repos.get Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
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. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
|
Please add a kind label with |
mrbobbytables
left a comment
There was a problem hiding this comment.
Copilot review performed under the maintainer's explicit authorization to update, review, release reviewed holds, and merge eligible PRs in this cleanup.
The OWNERS cases distinguish malformed group segments, directory versus blob entries, missing encoding, empty probe results, and an empty default-branch fallback using observable API requests.
Verified successful build-test, e2e-coverage and DCO results on head 9cd2219. Any folded issue findings remain assigned to the canonical destinations in the updated scope tables.
Description
Pins five behaviours of
src/utils/owners.tsthat a single-operator mutation probe showed the suite did not assert, although the file is 100 % line-covered in both the unit and the bundle e2e run. Tests only; nosrc/ordist/change.Files / functions claimed:
__tests__/utils/owners.test.ts(parseGroup,expandGroups),__tests__/utils/ownersAuth.test.ts(loadOwnersTree→decode,probeOwners),__tests__/utils/repoHasOwners.test.ts(defaultBranch). Disjoint from the open held PRs #510–#524 (authgetErrorDetails, contributing docs, remove, labelMatch/command, sweep, tide, requireMatchingLabel, approve, trigger).Probe
25 mutants hand-applied to
src/utils/owners.tsonmain@ 88241f4, each run against the 31 unit suites that import or drive the file (npx vitest runover__tests__/utils/{owners,ownersAuth,repoHasOwners,pullRequestOwners,mergeGate,auth}.test.tsand the plugin/command suites that load OWNERS — 893 tests per mutant). 20 killed (ownersDirkeeping its trailing slash killed by an infinite directory walk), 5 survived:owners.ts:99parseGroup[^/\s]+→[^\s]+parseGroup› is undefined for@myorg/a/b(a third path segment);expandGroups› drops an @ entry … now asserts the@myorg/a/bdiagnostic tooowners.ts:283decodedrop|| !file.encodingassertAuthorizedByOwnersOrMembership on a pull request› rejects an OWNERS blob that comes back without an encodingowners.ts:322loadOwnersTreedropentry.type === 'blob'owners.ts:381probeOwnershasOwners: owners.size > 0→trueowners.ts:468defaultBranchdropfromPayload !== ''repoHasOwners› reads the default branch from the api when the payload names an empty default_branchThe
parseGrouptable also covers a plain login,@bob, an empty org, an empty slug, and whitespace in either part, since the exported function had no direct test.Related Issue
None open for this finding:
hive-open-issueconsolidated both attempts to file it into unrelated issues (#517, tide.ts; #507, auth.ts BRDA) on title shape. This PR body is the record of the finding; merging it leaves nothing to track.Testing
npx vitest run __tests__/utils/owners.test.ts __tests__/utils/ownersAuth.test.ts __tests__/utils/repoHasOwners.test.ts— 3 files / 81 tests pass on this branchsrc/utils/owners.tson this branch fails exactly the test named in the table above (verified by re-running the three suites per mutant)npx eslint __tests__/utils/— cleanChecklist
src/change, sodist/is unchanged and nonpm run packis neededFiled by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88