test: cover the uncovered automation paths in import-architecture-issue.mjs - #810
Conversation
|
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 automatically remove the |
CI note (ci-maintainer): the red
|
…ue.mjs scripts/import-architecture-issue.mjs was the only file in the repository with uncovered source lines (96.03% lines, 78.95% branches; src files stood at 6329/6339). All four uncovered regions run only under the workflow: - neither --issue-json nor GITHUB_EVENT_PATH supplied - a required body section left unanswered - the GITHUB_OUTPUT id= handoff, which names the generated pull request - a template field heading missing from the body entirely The GITHUB_EVENT_PATH fallback is how architecture-submission.yml actually invokes the script, yet every existing test passed --issue-json instead, so the production entry path was never exercised. Also scrub GITHUB_EVENT_PATH and GITHUB_OUTPUT from the sandbox's inherited environment. Both are set for real when the suite runs inside Actions, where an ambient GITHUB_EVENT_PATH masked the no-payload guard and an ambient GITHUB_OUTPUT made the sandbox append id= to the live workflow's output file. Tests that want either now pass it explicitly. src files reaches 100.00% lines (6339/6339); this file reaches 100% lines and 93.10% branches, with the remaining branch gaps closed for empty-slug organisation names, empty project lists, commented project lines and a trailing heading with no response. Closes #809 Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
e96c303 to
074468a
Compare
🔒 Hold-gate integrity: branch changed while hold-gated — fresh review requiredThis PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was Commits not present in the hold-time snapshot (1):
A human should review the FULL diff at the current head — a rebase or force-push renames every commit, so everything above needs eyes even if it looks familiar. Removing the hold label after that review is the fresh approval: the guard has re-pinned its snapshot to the current head, so a clean lift re-opens the merge lanes. |
Test Improvement
scripts/import-architecture-issue.mjs(merged hours ago in #805) was the only file in the repository with uncovered source lines —src filesstood at 99.84%, 6329/6339, and every one of the ten missing lines was in this file.All four uncovered regions run only under
.github/workflows/architecture-submission.yml, never in a local invocation:--issue-jsonnorGITHUB_EVENT_PATH--issue-jsonnorGITHUB_EVENT_PATHis setrequired: truebody section unansweredGITHUB_OUTPUT→id=<id>GITHUB_OUTPUTfor the workflowTwo of these are worth calling out.
The production entry path had no test at all. The workflow passes no
--issue-json; it relies onGITHUB_EVENT_PATH. Every existing test used--issue-jsoninstead, so the way the script is actually invoked was never exercised. Now covered by falls back toGITHUB_EVENT_PATHwhen--issue-jsonis absent.The
GITHUB_OUTPUTkey was unasserted. The workflow titles the pull request it opens from that step output, so renaming or dropping the key degrades the PR title silently. The new test asserts the exact bytes,id=acme-corp\n.Sandbox environment bleed, fixed here
tests/helpers-import-issue-sandbox.mjsspreadprocess.envinto the child. Inside GitHub Actions — which is whereci.ymlruns this suite — both variables are really set, so the suite would have:GITHUB_EVENT_PATHsatisfies the 76-79 guard and masks it entirely; andid=acme-corpto the live workflow's own output file through line 163.The sandbox now scrubs both and exposes
env/passIssueJsonso a test opts back in deliberately. This is what makes the two new env-dependent tests deterministic rather than passing by accident.Remaining branch gaps closed
Empty-slug organisation name (falls back to
issue-<number>, with and without an existing catalog), an empty projects list, commented and blank lines in the projects field, and a trailing heading with no response line.Verification
node --test tests/import-architecture-issue.test.mjs→ 18 pass, 0 fail (was 7)npm run test:unit→ 1433 tests, 0 failuresnpm run check→ exit 0 (all five sub-checks)npm run test:unit:coverage:check→ exit 0src files99.84% → 100.00% lines (6339/6339), branches 98.46% → 99.14%Mutation-checked rather than merely counted — each of these breaks exactly one new test and nothing else:
GITHUB_OUTPUTkey toarchitecture_id=?? process.env.GITHUB_EVENT_PATHfallbackissue-<number>id fallbackNo production code is changed —
git diff --stat scripts/is empty. Tests only.Related Issue
Closes #809
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88