Repository navigation
fix: stabilize Windows pacquet install tests - #12410
Conversation
Code Review by Qodo
1.
|
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR replaces the streaming ChangesDeterministic lockfile stream closure via fs/promises
Platform-aware virtual store directory max length alignment
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by QodoFix env lockfile YAML scan to avoid lingering ReadStream handles on Windows WalkthroughsDescription• 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. Diagramgraph 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()"]
High-Level AssessmentThe following are alternative approaches to this PR: 1. Keep ReadStream but harden teardown
2. Read a bounded prefix (readFile) then fall back to streaming
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. File ChangesBug fix (1)
Documentation (1)
|
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
.changeset/slow-windows-lockfile-streams.mdlockfile/fs/src/yamlDocuments.ts
|
Code review by qodo was updated up to the latest commit 511f9a2 |
|
Code review by qodo was updated up to the latest commit cce5f9f |
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit 8b31d52 |
|
Code review by qodo was updated up to the latest commit 58027ff |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Code review by qodo was updated up to the latest commit b629285 |
Fixes the Windows CI regressions from:
Changes:
virtualStoreDirMaxLengthwith pnpm's Windows default.PNPM_CONFIG_VIRTUAL_STORE_DIR_MAX_LENGTH, so currently published pacquet versions do not write mismatched.modules.yamlon Windows.Validation:
pnpm --filter @pnpm/lockfile.fs test test/yamlDocuments.test.tspnpm --filter @pnpm/installing.commands test test/runPacquet.tscargo test -p pacquet-config virtual_store_dir_max_lengthpnpm --filter pnpm run compilePNPM_REGISTRY_MOCK_PORT=7769 NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169" pnpm exec jest test/install/pacquet.tsPNPM_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.tsWritten by an agent (Codex, GPT-5).
Summary by CodeRabbit
virtualStoreDirMaxLengthsupport and forward it through the delegated installer to keep virtual-store layout consistent.virtual_store_dir_max_lengthdocs/comments to reflect platform-specific defaults (Windows vs non-Windows).