Skip to content

fix: stabilize Windows pacquet install tests - #12410

Merged
zkochan merged 6 commits into
mainfrom
fix-win-node26-lockfile-read
Jun 14, 2026
Merged

zkochan merged 6 commits into
mainfrom
fix-win-node26-lockfile-read

Conversation

@zkochan

@zkochan zkochan commented Jun 14, 2026 •

Copy link
Copy Markdown
Member

Fixes the Windows CI regressions from:

Changes:

  • Replace lockfile env-document stream scanning with a FileHandle read loop that closes deterministically, including split-BOM handling.
  • Align pacquet's default virtualStoreDirMaxLength with pnpm's Windows default.
  • Forward pnpm's effective virtual store max length to delegated pacquet installs through PNPM_CONFIG_VIRTUAL_STORE_DIR_MAX_LENGTH, so currently published pacquet versions do not write mismatched .modules.yaml on Windows.

Validation:

  • pnpm --filter @pnpm/lockfile.fs test test/yamlDocuments.test.ts
  • pnpm --filter @pnpm/installing.commands test test/runPacquet.ts
  • cargo test -p pacquet-config virtual_store_dir_max_length
  • pnpm --filter pnpm run compile
  • PNPM_REGISTRY_MOCK_PORT=7769 NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169" pnpm exec jest test/install/pacquet.ts
  • PNPM_REGISTRY_MOCK_PORT=7769 NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169" pnpm exec jest test/install/dedupe.ts -t "uses the lockfile written by pacquet for post-install checks"
  • PNPM_REGISTRY_MOCK_PORT=7769 NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169" pnpm exec jest test/install/deepRecursive.ts
  • pre-push checks, including TS compile/lint/meta/spellcheck and Rust fmt/clippy/doc/dylint/taplo when pacquet files changed

Written by an agent (Codex, GPT-5).

Summary by CodeRabbit

  • Bug Fixes
    • Ensure lockfile read streams are deterministically closed before lockfiles are rewritten for improved stability.
    • Improve “first YAML document” reading, including BOM/UTF-8 chunk handling, CRLF-to-LF normalization, and correct separator detection.
  • New Features
    • Add virtualStoreDirMaxLength support and forward it through the delegated installer to keep virtual-store layout consistent.
  • Documentation
    • Update virtual_store_dir_max_length docs/comments to reflect platform-specific defaults (Windows vs non-Windows).
  • Tests
    • Add Jest coverage for split BOM/CRLF and invalid buffer-size fallback; update platform-default config assertions and related expectations.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0)

Grey Divider


Remediation recommended

1. Unvalidated buffer size ✓ Resolved 🐞 Bug ≡ Correctness
Description
streamReadFirstYamlDocument(filePath, readBufferSize) passes readBufferSize directly to
Buffer.allocUnsafe(), so a caller-provided 0 can make the read loop exit immediately and return
null for a valid env-prefixed lockfile, and negative/NaN can throw. In rewrite paths that treat
null as “no env doc”, this can drop the env document prefix if this helper is ever called with an
invalid size.
Code

lockfile/fs/src/yamlDocuments.ts[R18-29]

+export async function streamReadFirstYamlDocument (filePath: string, readBufferSize = READ_BUFFER_SIZE): Promise<string | null> {
+  let fileHandle: FileHandle | undefined
let buffer = ''
+  let firstChunk = true
try {
-    // Phase 1: verify the file starts with "---\n"
-
-    for (let chunk = await chunks.next(); !chunk.done; chunk = await chunks.next()) { // eslint-disable-line no-await-in-loop
-      if (buffer.length === 0) {
-        // Strip BOM from the first chunk. Safe because the stream uses utf8 encoding,
-        // so the 3-byte BOM is decoded into a single \uFEFF character in the first chunk.
-        buffer = stripBom(chunk.value as string)
-      } else {
-        buffer += chunk.value
+    fileHandle = await open(filePath, 'r')
+    const decoder = new StringDecoder('utf8')
+    const readBuffer = Buffer.allocUnsafe(readBufferSize)
+    let position = 0
+    while (true) {
+      const { bytesRead } = await fileHandle.read(readBuffer, 0, readBuffer.length, position) // eslint-disable-line no-await-in-loop
+      if (bytesRead === 0) break
Evidence
The function’s new parameter is used directly for unsafe buffer allocation and to drive the read
loop; an empty buffer causes the loop to break without reading file content. Downstream, lockfile
rewrite code omits the env prefix when streamReadFirstYamlDocument returns null, so an
early-null result would drop the env document in rewritten lockfiles if an invalid size is passed.

lockfile/fs/src/yamlDocuments.ts[18-55]
lockfile/fs/src/write.ts[72-83]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`streamReadFirstYamlDocument()` accepts a caller-provided `readBufferSize` and uses it directly for `Buffer.allocUnsafe(readBufferSize)` and as the length for `fileHandle.read(...)`. If `readBufferSize` is `0`, the function will immediately see `bytesRead === 0` and return `null` even when the file contains a valid env YAML document; if it’s negative/NaN/non-integer, Node can throw a `RangeError`.
### Issue Context
Most internal call sites use the default buffer size, but this function is exported and already has tests that pass a custom size; it’s easy for future callers (or refactors) to accidentally pass `0`/invalid values.
### Fix Focus Areas
- lockfile/fs/src/yamlDocuments.ts[18-29]
### Suggested fix
Normalize `readBufferSize` before allocating/reading, e.g.:
- coerce to an integer (`Math.floor`)
- require `>= 1`
- fall back to `READ_BUFFER_SIZE` when invalid
Example:

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. CRLF split mis-detected ✓ Resolved 🐞 Bug ≡ Correctness
Description
streamReadFirstYamlDocument() can return null for a valid env lockfile whose first line is
---\r\n if the first read ends at ---\r (before the \n arrives), because it validates the
---\n prefix too early. When this happens, lockfile rewrites that rely on this function will drop
the env document prefix instead of preserving it.
Code

lockfile/fs/src/yamlDocuments.ts[R38-43]

+      buffer += chunk
// Normalize CRLF (Windows) to LF so document separator detection works.
buffer = buffer.replace(/\r\n/g, '\n')
-      if (buffer.length >= YAML_DOCUMENT_START.length) break
-    }
-    if (!buffer.startsWith(YAML_DOCUMENT_START)) {
-      await closeStream(stream)
-      return null
-    }
-    // Phase 2: find the second "---" separator
-    let firstDocument: string | undefined
-    while (true) {
+      if (buffer.length >= YAML_DOCUMENT_START.length && !buffer.startsWith(YAML_DOCUMENT_START)) {
+        return null
+      }
Evidence
The function validates the ---\n header as soon as the buffer reaches 4 characters, but CRLF
normalization only replaces full \r\n pairs; when a read ends on a lone \r, the header check
fails and returns null. writeLockfile() explicitly uses this function to preserve the env
document prefix, so a false null drops that prefix during rewrites; existing tests already cover
CRLF but do not cover the read-boundary split case.

lockfile/fs/src/yamlDocuments.ts[18-47]
lockfile/fs/src/write.ts[72-81]
lockfile/fs/test/yamlDocuments.test.ts[89-97]
lockfile/fs/test/yamlDocuments.test.ts[64-70]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`streamReadFirstYamlDocument()` normalizes CRLF via `buffer.replace(/\r\n/g, '\n')` but then immediately rejects the file if `buffer.length >= 4` and it doesn’t start with `---\n`. If the file begins with `---\r\n` and the read boundary splits between `\r` and `\n` (e.g. with a small read buffer, or an unusually short first read), the buffer becomes `---\r` and the function returns `null` even though the next byte would complete a valid header.
## Issue Context
This helper is used during lockfile writes to preserve the existing env document prefix; a false `null` causes the env doc to be dropped.
## Fix Focus Areas
- lockfile/fs/src/yamlDocuments.ts[18-47]
- lockfile/fs/test/yamlDocuments.test.ts[89-106]
- lockfile/fs/src/write.ts[72-81]
## Suggested fix
- Don’t perform the `startsWith('---\n')` rejection until you have enough bytes to rule out a partial CRLF header.
- Minimal approach: if `buffer.length === YAML_DOCUMENT_START.length` and `buffer === '---\r'`, continue reading instead of returning `null`.
- More robust approach: explicitly accept `---\r\n` as a valid start when checking the prefix (or delay the check until `buffer` contains either `\n` or at least one non-`\r` character after the leading `---`).
- Add a regression test that forces the split:
- Write content starting with `---\r\n...` and call `streamReadFirstYamlDocument(filePath, 4)`; assert it returns the first document rather than `null`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. BOM stripping edge-case ✓ Resolved 🐞 Bug ≡ Correctness
Description
streamReadFirstYamlDocument strips the BOM only from the first decoded chunk and sets
firstChunk=false even if that decoded chunk is empty, so a BOM emitted on a subsequent
decoder.write() can make the buffer start with \uFEFF and incorrectly return null. This can cause
env lockfile documents to be ignored and dropped during pnpm-lock.yaml rewrites that rely on this
function to preserve the env prefix.
Code

lockfile/fs/src/yamlDocuments.ts[R21-47]

+  let firstChunk = true
try {
-    // Phase 1: verify the file starts with "---\n"
-
-    for (let chunk = await chunks.next(); !chunk.done; chunk = await chunks.next()) { // eslint-disable-line no-await-in-loop
-      if (buffer.length === 0) {
-        // Strip BOM from the first chunk. Safe because the stream uses utf8 encoding,
-        // so the 3-byte BOM is decoded into a single \uFEFF character in the first chunk.
-        buffer = stripBom(chunk.value as string)
-      } else {
-        buffer += chunk.value
+    fileHandle = await open(filePath, 'r')
+    const decoder = new StringDecoder('utf8')
+    const readBuffer = Buffer.allocUnsafe(READ_BUFFER_SIZE)
+    let position = 0
+    while (true) {
+      const { bytesRead } = await fileHandle.read(readBuffer, 0, readBuffer.length, position) // eslint-disable-line no-await-in-loop
+      if (bytesRead === 0) break
+      position += bytesRead
+      let chunk = decoder.write(readBuffer.subarray(0, bytesRead))
+      if (firstChunk) {
+        // Strip BOM from the first chunk. Safe because the decoder uses utf8,
+        // so the 3-byte BOM is decoded into a single \uFEFF character.
+        chunk = stripBom(chunk)
+        firstChunk = false
}
+      buffer += chunk
// Normalize CRLF (Windows) to LF so document separator detection works.
buffer = buffer.replace(/\r\n/g, '\n')
-      if (buffer.length >= YAML_DOCUMENT_START.length) break
-    }
-    if (!buffer.startsWith(YAML_DOCUMENT_START)) {
-      await closeStream(stream)
-      return null
-    }
-    // Phase 2: find the second "---" separator
-    let firstDocument: string | undefined
-    while (true) {
+      if (buffer.length >= YAML_DOCUMENT_START.length && !buffer.startsWith(YAML_DOCUMENT_START)) {
+        return null
+      }
const sep = buffer.indexOf(YAML_DOCUMENT_SEPARATOR, YAML_DOCUMENT_START.length)
if (sep !== -1) {
-        firstDocument = buffer.slice(YAML_DOCUMENT_START.length, sep)
-        break
+        return buffer.slice(YAML_DOCUMENT_START.length, sep)
}
-      const chunk = await chunks.next() // eslint-disable-line no-await-in-loop
-      if (chunk.done) break
-      // Normalize CRLF (Windows) to LF so the separator search matches on Windows-checked-out files.
-      buffer = (buffer + chunk.value).replace(/\r\n/g, '\n')
Evidence
The new implementation only strips BOM from the first decoder output (not the first non-empty
decoded output) and then rejects the file if it doesn’t start with YAML_DOCUMENT_START; callers will
drop the env prefix when null is returned. Other lockfile readers in this repo strip the BOM from
the full string, indicating BOM handling is expected to be robust.

lockfile/fs/src/yamlDocuments.ts[18-47]
lockfile/fs/src/write.ts[72-83]
lockfile/fs/src/read.ts[87-91]
lockfile/fs/src/read.ts[113-128]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`streamReadFirstYamlDocument()` only calls `stripBom()` on the first decoded chunk and immediately flips `firstChunk = false`. If the first `StringDecoder.write()` yields an empty string (e.g., because it buffered an incomplete multibyte sequence), a subsequent `write()` can start with the BOM character `\uFEFF`, causing the `startsWith('---\n')` check to fail and returning `null`.
This is user-visible because callers use `streamReadFirstYamlDocument()` to preserve the env-document prefix when rewriting `pnpm-lock.yaml`; a false `null` drops that prefix.
### Issue Context
Keep the deterministic FileHandle loop, but make BOM stripping apply to the first *actual decoded output* (or apply `stripBom()` to the accumulated buffer until the first non-empty data is seen).
### Fix Focus Areas
- lockfile/fs/src/yamlDocuments.ts[21-54]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Close masks original error ✓ Resolved 🐞 Bug ☼ Reliability
Description
streamReadFirstYamlDocument awaits fileHandle.close() in a finally block without swallowing close
failures, so a close() rejection can override the original read/decode error and change the surfaced
failure. This reduces debuggability and can produce misleading errors on filesystem edge cases.
Code

lockfile/fs/src/yamlDocuments.ts[R60-62]

+  } finally {
+    await fileHandle?.close()
}
-  await closeStream(stream)
-  return null
-}
-
-async function closeStream (stream: ReadStream): Promise<void> {
-  if (stream.closed) return
-  await new Promise<void>((resolve) => {
-    stream.once('close', resolve)
-    stream.destroy()
-  })
Evidence
The new code awaits close() directly in finally. A nearby pattern in the repo explicitly swallows
close errors, showing precedent for best-effort cleanup to avoid masking the primary error.

lockfile/fs/src/yamlDocuments.ts[55-62]
bins/linker/src/index.ts[391-402]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`await fileHandle?.close()` is executed in `finally` without a guard. If `close()` rejects, it can mask the original exception thrown in the `try` block.
### Issue Context
Elsewhere in the repo, file-handle close failures are treated as best-effort cleanup (close errors are swallowed).
### Fix Focus Areas
- lockfile/fs/src/yamlDocuments.ts[60-62]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR replaces the streaming createReadStream approach in lockfile/fs/src/yamlDocuments.ts with node:fs/promises open() and a manual fileHandle.read() buffer loop, ensuring deterministic file handle closure in finally before lockfile rewrite. In parallel, it introduces platform-aware virtualStoreDirMaxLength configuration throughout the stack: TypeScript types and forwarding pass the setting via the PNPM_CONFIG_VIRTUAL_STORE_DIR_MAX_LENGTH environment variable to spawned pacquet processes, while Rust config defaults and documentation align pacquet with pnpm's platform-dependent defaults (60 on Windows, 120 elsewhere).

Changes

Deterministic lockfile stream closure via fs/promises

Layer / File(s) Summary
fs/promises buffered read loop replacing createReadStream
lockfile/fs/src/yamlDocuments.ts, .changeset/slow-windows-lockfile-streams.md, lockfile/fs/test/yamlDocuments.test.ts
Imports switched to node:fs/promises with READ_BUFFER_SIZE constant added; streamReadFirstYamlDocument opens a file handle and reads in a buffer loop with StringDecoder, preserving BOM stripping, CRLF normalization, ---\n validation, and second-separator truncation. New helpers canRejectDocumentStart and normalizeReadBufferSize enable early validation and buffer size coercion. ENOENT returns null in catch; fileHandle.close() in finally replaces the old stream teardown. Changeset note updated to describe deterministic closure before lockfile rewrite. Test cases added for BOM and CRLF handling across split reads and invalid buffer size fallback.

Platform-aware virtual store directory max length alignment

Layer / File(s) Summary
TypeScript types and contracts for virtualStoreDirMaxLength
installing/commands/src/installDeps.ts, installing/commands/src/runPacquet.ts
InstallDepsOptions extends its Config picks to include virtualStoreDirMaxLength; MakeRunPacquetOpts gains a new virtualStoreDirMaxLength field documented as an effective pnpm config value forwarded via PNPM_CONFIG_* environment variables for consistent pacquet outputs.
TypeScript pacquet environment handling and forwarding
installing/commands/src/runPacquet.ts, installing/commands/src/installDeps.ts, installing/commands/test/runPacquet.ts
New makePacquetEnv helper clones process.env, removes any existing pnpm_config_virtual_store_dir_max_length variant (case-insensitive), sets PNPM_CONFIG_VIRTUAL_STORE_DIR_MAX_LENGTH from options, and returns the computed environment; spawn call now passes explicit env object. installDeps forwards opts.virtualStoreDirMaxLength to makeRunPacquet; test helper makeEngine passes platform-dependent virtualStoreDirMaxLength (60 on Windows, 120 otherwise). Minor comment adjustment on forwarded-flag behavior.
Rust config defaults and documentation for platform-aware max length
pacquet/crates/config/src/defaults.rs, pacquet/crates/config/src/lib.rs, pacquet/crates/package-manager/src/virtual_store_layout.rs
default_virtual_store_dir_max_length now returns platform-aware values: 60 on Windows, 120 otherwise, replacing the fixed 120 default. Config field documentation and VirtualStoreLayout comment updated to describe this platform-dependent default, referencing pnpm's aligned behavior.
Rust test updates for platform-aware defaults
pacquet/crates/config/src/tests.rs
virtual_store_dir_max_length config test renamed from virtual_store_dir_max_length_defaults_to_120() to virtual_store_dir_max_length_matches_pnpm_default() and refactored to assert platform-aware defaults: expects 60 on Windows and 120 otherwise, aligning with pnpm's default behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pnpm/pnpm#12408: Both PRs modify lockfile/fs/src/yamlDocuments.ts and the lockfile changeset to address deterministic closure of YAML lockfile reads before lockfile rewrite.
  • pnpm/pnpm#11734: Both PRs extend installing/commands/src/runPacquet.ts to forward additional configuration to pacquet via environment variables.
  • pnpm/pnpm#11904: The platform-aware virtual_store_dir_max_length feeds into frozen-install no-op short-circuit checks that compare virtual-store paths/length consistency.

Suggested labels

area: lockfile, area: cli/dlx

Suggested reviewers

  • KSXGitHub

🐇 Streams now close with a steady hand,
Two platforms dance in sync and stand.
fs/promises loops where currents flowed,
Sixty here, one-twenty down the road!
Config aligned—the rabbit's blessed abode! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'fix: stabilize Windows pacquet install tests' is vague and does not clearly convey the main changes, which involve lockfile stream handling refactoring, virtual store directory configuration alignment, and environment variable forwarding. Consider a more specific title that highlights the primary change, such as 'fix: align pacquet virtual store defaults with pnpm on Windows' or 'fix: refactor lockfile stream handling for Windows test stability'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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-win-node26-lockfile-read

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.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix env lockfile YAML scan to avoid lingering ReadStream handles on Windows
🐞 Bug fix 📝 Documentation 🕐 20-40 Minutes

Grey Divider

Walkthroughs

Description
• Replace env lockfile YAML document scanning ReadStream with FileHandle read loop.
• Ensure deterministic close to avoid Node 26/Jest force-exit Windows handle issues.
• Refine changeset wording to reflect deterministic lockfile read closure.
Diagram
graph TD
  A["Caller"] --> B["streamReadFirstYamlDocument"] --> C["open() FileHandle"] --> D["read loop + decode"] --> E{"Starts with '---'?"}
  E -- "no" --> F["return null"]
  E -- "yes" --> G{"Found '\n---\n'?"}
  G -- "yes" --> H["return first doc"]
  G -- "no" --> I["decoder.end + normalize"] --> J["return null"]
  B -. "finally" .-> K["FileHandle.close()"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep ReadStream but harden teardown
  • ➕ Leverages built-in backpressure and streaming semantics
  • ➕ Potentially less custom byte/decoder logic
  • ➖ Still risks lingering async handles under force-exit / Jest / Node 26 Windows behavior
  • ➖ Requires careful coordination of destroy/close events and early-return paths
2. Read a bounded prefix (readFile) then fall back to streaming
  • ➕ Very simple for typical small lockfiles
  • ➕ Avoids long-lived handles for most cases
  • ➖ Needs size heuristics and a second code path
  • ➖ Still requires streaming/handle management for large files and early stop behavior

Recommendation: The PR’s approach (manual FileHandle.read loop with a finally close) is the most robust way to guarantee deterministic handle closure across early-return paths and avoid ReadStream-related async handle leakage on Windows/Node 26. Alternatives either keep the risky stream lifecycle or introduce split-path complexity without improving determinism.

Grey Divider

File Changes

Bug fix (1)
yamlDocuments.ts Replace ReadStream YAML scan with FileHandle.read loop and finally-close +32/-41

Replace ReadStream YAML scan with FileHandle.read loop and finally-close

• Replaces createReadStream + async iterator scanning with an explicit FileHandle.read loop using StringDecoder. Preserves BOM stripping and CRLF normalization, returns as soon as the second document separator is found, and always closes the FileHandle in a finally block to avoid lingering async handles.

lockfile/fs/src/yamlDocuments.ts


Documentation (1)
slow-windows-lockfile-streams.md Clarify changeset wording about deterministic lockfile read closure +1/-1

Clarify changeset wording about deterministic lockfile read closure

• Rewords the changeset entry to emphasize deterministic closure of lockfile reads before rewrites, without focusing on early-exited streams.

.changeset/slow-windows-lockfile-streams.md


Grey Divider

Qodo Logo

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lockfile/fs/src/yamlDocuments.ts`:
- Around line 32-37: The `firstChunk = false` assignment at line 36 executes
even when the decoded `chunk` is empty (due to incomplete UTF-8 sequences being
buffered by the decoder), causing the BOM stripping to be skipped on the next
read when the complete bytes arrive. Fix this by guarding the `firstChunk =
false` assignment so it only executes when `chunk` is non-empty, ensuring the
stripBom call processes the complete BOM bytes regardless of how many reads it
takes for the decoder to output the first characters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: adb72d97-80d4-4dbc-a0d2-e37b5d64c832

📥 Commits

Reviewing files that changed from the base of the PR and between d50d691 and 247f988.

📒 Files selected for processing (2)
  • .changeset/slow-windows-lockfile-streams.md
  • lockfile/fs/src/yamlDocuments.ts

Comment thread lockfile/fs/src/yamlDocuments.ts Resolved
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 511f9a2

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit cce5f9f

@zkochan zkochan changed the title fix(lockfile): avoid read stream handles for env document scan fix: stabilize Windows pacquet install tests Jun 14, 2026
@github-actions

github-actions Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      7.4±0.08ms   583.4 KB/sec    1.02      7.6±1.11ms   573.5 KB/sec

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8b31d52

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 58027ff

@codecov-commenter

codecov-commenter commented Jun 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.14%. Comparing base (5f63458) to head (b629285).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12410   +/-   ##
=======================================
  Coverage   88.14%   88.14%           
=======================================
  Files         301      301           
  Lines       39734    39734           
=======================================
  Hits        35024    35024           
  Misses       4710     4710           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jun 14, 2026 •

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit b629285

@zkochan
zkochan merged commit a6d485a into main Jun 14, 2026
26 checks passed
@zkochan
zkochan deleted the fix-win-node26-lockfile-read branch June 14, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants