Skip to content

Commit 41b1d5b

Browse files
rafaelscostaclaude
andauthored
fix(ci): use require.resolve() instead of require() in smoke_test_exports [#755] (#759)
Issue #755: Node 24 was surfacing ERR_USE_AFTER_CLOSE on readline close in non-TTY GitHub runners. The CLI loads fine — banner ("Installer v5.2.7") prints before the close fires — but the after-close error kills the exit code, making the job report a false positive. The intent of smoke_test_exports is to validate that `bin/aiox.js` is reachable through the package-exports gate, not to execute the wizard. require.resolve() triggers the same gate (ERR_PACKAGE_PATH_NOT_EXPORTED on exports drift) without loading the module, so the readline lifecycle never runs. Closes #755 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d877231 commit 41b1d5b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ jobs:
511511
echo "❌ ${CORE_SPEC} not visible after 90s — cannot run exports smoke"
512512
exit 1
513513
514-
- name: Force require() resolution to trigger exports gate
514+
- name: Force require.resolve() to trigger exports gate
515515
env:
516516
CORE_SPEC: '@aiox-squads/core@${{ needs.build.outputs.version }}'
517517
run: |
@@ -520,13 +520,16 @@ jobs:
520520
cd "${SMOKE_DIR}"
521521
npm init -y >/dev/null 2>&1
522522
npm install "${CORE_SPEC}" 2>&1 | tail -3
523-
# External require() forces Node's package-exports gate. If bin/*
524-
# is not declared in exports, this fails with ERR_PACKAGE_PATH_NOT_EXPORTED.
523+
# External require.resolve() forces Node's package-exports gate. If
524+
# bin/* is not declared in exports, this fails with ERR_PACKAGE_PATH_NOT_EXPORTED.
525+
# Uses resolve() instead of require() to avoid loading the CLI's wizard
526+
# in non-TTY runners (Node 24 surfaced ERR_USE_AFTER_CLOSE on readline
527+
# close in non-interactive contexts — false positive, not exports drift).
525528
# set -o pipefail above ensures node's exit status survives the head pipe.
526-
if node -e "require('@aiox-squads/core/bin/aiox.js')" 2>&1 | head -20; then
527-
echo "✅ require('@aiox-squads/core/bin/aiox.js') succeeds on Node ${{ matrix.node }}"
529+
if node -e "require.resolve('@aiox-squads/core/bin/aiox.js')" 2>&1 | head -20; then
530+
echo "✅ require.resolve('@aiox-squads/core/bin/aiox.js') succeeds on Node ${{ matrix.node }}"
528531
else
529-
echo "❌ REGRESSION: require() blocked by exports field on Node ${{ matrix.node }}"
532+
echo "❌ REGRESSION: require.resolve() blocked by exports field on Node ${{ matrix.node }}"
530533
echo "❌ Issue #734 has returned — check exports field in package.json"
531534
exit 1
532535
fi

0 commit comments

Comments
 (0)