Repository navigation
test: cover realGitPath's null-stdout fallback and ratchet the harness coverage floors - #1319
Conversation
…s floors tests/helpers-script-sandbox.mjs was the lowest file in the harness coverage row at 97.06% regions, with one uncovered region: the `?? ''` in realGitPath. Its sibling `|| '/usr/bin/git'` is already driven by helpers-script-sandbox-fallbacks.test.mjs through an empty PATH, but `?? ''` guards the case spawnSync signals with `stdout: null` -- a process that never started -- and the call passes `shell: true`, so reaching it inline would mean making /bin/sh unspawnable for one call and not for the rest of the file. Split the normalisation out as an exported gitPathFromLookup so the arm is a function of the one value spawnSync varies, and drive both fallbacks beside the inputs that skip them. realGitPath keeps its behaviour; the integration test that reaches the arm through an empty PATH is unchanged and still passes. That region was load-bearing for the gate. The note in tests/coverage-gate-thresholds.test.mjs held --check-harness-file-regions at 97 "while helpers-script-sandbox.mjs sits at 97.06", and left --check-harness-regions at 97 against a measured 99.57 "until that file has been lifted". It has been, so both floors follow the measurement up: per-file to 98, bound by tests/tools/e2e-coverage-report.mjs at 98.57% whose six remaining regions are the documented-unreachable #1253 fallbacks, and the aggregate to 99 against a measured 99.63%. Measured after the change (TZ=UTC node tests/tools/coverage-report.mjs, node v26.10.0): tests/helpers-script-sandbox.mjs 100.00% lines / 100.00% regions; harness files 100.00% / 99.63% (5352/5352 lines, 1870/1877 regions). npm run test:unit:coverage:check passes at the new floors, and the raised floors were confirmed to fail the gate-threshold test when package.json is loosened back to 97. Signed-off-by: quality <quality@hive.kubestellar.io>
|
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 Hive will keep the |
3e0ddb5
ℹ️ Sentinel notice — informational; author is trusted (hive agent), merge is not blockedHive flagged this PR (author @hivecommons-hive[bot], head
Hive did not add the |
Test Improvement
tests/helpers-script-sandbox.mjswas the lowest file in the harness coverage row at 97.06% regions, with exactly one uncovered region — the?? ''inrealGitPath:Its sibling
|| '/usr/bin/git'is already driven:tests/helpers-script-sandbox-fallbacks.test.mjsreaches it through an emptyPATH, socommand -v gitfinds and prints nothing.?? ''guards a different case — the onespawnSyncsignals withstdout: null, a process that never started — and the call passesshell: true, so reaching it inline would mean making/bin/shunspawnable for one call and not for the rest of the file.This splits the normalisation out as an exported
gitPathFromLookup, making the arm a function of the one valuespawnSyncvaries, and drives both fallbacks beside the inputs that skip them ('/usr/local/bin/git\n','',' \n',null,undefined).realGitPathkeeps its behaviour, and the existing empty-PATHintegration test is unchanged and still passes — so the pair is evidence the arm switched, not that the helper was rewritten around it.The floors this unblocks
That region was load-bearing for the gate. The note in
tests/coverage-gate-thresholds.test.mjsheld--check-harness-file-regionsat 97 "while helpers-script-sandbox.mjs sits at 97.06", and left--check-harness-regionsat 97 against a measured 99.57 "until that file has been lifted". It has been, so both follow the measurement up in this same commit, as that file asks:--check-harness-file-regionstests/tools/e2e-coverage-report.mjsat 98.57%, whose six remaining regions are the documented-unreachable #1253 fallbacks--check-harness-regionsNo workflow edit is needed:
ci.ymlinvokesnpm run test:unit:coverage:check, so the thresholds live entirely inpackage.json.Verification
Measured with
TZ=UTC node tests/tools/coverage-report.mjson node v26.10.0, at92cede9before and with this commit after:tests/helpers-script-sandbox.mjs: 97.06% → 100.00% regions (lines stay 100.00%)srcrow unchanged at 100.00% lines / 100.00% regions (2777/2777)npm run test:unit:coverage:checkpasses at the new floors; the full unit suite is green (2376 passed, 0 failed);npx prettier --checkis clean on every touched file. The raised floors were confirmed to bite rather than pass vacuously: looseningpackage.jsonback to--check-harness-file-regions 97failstests/coverage-gate-thresholds.test.mjs.Related Issue
Closes #1318
Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88