Skip to content

fix(core): avoid Yarn Classic Windows tar-extraction bug dropping src/pages/s.tsx - #3486

Merged
hellofanny merged 5 commits into
devfrom
fix/cli-search-page-windows-tar-drop
Sep 29, 2026
Merged

hellofanny merged 5 commits into
devfrom
fix/cli-search-page-windows-tar-drop

Conversation

@hellofanny

@hellofanny hellofanny commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Moves packages/core/src/pages/s.tsx to packages/core/src/pages/s/index.tsx (same /s route, same content — Next.js treats a folder + index.tsx identically to a bare page file), and updates the one hardcoded reference to the old path in @faststore/cli's enableSearchSSR.

Why

Discovered while stabilizing the new Windows CI job in #3450: Build starter was failing deep inside Next.js's TypeScript check with a misleading error:

./src/components/templates/SearchPage/SearchPage.tsx:4:44
Type error: Cannot find module 'src/pages/s' or its corresponding type declarations.

Root-caused by turning the Windows CI runner itself into the repro environment (no local Windows machine available):

  1. Confirmed packages/core/src/pages/s.tsx is a real, legitimate file (the /s search route) — not a truncated path.
  2. Found .faststore/src/pages/s.tsx was missing from the generated storefront on Windows, while every sibling page file (404.tsx, 500.tsx, _app.tsx, index.tsx, login.tsx, pvt/, etc.) copied fine.
  3. Traced it one layer further back: the file is already missing from node_modules/@faststore/core/src/pages/ right after yarn install — i.e. it never survives extraction of the @faststore/core tarball.
  4. Isolated the extractor: extracting the exact same tarball with Windows' native tar.exe keeps the file; yarn install (Yarn Classic 1.22.19) drops it. Same runner, same archive, different outcome — the bug is in Yarn's own extraction implementation on Windows, not in our packing, copying, or TypeScript config.
  5. Verified the fix empirically: renaming the file to s/index.tsx (identical route, different tar-entry shape) survives Yarn's extraction and the full Windows Build starter step passes end to end, including the /s route showing up correctly in the build output.

Testing

  • Added a regression assertion to the existing copyCoreFiles test in packages/cli/src/utils/generate.test.ts asserting src/pages/s/index.tsx exists and the old src/pages/s.tsx path does not.
  • Verified against the real bug on a scratch branch: ran the Windows CI job (CLI + starter (Windows)) before and after this change — failing beforehand with the exact "Cannot find module" error, passing afterward with /s built successfully.
  • Left an inline comment on the new file explaining why it must not be renamed back to a bare s.tsx.

Scope note

This does not fix Yarn Classic's underlying bug (out of our control — it's upstream). It works around it for our own published package so Windows users on Yarn 1.x aren't affected.

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Fixed search page generation so server-side rendering uses the correct nested page location.
    • Improved compatibility with Yarn Classic on Windows by preserving the nested search page structure and preventing a build-time type-check failure during package extraction.
  • Documentation
    • Added an explanation of the required search page structure and its Windows compatibility considerations, noting that the underlying cause has not been confirmed.

…/pages/s.tsx

Yarn Classic 1.x silently drops the `src/pages/s.tsx` tar entry when
extracting @faststore/core on Windows — every other page under
`src/pages/` survives, only this single-character-named file
vanishes before `next build` even starts type-checking. It then
fails deep inside Next.js's TypeScript check with a misleading
"Cannot find module 'src/pages/s'" error, coming from an unrelated
bare import in PageProvider.tsx/SearchPage.tsx/SearchWrapper.tsx.

Confirmed root cause: extracting the exact same @faststore/core
tarball with Windows' own tar.exe keeps the file; yarn install drops
it. The bug is in Yarn's own extraction implementation, not ours.

Move the file to `src/pages/s/index.tsx` (Next.js treats a folder +
index.tsx identically to a bare page file — same /s route, same
content), which changes the tar-entry shape enough to avoid the bug.
Update the one place in @faststore/cli that hardcoded the old path
(enableSearchSSR) and add a regression assertion to the existing
copyCoreFiles test.

The public /s route and its exported types are unchanged; only the
on-disk source path moved.

Co-authored-by: Cursor <[email protected]>
@hellofanny
hellofanny requested a review from a team as a code owner September 11, 2026 18:25
@hellofanny
hellofanny requested review from gabpaladino and lucasfp13 and removed request for a team September 11, 2026 18:25
@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: vtex/faststore/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: 1b336542-98d9-4453-9b8c-b2e04905fb61

📥 Commits

Reviewing files that changed from the base of the PR and between 16d2ca9 and 8cba02c.

📒 Files selected for processing (2)
  • packages/cli/src/utils/generate.test.ts
  • packages/cli/src/utils/generate.ts

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


Walkthrough

The CLI now targets src/pages/s/index.tsx for the search SSR transformation. The copy test checks that this nested page exists and that src/pages/s.tsx does not. A comment records the reported Windows Yarn Classic extraction issue.

Changes

Search page path

Layer / File(s) Summary
Align search page path and coverage
packages/cli/src/utils/generate.ts, packages/cli/src/utils/generate.test.ts, packages/core/src/pages/s/index.tsx
The CLI targets the nested search page. The test checks the copied page path and confirms the legacy path is absent. A comment documents the Windows Yarn Classic extraction issue.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: eduardoformiga

Merge Risk: ⚪ Minimal · up to 8cba0

The search page retains its /s route, and the CLI and copy test use its new location. No actionable merge risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing the Yarn Classic Windows extraction issue that removes src/pages/s.tsx.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@codesandbox-ci

codesandbox-ci Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Lint check on #3486 failed: the regression assertion I added wrapped
across lines when it fits Biome's 80-char width on one line.

Co-authored-by: Cursor <[email protected]>
@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@faststore/api

npm i https://pkg.pr.new/vtex/faststore/@faststore/api@8cba02c

@faststore/cli

npm i https://pkg.pr.new/vtex/faststore/@faststore/cli@8cba02c

@faststore/components

npm i https://pkg.pr.new/vtex/faststore/@faststore/components@8cba02c

@faststore/core

npm i https://pkg.pr.new/vtex/faststore/@faststore/core@8cba02c

@faststore/diagnostics

npm i https://pkg.pr.new/vtex/faststore/@faststore/diagnostics@8cba02c

@faststore/lighthouse

npm i https://pkg.pr.new/vtex/faststore/@faststore/lighthouse@8cba02c

@faststore/sdk

npm i https://pkg.pr.new/vtex/faststore/@faststore/sdk@8cba02c

@faststore/ui

npm i https://pkg.pr.new/vtex/faststore/@faststore/ui@8cba02c

commit: 8cba02c

@hellofanny
hellofanny changed the base branch from dev to chore/ci-windows-spike September 21, 2026 13:15
@hellofanny
hellofanny changed the base branch from chore/ci-windows-spike to dev September 21, 2026 13:18
@dk-pr-review

dk-pr-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

DK Review — Audit Summary

Verdict: ✅ CLEAN

Severity Count
BLOCK 0
RESTRICT 0
SUGGEST 1

Only BLOCK and RESTRICT findings anchored to a changed line are commented inline on the diff. The finding below opens no review thread.

Scenarios evaluated: feature-flags, general-review, quality-ratchet
Scenarios skipped: dependency-governance (no matching files), pipeline-config (no matching files), agent-skills-review (no matching files)


📋 Findings (1)

SUGGEST

  1. [general.broken-references] packages/core/src/pages/s/index.tsx:11 — Comment cites an external GitHub PR link (fix(core): avoid Yarn Classic Windows tar-extraction bug dropping src/pages/s.tsx #3486) as the source of the Windows/Yarn Classic investigation, but its existence and content cannot be verified from the diff.
    → Double-check the PR link resolves to the intended discussion, and consider also linking a tracking issue for the still-unexplained Yarn Classic root cause so the workaround can be revisited if Yarn is upgraded.

DK Review v1.0.0 | To dismiss a finding: reply /dk-review dismiss [reason] under its comment

hellofanny and others added 2 commits September 29, 2026 10:46
The note asserted a mechanism ('changes the tar-entry shape enough to
avoid it') that the investigation did not establish. The controlled
test isolates Yarn's extractor as where the file is lost, but not why
it drops this entry, so state that openly and link the PR holding the
investigation and the before/after Windows CI runs.

Also keep the explanation in one place: the copyCoreFiles regression
guard now points at the page note instead of restating it, so the two
copies cannot drift.

Co-authored-by: Cursor <[email protected]>
@hellofanny
hellofanny merged commit 3cf3e0e into dev Sep 29, 2026
13 of 14 checks passed
@sonar-workflows

Copy link
Copy Markdown

@hellofanny
hellofanny deleted the fix/cli-search-page-windows-tar-drop branch September 29, 2026 14:01
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