Skip to content

[quality] scripts: add vitest subprocess tests for netlify-ignore.sh (6 cases) - #6972

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-netlify-ignore-6842
Sep 16, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-netlify-ignore-6842

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/netlify-ignore.test.ts — 6 vitest subprocess-style cases covering scripts/netlify-ignore.sh, the Netlify per-build "ignore" hook. Mirrors the harness pattern established by scripts/verify-site-health.test.ts (PR #6909).

Why this script matters

netlify-ignore.sh's entire job is to return the right exit code:

  • exit 0 → Netlify skips the build (used to short-circuit deploy previews for chore/hive-snapshot* automation branches so Netlify preview minutes aren't consumed on throwaway branches).
  • exit 1 → Netlify proceeds with the build.

Inverting either arm has no user-facing signal until the bill or the missing preview is noticed — a silent, high-cost failure mode with a small (18-line) but load-bearing surface.

The script also has a subtle branch-input surface: Netlify may populate the branch name in either $BRANCH or $HEAD depending on the trigger, so the script matches either. A refactor dropping one arm would silently reintroduce full preview builds for snapshot PRs on whichever trigger populated the other variable.

Cases

All four exit-code arms + both env-var surfaces + two glob-narrowness guards:

# Env Expected Guards against
1 BRANCH=chore/hive-snapshot-abc exit 0 (skip) happy path via BRANCH
2 HEAD=chore/hive-snapshot-xyz exit 0 (skip) happy path via HEAD
3 BRANCH=main exit 1 (build) normal-branch happy path
4 BRANCH="" HEAD="" exit 1 (build) empty envs accidentally glob-matching chore/hive-snapshot*
5 BRANCH=chore/hive-snap exit 1 (build) glob broadening to chore/hive-snap*
6 BRANCH=chore/something-else exit 1 (build) glob broadening to chore/*

Verification

$ npx vitest run scripts/netlify-ignore.test.ts
 ✓ scripts/netlify-ignore.test.ts (6 tests) 30ms
 Test Files  1 passed (1)
      Tests  6 passed (6)

Scope

  • No production script change. scripts/netlify-ignore.sh is untouched.
  • No CI wiring change. These tests are picked up by the existing vitest run — no workflow file edits.
  • The tests spawn bash scripts/netlify-ignore.sh with an explicitly minimal env so leaks from the ambient shell can't accidentally satisfy a case arm.

Refs #6842 (part of the "8 of 10 CI automation scripts have zero unit tests" epic; that issue tracks 8 scripts, this PR closes the gap for netlify-ignore.sh, leaving the remaining scripts open there.)


Filed by quality agent (ACMM L4/L6 — full mode)

— hive: agent=quality backend=copilot model=claude-opus-4.7

…(6 cases)

Adds scripts/netlify-ignore.test.ts covering the Netlify per-build
ignore hook, mirroring the subprocess-harness pattern established by
scripts/verify-site-health.test.ts (PR #6909).

The exit-code contract is the entire point of the script — exit 0
skips the deploy-preview build (used to short-circuit
chore/hive-snapshot* automation branches so Netlify preview minutes
aren't consumed on throwaway branches), exit 1 proceeds. Inverting
either arm silently breaks previews site-wide or wastes runner minutes,
a failure mode with no user-facing signal until the bill or the
missing preview is noticed.

Cases (all four exit-code arms + both env-var surfaces + two
glob-narrowness guards):

  1. BRANCH=chore/hive-snapshot-abc — exit 0 (skip)
  2. HEAD=chore/hive-snapshot-xyz   — exit 0 (skip) via HEAD arm
  3. BRANCH=main                    — exit 1 (build)
  4. BRANCH="" HEAD=""              — exit 1: empty envs must not glob-match
  5. BRANCH=chore/hive-snap         — exit 1: prefix alone must not match
  6. BRANCH=chore/something-else    — exit 1: unrelated chore branch

All 6 pass locally against HEAD (vitest run scripts/netlify-ignore.test.ts).
No production script change; no CI wiring change.

Refs #6842

Co-authored-by: Copilot <[email protected]>
Signed-off-by: kubestellar-hive[bot] <[email protected]>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Sep 16, 2026
@netlify

netlify Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for kubestellar-docs failed. Why did it fail? →

Name Link
🔨 Latest commit 6b63301
🔍 Latest deploy log https://app.netlify.com/projects/kubestellar-docs/deploys/6aaa018106f06d00081cde54

@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign kproche for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 16, 2026
@kubestellar-prow kubestellar-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 16, 2026
@kubestellar-prow

Copy link
Copy Markdown

Hi @kubestellar-hive[bot]. Thanks for your PR.

I'm waiting for a kubestellar member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive
hivecommons-hive Bot merged commit e623a86 into main Sep 16, 2026
10 of 14 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-netlify-ignore-6842 branch September 16, 2026 02:40
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

hivecommons-hive Bot added a commit that referenced this pull request Sep 17, 2026
…, #6813) (#6990)

- scripts/netlify-ignore.test.ts: add NODE_ENV to the literal spawnEnv
  object so it satisfies NodeJS.ProcessEnv (TS2741), fixing the
  TypeScript type-check regression from #6972.
- Add src/__tests__/NavbarSubcomponents.render.test.tsx covering the
  six sub-components extracted from Navbar.tsx in #6971
  (NavbarLogo, ContributeDropdown, CommunityDropdown, GithubDropdown,
  MobileMenu, and the navbar/index.ts export surface), restoring
  src/components/navbar/** above its 95/95/90/80 coverage thresholds.
- #6813 (missing vite devDependency) was already fixed on main by
  PR #6834; verified vite is present in package.json and no longer
  reproduces, so it is not addressed here.

Signed-off-by: kubestellar-hive[bot] <[email protected]>
Co-authored-by: kubestellar-hive[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot dco-signoff: yes Indicates the PR's author has signed the DCO. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant