Skip to content

fix(sv): caching bugs - #1313

Open
sacrosanctic wants to merge 4 commits into
sveltejs:version-1from
sacrosanctic:addon-cache
Open

fix(sv): caching bugs#1313
sacrosanctic wants to merge 4 commits into
sveltejs:version-1from
sacrosanctic:addon-cache

Conversation

@sacrosanctic

@sacrosanctic sacrosanctic commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Closes #1312

Description

Does not address the concurrency issue.

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

Summary by CodeRabbit

  • Bug Fixes
    • Improved add-on installation so local and npm packages use a consistent destination.
    • Existing destinations are now replaced cleanly before installation.
    • Local packages continue to use symlinks, with a fallback for Windows permission errors.
    • npm packages are downloaded and unpacked correctly before being added.
    • Prevented stale local links from affecting package installation.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 2, 2026

Copy link
Copy Markdown

Install the latest version of sv from e03fddb:

pnx https://pkg.svelte.dev/sv/c/e03fddb3322aa745e1636bce26f1d5823da1d295 create

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/cli/pr/1313

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e03fddb

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7bfafaa2-fa24-4c62-a060-fe6e2edcde69

📥 Commits

Reviewing files that changed from the base of the PR and between 08b3fc3 and e03fddb.

📒 Files selected for processing (2)
  • packages/sv/src/core/fetch-packages.ts
  • packages/sv/src/core/tests/fetch-packages.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The addon downloader now resolves node_modules from the package manifest, removes stale destinations, and installs local and npm addons through one path. Tests cover downloading over an existing symlink without modifying its target.

Changes

Addon installation

Layer / File(s) Summary
Resolve and install addons
packages/sv/src/core/fetch-packages.ts
The downloader derives its installation root from the nearest package manifest, removes existing destinations, preserves local symlink creation with a Windows copy fallback, and unpacks npm packages into the shared destination.
Validate downloaded addon replacement
packages/sv/src/core/tests/fetch-packages.ts
Tests mock a compressed package response and verify that extraction replaces a directory symlink without modifying the symlink target.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to e03fd

The change replaces installed add-ons by deleting the current version before the new version is ready. A failed or concurrent installation can leave an add-on missing, incomplete, or stale, which can break commands or execute an older version; this should be addressed or explicitly accepted before merge.

Suggested reviewers: adriangonz97

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes address the incorrect package path, stale destination, stale symlink, and local/npm package collision described in issue #1312. The PR objectives explicitly state that concurrent-run handl… Implement synchronization or per-run isolated destinations to prevent concurrent runs from deleting or overwriting each other's add-on data, or update the linked issue scope to exclude concurrency handling.
✅ 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 identifies the package and the primary caching-bug fix.
Out of Scope Changes check ✅ Passed The changes are limited to add-on package resolution, installation, cleanup, and related tests. These changes directly support the caching objectives in issue #1312.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Full details: Linked Issues check

Explanation

The changes address the incorrect package path, stale destination, stale symlink, and local/npm package collision described in issue #1312. The PR objectives explicitly state that concurrent-run handling is not addressed, so full compliance with the issue's concurrency concern cannot be confirmed.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@sacrosanctic sacrosanctic changed the title failing test fix(sv): caching bugs Sep 2, 2026
@sacrosanctic
sacrosanctic marked this pull request as ready for review September 2, 2026 16:24
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.

Community add-on caching bugs

1 participant