Repository navigation
test(config): pin normalizeBlunderbuss' non-Error parseDuration arm and v8-ignore it for the bundle - #563
Conversation
…nd v8-ignore it for the bundle parseDuration throws only Error, so the non-Error alternate of the blunderbuss.delay catch in normalizeBlunderbuss is unreachable from dist/index.js. Drive it from a unit test that spies parseDuration to throw a string, exactly as configSweep.test.ts does for sweep.lookback, and give the alternate the same v8 ignore hint that arm carries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> 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 |
|
/kind cleanup 🐝 Hive Agent: — hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Description
normalizeBlunderbussinsrc/utils/config.tsrewraps aparseDurationfailure forblunderbuss.delayas`${source}: ${e instanceof Error ? e.message : e}`(line 618 atmain@e3119ad).parseDurationonly ever throwsError, so the non-Error alternate was the single unit-uncovered branch left inconfig.tsand the bundle run listed the same line. The siblingsweep.lookbackarm (config.ts:677) already has the repository's treatment for this shape —__tests__/utils/configSweep.test.tsdrives it, and it carries av8 ignore nexthint for the bundle (#549). This PR gives theblunderbuss.delayarm, added in #530, the same two things.Files/functions claimed:
__tests__/utils/configBlunderbussDelay.test.ts(new)parseDuration(vi.mock('../../src/utils/duration', { spy: true })) to throw the stringclock skew; assertsparseProwConfig('x', 'blunderbuss:\n delay: 1h\n')throwsx: clock skewsrc/utils/config.ts// parseDuration throws only Errorand the/* v8 ignore next -- non-Error arm unreachable from dist/index.js; configBlunderbussDelay.test.ts drives it */hint on the alternate, byte-for-byte the form used at thesweep.lookbackarmdist/index.jsnpm run packafter the comment change (the hint lands in the bundle exactly as #549's did)Source behaviour is unchanged. The live
Errorarm (x: invalid blunderbuss.delay 'later': …) stays asserted by__tests__/cronJobTest/sweep.test.tsand__tests__/bundle/blunderbussDelay.test.ts; this PR does not touch either file.Disjoint from every open held PR: #553 (
auth.tsarms), #555 / #559 (__tests__/bundle/blunderbussDelay.test.ts), #556 (e2e floor), #557 (tide.test.ts), #558 (sweep.test.ts), #561 / #562 (newsweep*test files). None of them edit__tests__/utils/,src/utils/config.tsordist/index.js.Refs #560 — lands the folded
config.ts:618variant the hive attached to that tracker; the tracker's originalsweep.ts:80finding is delivered by #561 and thesweep.ts:208variant by #562, so #560 stays open until those merge.Coverage evidence
npm run test:coverageonmain@e3119ad(2330 tests, 99.92 % lines / 99.35 % branches):config.ts100 / 99.61, uncovered618;coverage/lcov.infohasBRDA:618,76,1,0. With this PR the alternate is driven (DA:619,1from the new test) and the hint removes itsBRDArecord, as atconfig.ts:677.npm run test:coverage:e2eonmain@e3119ad(528 tests, 100 % lines / 99.46 % branches):config.ts100 / 99.61, uncovered618— unreachable from the bundle by construction, hence the hint rather than a scenario.docs/contributing.md: their maps come from different transforms and do not combine). This is a plain zero-hit arm, not one of the four documented negative-count phantoms.Testing
npx vitest run __tests__/utils/configBlunderbussDelay.test.ts→ 1 passednpx vitest run __tests__/utils --coverage --coverage.include=src/utils/config.ts→ 504 passed; line 619 (the catch) hit, noBRDAfor the ignored alternatenpx eslint src/utils/config.ts __tests__/utils/configBlunderbussDelay.test.ts→ cleannpm run build && npm run pack→dist/index.jscommittedChecklist
npm run build,npm run linton the touched files andnpm run packnpm run packand committeddist/Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-fable-5.1