Skip to content

test: cover the uncovered automation paths in import-architecture-issue.mjs - #810

Merged
mrbobbytables merged 1 commit into
mainfrom
quality/test-import-architecture-issue-branches
Sep 29, 2026
Merged

mrbobbytables merged 1 commit into
mainfrom
quality/test-import-architecture-issue-branches

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

scripts/import-architecture-issue.mjs (merged hours ago in #805) was the only file in the repository with uncovered source lines — src files stood 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:

Lines Branch Now covered by
76-79 neither --issue-json nor GITHUB_EVENT_PATH fails when neither --issue-json nor GITHUB_EVENT_PATH is set
116-117 a required: true body section unanswered names the unanswered required body section in the error
162-163 GITHUB_OUTPUT → id=<id> publishes the generated id to GITHUB_OUTPUT for the workflow
193-194 a template field heading absent from the body fails when a template field heading is absent from the body entirely

Two of these are worth calling out.

The production entry path had no test at all. The workflow passes no --issue-json; it relies on GITHUB_EVENT_PATH. Every existing test used --issue-json instead, so the way the script is actually invoked was never exercised. Now covered by falls back to GITHUB_EVENT_PATH when --issue-json is absent.

The GITHUB_OUTPUT key 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.mjs spread process.env into the child. Inside GitHub Actions — which is where ci.yml runs this suite — both variables are really set, so the suite would have:

  • taken a different branch in CI than locally, since an ambient GITHUB_EVENT_PATH satisfies the 76-79 guard and masks it entirely; and
  • appended id=acme-corp to the live workflow's own output file through line 163.

The sandbox now scrubs both and exposes env / passIssueJson so 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 failures
  • npm run check → exit 0 (all five sub-checks)
  • npm run test:unit:coverage:check → exit 0
  • Coverage for this file: 96.03% → 100.00% lines, 78.95% → 93.10% branches
  • Repository-wide: src files 99.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:

Mutation Result
rename the GITHUB_OUTPUT key to architecture_id= 17 pass, 1 fail
drop the ?? process.env.GITHUB_EVENT_PATH fallback 17 pass, 1 fail
remove the empty-slug issue-<number> id fallback 17 pass, 1 fail

No 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

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 outreach agent is always held because it publishes project-facing communication.

Hive will automatically remove the hold label once current policy no longer requires a level hold for "quality". If this is an outreach PR, a human must review it and remove the label.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

CI note (ci-maintainer): the red Reference architecture submission check on the current head is not caused by this PR's diff. The branch predates #815 (merged 2026-09-28T22:40Z), so it still carries the invalid workflow version with a job-level if: referencing env.SUBMISSION_LABEL; GitHub fails workflow validation on every push to the branch (zero jobs, no log). Default branch is clean. Rebasing/merging main into this branch clears the check; no change to this PR's files is needed.

🐝 Hive Agent: ci-maintainer | Instance: hosted-available-lke648397-260827-5n31 | SHA: unknown

— hive: agent=ci-maintainer backend=copilot model=kimi-k3 copilot=1.0.88

…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>
@mrbobbytables
mrbobbytables force-pushed the quality/test-import-architecture-issue-branches branch from e96c303 to 074468a Compare September 29, 2026 16:00
@mrbobbytables
mrbobbytables added this pull request to the merge queue Sep 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

🔒 Hold-gate integrity: branch changed while hold-gated — fresh review required

This PR's branch moved while it sat hold-gated: the head recorded when the hold was applied was e96c303f18d0, but the branch now sits at 074468a767f9. The diff a reviewer saw under the hold is no longer the diff that would merge, so auto-merge is blocked and the hold label has been re-applied.

Commits not present in the hold-time snapshot (1):

  • 074468a767f9 by hivecommons-hive[bot] — test: cover the uncovered automation paths in import-architecture-issue.mjs

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.

Merged via the queue into main with commit a8958dd Sep 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] import-architecture-issue.mjs: the repo's only uncovered source lines, all on workflow-only paths

1 participant