fix(scripts): scanGlob — захист від Bun.Glob#scan(), що повертає Promise на self-hosted Linux Bun 1.3.14 - #203
Merged
Conversation
…ise на self-hosted Linux Bun 1.3.14
На self-hosted Linux Bun 1.3.14 `Bun.Glob#scan()` повертає Promise<AsyncIterable>
замість async-iterable напряму (як на macOS) — `yield*` на Promise падає з
"is not async iterable", бо в Promise немає ні Symbol.asyncIterator, ні
Symbol.iterator. Через це changelog/consistency (scope: full, завжди активний)
валив увесь lint --path/--full прогін у per-service CI-пайплайнах.
Додано resolveGlobScan(), що розрізняє обидві форми повернення, і опційна
ін'єкція { bun } у scanGlob для прямого юніт-тестування обох гілок без
мутації globalThis.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…istency-bun-linux-2b8b98 # Conflicts: # .cspell.json
3 tasks
vitaliytv
added a commit
that referenced
this pull request
Jul 27, 2026
…up (#260) 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
changelog/consistency(always-active,scope: full) threw an unhandled exception on every per-service CI pipeline running on self-hosted Linux Bun 1.3.14:detector changelog/consistency: lint() кинув: yield* ... is not async iterable. Not reproducible locally on macOS ARM.Bun.Glob#scan()on that Linux Bun build returnsPromise<AsyncIterable>instead of an async-iterable directly (as it does on macOS).yield*on a bare Promise throws, sincePromisehas neitherSymbol.asyncIteratornorSymbol.iterator.npm/scripts/utils/glob-compat.mjs): addedresolveGlobScan(), which awaits the scan result only if it's thenable, then passes it toscanGlob'syield*.scanGlobalso gained an optional{ bun }injection point so both return shapes are directly unit-testable without mutatingglobalThis(repo lint forbids that).Bun.Glob#scan()shapes plus the existing Node fallback (node:fs/promises#glob) andhasIgnoredPathSegment.Test plan
npx vitest run npm/scripts/utils/tests/glob-compat.test.mjs— 8/8 passing, covers bothBun.Glob#scan()return shapes and the Node fallbacknpx @7n/rules lint— exit 0, 0 violations across all 23 concernsbun x n-rules lint --path <module> --no-fixno longer throws (could not reproduce locally on macOS ARM, per the original report)🤖 Generated with Claude Code