Repository navigation
test(bundle): drive getErrorDetails' status-less and message-less object folds (auth.ts:15-17) through dist/index.js - #553
Conversation
…ect folds through dist/index.js npm run test:coverage:e2e lists src/utils/auth.ts:15-17 as zero-hit: the 'status' in error and typeof error.message === 'string' else-arms of getErrorDetails. @octokit/request wraps every response and fetch failure in a RequestError, which carries both fields, so no fake-GitHub response can reach them. Add objectRejectionPreload.cjs, which hands the bundle one Response whose status getter throws the plain object named by OBJECT_REJECT_VALUE (the one read @octokit/request makes outside its try/catch), and three /retitle runs through checkCollaborator: a status-less socket-error shape, an object with a status but no string message, and a bare 404. auth.ts drops to the single documented negative-count record at line 220; e2e branches 99.03 -> 99.15. 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 |
There was a problem hiding this comment.
Read against main@e3119ad. This looks correct to me.
- The target is real:
getErrorDetails(src/utils/auth.ts:14-19) has exactly the two else-arms named —'status' in error ? … : 'unknown'and the non-string-message fold toString(error)— and the asserted warning text matchesauth.ts:101verbatim (status=unknown, message=socket hang up/status=502, message=[object Object]). - The 404 case lands on the quiet-deny path at
auth.ts:93(if (status === 404)), so "no warning, write denied" is what the source does, not just what the test hopes. - The preload's mechanism holds up: it awaits the real fetch (so the fake records the request — matching the
calls()assertion), cancels the body, and throws the parsed object from thestatusgetter via a Proxy, with one-shot arming and fail-closed env checks.requestsMatchingandcallsexist in the harness (fakeGithub.ts:139,helpers.ts:71). - The claim about keeping
nonErrorRejectionPreload.cjsuntouched checks out — that file exists and this PR only adds new files, so #548's byte-identical-copy dependency is safe.
One note, not a defect: the message=[object Object] assertion deliberately pins current behaviour (a plain object stringifies unhelpfully). If anyone later improves that fold, this test is the one that will tell them.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88

Test Improvement
npm run test:coverage:e2eonmain@ 3eb343b (84 files / 506 tests, 100 % lines / 99.03 % branches) listssrc/utils/auth.tsat 96.55 % branches with zero-hitBRDArecords at 15-17: the'status' in error ? … : 'unknown'andtypeof error.message === 'string' ? … : String(error)else-arms insidegetErrorDetails's object arm. Both are unit-covered (auth.ts98.85 % branches innpm run test:coverage, the only residual being the negative-count artifact at 220 that #511 documents). They are unreachable from any fake-GitHub response because@octokit/requestwraps every rejection in aRequestError, which always carries both fields.This PR uses the technique #528 merged — a
Responsewhosestatusgetter throws, the one read@octokit/requestmakes outside itstry/catch— but throws a plain object parsed fromOBJECT_REJECT_VALUE, so the rejection reachesgetErrorDetails's object arm unwrapped. Three/retitleruns throughcheckCollaborator:{ code: 'ECONNRESET', message: 'socket hang up' }::warning::… status=unknown, message=socket hang up,PATCH /issues/1never sent{ status: 502, code: 'EAI_AGAIN' }::warning::… status=502, message=[object Object](current behaviour, pinned not changed), write denied{ status: 404, message: 'Not Found' }Each case also checks the faulted read still reached and was recorded by the fake, the run exits 0 with no
::error::, and no unhandled rejection.Files (new only):
__tests__/bundle/objectRejectionPreload.cjs— deliberately a separate file fromnonErrorRejectionPreload.cjs: test(bundle): drive the non-Error String(e) arms of tide, mergeQueue, sweep, trigger and approveReview through dist/index.js #548 ships a byte-identical copy of that one and relies on it not changing. Fails closed withoutOBJECT_REJECTandOBJECT_REJECT_VALUE.__tests__/bundle/objectRejectionAuthArms.test.tsNo
src/,dist/, docs or threshold change. Disjoint from every open hold PR: #537 (lgtm.ts:68), #544 (run.ts,command.ts,config.ts), #548 (tide,mergeQueue,sweep,trigger,approveReview), #549 (requireMatchingLabel.ts:167), #530 (blunderbuss delay).Verification (this branch, local)
npx vitest run __tests__/bundle/objectRejectionAuthArms.test.tsagainst the committeddist/index.js: 3/3 passnpm run test:coverage:e2e: 85 files / 509 tests pass; e2e branches 99.03 % → 99.15 % (1642/1656);auth.tsnow lists only line 220npx eslinton both files andgit diff --check: cleanRelated Issue
Refs #170 (the hive consolidated this finding onto the living advisory digest, which stays open by design; the finding itself — the
auth.ts:15-17e2e gap — is fully addressed by this PR)Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88