Skip to content

[jsweep] Clean action_input_utils.cjs - #32548

Merged
pelikhan merged 1 commit into
mainfrom
signed/jsweep/action-input-utils-2026-05-16-0f50f4aa8fa15dfc
May 16, 2026
Merged

[jsweep] Clean action_input_utils.cjs#32548
pelikhan merged 1 commit into
mainfrom
signed/jsweep/action-input-utils-2026-05-16-0f50f4aa8fa15dfc

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

This PR processes action_input_utils.cjs as part of the daily jsweep run.

Execution context: Pure Node.js (no GitHub Actions runtime dependencies)

What was found

The source file action_input_utils.cjs was already in excellent shape:

  • @ts-check already present
  • ✅ Full JSDoc annotations
  • ✅ Clean modern JavaScript (optional chaining, template literals)
  • ✅ Comprehensive existing test suite (12 tests)

Change made

During analysis, one untested behavioural edge case was identified and documented:

When INPUT_<NAME> is set to a whitespace-only string (e.g. " "), the hyphen form INPUT_<NAM-E> is not consulted, because " " is truthy in JavaScript and the || chain short-circuits. The .trim() then produces "". This is intentional precedence behaviour but was previously unspecified.

A new test was added to explicitly document this:

it("does not fall back to hyphen form when underscore form is whitespace-only (whitespace is truthy)",()=>{vi.stubEnv("INPUT_JOB_NAME"," ");vi.stubEnv("INPUT_JOB-NAME","real-value");expect(getActionInput("JOB_NAME")).toBe("");});

Test improvements

  • Before: 12 tests
  • After: 13 tests (+1)
  • New test covers the whitespace-is-truthy short-circuit behaviour

Validation

  • Formatting: npx prettier --check action_input_utils.cjs action_input_utils.test.cjs
  • Type checking: npx tsc --noEmit
  • Tests: vitest run action_input_utils → 13/13 passed ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • traces.example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
allowed:
- defaults
- "traces.example.com"

See Network Configuration for more information.

Generated by 🧹 jsweep - JavaScript Unbloater · ● 14.9M ·

  • expires on May 18, 2026, 5:01 AM UTC

…t_utils
Add a test case that explicitly documents the truthy-whitespace behaviour:
when INPUT_<NAME> is set to whitespace only, the hyphen form is NOT
consulted because whitespace is truthy in JavaScript and the || chain
short-circuits. After .trim() the result is "", which is the correct
and intentional behaviour.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review May 16, 2026 05:04
CopilotAI review requested due to automatic review settings May 16, 2026 05:04

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a single documentation-style test to action_input_utils.test.cjs capturing the edge case where a whitespace-only INPUT_<NAME> environment variable short-circuits the || fallback chain and yields "" after trimming.

Changes:

  • Adds one new test verifying that whitespace-only underscore-form input does not fall back to the hyphen form.
Show a summary per file
FileDescription
actions/setup/js/action_input_utils.test.cjsNew test documenting the truthy-whitespace short-circuit behavior of getActionInput.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@pelikhan
pelikhan merged commit 9acbecc into mainMay 16, 2026
27 checks passed

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 2.6M

@github-actions

Copy link
Copy Markdown
ContributorAuthor

🧪 Test Quality Sentinel Report

Test Quality Score: 90/100

Excellent test quality

MetricValue
New/modified tests analyzed1
✅ Design tests (behavioral contracts)1 (100%)
⚠️ Implementation tests (low value)0 (0%)
Tests with error/edge cases1 (100%)
Duplicate test clusters0
Test inflation detectedN/A — test-only PR (intentional)
🚨 Coding-guideline violationsNone

Test Classification Details

TestFileClassificationIssues Detected
does not fall back to hyphen form when underscore form is whitespace-onlyactions/setup/js/action_input_utils.test.cjs:29✅ DesignNone — solid edge-case coverage

Flagged Tests — Requires Review

No tests flagged. All analyzed tests are behavioral design tests.


Language Support

Tests analyzed:

  • 🟨 JavaScript (*.test.cjs): 1 test (vitest)

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%).

The new test clearly documents a subtle behavioral invariant: when INPUT_JOB_NAME is set to whitespace-only (" "), the || short-circuit prevents the hyphen-form fallback from being consulted — and .trim() yields "". Setting INPUT_JOB-NAME to "real-value" proves the fallback is truly bypassed. This is a valuable regression guard for anyone who might later refactor the || chain into an explicit if and inadvertently change precedence semantics.

📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References:§25953420918

🧪 Test quality analysis by Test Quality Sentinel · ● 6.7M ·

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@pelikhan