This repository was archived by the owner on Sep 11, 2026. It is now read-only.
fix(js/eslint): resolve bunx via resolveCmd instead of bare PATH lookup - #260
Merged
Merged
Conversation
Investigation of #203 showed the changelog/consistency crash ("yield* … is not async iterable") correlates with whether the external n-rules script is invoked via `bun x` vs directly, not with OS/Bun version as originally assumed — the Bun.Glob#scan() Promise hypothesis is disproven by 16/16 clean direct calls on the same self-hosted Linux agent. The one concretely fixable half of that report: js/eslint spawned `bunx` by literal name, relying on inherited $PATH — this ENOENTs on self-hosted CI when n-rules is invoked directly (bypassing bun x). Both call sites now resolve bunx via resolveCmd (absolute path), matching the pattern already used everywhere else in this codebase for cargo/uv/shellcheck/etc. Also documents the bun x + patchedDependencies interaction observed during this investigation (bun x does not apply patchedDependencies for local devDependencies) so it doesn't trip up future diagnostics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Investigation of #203 found a much more precise repro than originally assumed: the
changelog/consistency: yield* … is not async iterablecrash correlates with whether the externaln-rulesscript is invoked viabun x <pkg>or directly (bun bin/n-rules.js), not with OS/architecture as the original hypothesis in #203 claimed. 16/16 direct diagnostic calls on the same self-hosted Linux CI agent (Bun.version/revisionunchanged) returned a clean async-iterable fromBun.Glob#scan()— never a Promise — while the same command run throughbun xreproduced the crash 100% of the time. The root cause of whybun xaffects how a nestedBun.Glob#scan()resolves is still unknown/upstream, soglob-compat.mjskeeps its defensive Promise-unwrapping, with comments updated to reflect the corrected hypothesis.The one concretely fixable half of the report is a related-but-distinct bug this session addresses:
js/eslint'srunOxlintJson(main.mjs) andrunLinterFix(fix-eslint.mjs) spawnedbunxby literal name, relying on the inherited$PATH. On the same self-hosted CI, whenn-rulesis invoked directly (bypassingbun x), the nestedspawn('bunx', …)fails withENOENTdespite$HOME/.bun/binbeing on$PATHat the CI-step level — the same class of "behavior depends on how the outer process was invoked" issue.Changes
plugins/lang-js/rules/js/eslint/main.mjs:runOxlintJsonnow resolvesbunxviaresolveCmd(absolute path) instead of the bare string, matching the pattern already used throughout this codebase forcargo/uv/shellcheck/etc. Throws a clear error ifbunxcan't be resolved, instead of a rawENOENT.plugins/lang-js/rules/js/eslint/fix-eslint.mjs: same fix inrunLinterFix; missingbunxdegrades gracefully (skipsoxlint --fix,eslint --fixstill runs).npm/scripts/utils/glob-compat.mjs: updated comments — the "self-hosted Linux Bun 1.3.14" hypothesis is corrected to thebun xvs direct-invocation correlation; documents thatbun x <local-devDependency>does not applypatchedDependencies, discovered while diagnosing this (a temporarybun patchapplied throughbun x n-rulesproduced zero diagnostic output despite being verified to apply correctly tonode_moduleslocally).main.test.mjs/fix-eslint.test.mjs(also fixes a pre-existing coverage gap:fix-eslint.mjsline coverage was 72.7%, now 98.18%)..changes/entries (npm,plugins/lang-js, patch/Fixed).Test plan
bun run --bun vitest run plugins/lang-js/rules/js/eslint npm/scripts/utils/tests/glob-compat.test.mjs— 35/35 passednpx @7n/rules lint(delta) — exit 0 (remainingnpm-module/*findings in output are pre-existing repo debt unrelated to this diff)npx @7n/rules lint doc-files/checkscoped to touched dirs — clean🤖 Generated with Claude Code