Skip to content

fix(ci): use require.resolve() in smoke_test_exports — fixes #755 - #759

Merged
rafaelscosta merged 1 commit into
mainfrom
fix/smoke-test-exports-require-resolve-755
May 18, 2026
Merged

fix(ci): use require.resolve() in smoke_test_exports — fixes #755#759
rafaelscosta merged 1 commit into
mainfrom
fix/smoke-test-exports-require-resolve-755

Conversation

@rafaelscosta

@rafaelscosta rafaelscosta commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replaces node -e "require('@aiox-squads/core/bin/aiox.js')" with require.resolve() in the smoke_test_exports job of .github/workflows/npm-publish.yml. Eliminates a Node 24 false positive (ERR_USE_AFTER_CLOSE on readline close in non-TTY runners) while preserving the original intent of the gate — validating that bin/aiox.js is reachable through the package-exports field.

Why

  • The exports-gate check needs to fail with ERR_PACKAGE_PATH_NOT_EXPORTED if bin/* is not declared in exports — require.resolve() triggers the same check.
  • require() also loads and executes the module, which boots the CLI's readline interface; in non-TTY runners on Node 24 this surfaces ERR_USE_AFTER_CLOSE after the banner already prints, killing the exit code with a misleading error.
  • Observed on the 5.2.7 publish workflow run: smoke_test_exports (Node 24) reported failure even though the banner "Installer v5.2.7" printed correctly. CLI loaded fine — the readline lifecycle in non-interactive context was the culprit, not exports drift.

Test plan

  • Workflow file syntax valid (yamllint or act --list)
  • After merge: trigger a manual run or wait for next publish; confirm smoke_test_exports matrix Node 20/22/24 all pass GREEN
  • Regression guard intact: if anyone breaks the exports field in package.json, ERR_PACKAGE_PATH_NOT_EXPORTED still surfaces (verified by tracing Node's resolution algorithm — require.resolve() follows the same pkg.exports walk as require() up to the load step)

Issue

Closes #755

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated the package export validation process in the CI/CD pipeline to improve reliability of export checking.

Review Change Stack

…orts [#755]

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>
@vercel

vercel Bot commented May 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aiox-core Ready Ready Preview, Comment May 18, 2026 11:20am

Request Review

@github-actions github-actions Bot added area: docs Documentation (docs/) area: devops CI/CD, GitHub Actions (.github/) labels May 18, 2026
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5c4faf08-8f58-4b8c-8ea7-310970582058

📥 Commits

Reviewing files that changed from the base of the PR and between d877231 and 3f2461d.

📒 Files selected for processing (1)
  • .github/workflows/npm-publish.yml

Walkthrough

The npm-publish workflow's exports smoke test is updated to validate the package exports field using require.resolve() instead of require(). This change avoids false-positive failures in non-TTY CI environments on Node 24 where the interactive wizard's readline throws after stdin closes, while still verifying that the exports gate works correctly.

Changes

Exports validation workflow update

Layer / File(s) Summary
Switch exports validation from require() to require.resolve()
.github/workflows/npm-publish.yml
The smoke_test_exports step replaces direct execution of the binary via require() with require.resolve() to check only the exports field without running code. Step name and log messages are updated to reflect the safer validation approach.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • SynkraAI/aiox-core#737: Both PRs modify .github/workflows/npm-publish.yml's smoke_test_exports regression check logic for @aiox-squads/core/bin/aiox.js (main PR switches the validation from require() to require.resolve()).
  • SynkraAI/aiox-core#744: The main PR's change to .github/workflows/npm-publish.yml (switching the smoke_test_exports check for @aiox-squads/core/bin/aiox.js from require(...) to require.resolve(...)) directly overlaps with the retrieved PR's updates to the npm-publish workflow's smoke/export validation logic.
  • SynkraAI/aiox-core#659: Both PRs update the .github/workflows/npm-publish.yml smoke/exports regression checks for published package contents.

Suggested labels

area: workflows, area: devops, type: test

Suggested reviewers

  • Pedrovaleriolopez
  • oalanicolas
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the change: updating the smoke_test_exports job to use require.resolve() instead of require(), and references the fixed issue #755.
Linked Issues check ✅ Passed The PR directly implements the primary objective from issue #755 by switching to require.resolve() to validate package exports without executing the binary, eliminating the Node 24 readline ERR_USE_AFTER_CLOSE false positive while preserving regression detection.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the smoke_test_exports job in the npm-publish workflow; no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/smoke-test-exports-require-resolve-755

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

📊 Coverage Report

Coverage report not available

📈 Full coverage report available in Codecov


Generated by PR Automation (Story 6.1)

@rafaelscosta
rafaelscosta merged commit 41b1d5b into main May 18, 2026
37 checks passed
@rafaelscosta
rafaelscosta deleted the fix/smoke-test-exports-require-resolve-755 branch May 18, 2026 11:24
tuanmedeiros pushed a commit to tuanmedeiros/aios-core-synkraay that referenced this pull request Jun 2, 2026
…orts [SynkraAI#755] (SynkraAI#759)

Issue SynkraAI#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 SynkraAI#755

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: devops CI/CD, GitHub Actions (.github/) area: docs Documentation (docs/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

smoke_test_exports (Node 24) false positive — readline ERR_USE_AFTER_CLOSE in non-TTY

1 participant