Skip to content

feat(lib): make symlinks portable across machines and extraction locations - #620

Open
eduardomourar wants to merge 1 commit into
open-constructs:mainfrom
eduardomourar:feat/lib-symlink-portable-extraction
Open

eduardomourar wants to merge 1 commit into
open-constructs:mainfrom
eduardomourar:feat/lib-symlink-portable-extraction

Conversation

@eduardomourar

Copy link
Copy Markdown
Contributor

Related issue

Fixes #545

Description

  • Add assetSymlinkEscapesRoot error to reject symlinks targeting outside the asset root
  • Implement resolveLinkTarget to normalize symlink targets to root-relative paths, handling Windows junctions and backslash-separated text
  • Implement relativeLinkText to re-express canonical targets relative to the link's directory for portability
  • Update copySync to use the new symlink handling with fallback to junctions on Windows when symlinkSync lacks permissions
  • Update archiveSync to store normalized symlink targets in zip archives
  • Update ASSET_HASH_V2 feature documentation to explain symlink normalization behavior
  • Add asset-junction.test.ts with comprehensive tests for symlink resolution, portability, and edge cases
  • Symlinks now hash identically regardless of checkout location, Windows junction vs symlink representation, or extraction destination

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

@eduardomourar
eduardomourar requested a review from a team as a code owner November 14, 2026 20:26
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.

lib: asset trees containing junctions (pnpm, npm workspaces) break on Windows

1 participant