Skip to content

Commit bf987f7

Browse files
committed
feat(caching): fix CAS pollution and enforce local extraction for -P installations
1 parent 78aff4e commit bf987f7

5 files changed

Lines changed: 16 additions & 8 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ simulation/
8787
/xfpm
8888
dist/
8989
tmp/
90-
pl.sh
90+
pl.sh
91+
current-notes.md

internal/core/installer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,12 @@ func (i *Installer) ensureExtracted(ctx context.Context, pkg *ResolvedPackage, t
294294
pkgVStoreName := strings.ReplaceAll(pkg.Name, "/", "+") + "@" + pkg.Version
295295
pkgDir := filepath.Join(targetVStore, pkgVStoreName, "node_modules", pkg.Name)
296296

297+
if pkg.LocalPath != "" { return i.extractLocal(pkg, targetVStore) }
298+
297299
if !i.Force {
298300
if _, err := os.Stat(filepath.Join(pkgDir, "package.json")); err == nil { return nil }
299301
}
300302

301-
if pkg.LocalPath != "" { return i.extractLocal(pkg, targetVStore) }
302303

303304
// [OPTIM] Check Global CAS first before network download
304305
if !i.Force && i.cas.HasIndex(pkg.Name, pkg.Version) {
@@ -807,7 +808,7 @@ func (i *Installer) extractLocal(pkg *ResolvedPackage, targetVStore string) erro
807808
fileMap["package/"+relPath] = hash
808809
return nil
809810
})
810-
i.cas.StoreIndex(pkg.Name, pkg.Version, fileMap)
811+
// i.cas.StoreIndex(pkg.Name, pkg.Version, fileMap) // DO NOT cache index for local installs to prevent poisoning NPM cache
811812
i.LinkFilesToDir(pkgDir, fileMap)
812813
i.changedPackages.Store(pkg.Name+"@"+pkg.Version, true)
813814

@@ -1047,7 +1048,7 @@ func (i *Installer) VerifySignatureInternal(sigPath string, pkg *ResolvedPackage
10471048
pluginCfg["permissions"] = permCfg
10481049
}
10491050

1050-
internal[pkg.Name] = pluginCfg
1051+
internal[pkg.Name] = pluginCfg
10511052
config["$internal"] = internal
10521053

10531054
if out, err := json.MarshalIndent(config, "", " "); err == nil {

internal/utils/lib_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package utils
22

3-
const BinVersion = "vG0.1.221"
3+
const BinVersion = "vG0.1.222"

release-note.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [G0.1.222] - 2026-06-09
2+
3+
### Caching & Local Installation Fix
4+
- **CAS Pollution Prevention**: Fixed a critical caching issue where installing packages via local path (`xfpm install -P`) would incorrectly cache the source files in the global Content Addressable Storage (CAS) index. This previously caused subsequent normal `npm` installations of the same version to fetch stale local files instead of downloading the fresh registry tarball.
5+
- **Forced Local Extraction**: Modified `ensureExtracted` to completely bypass the `package.json` cache check when `-P` is supplied. Local paths will now forcefully extract and link their current source files every time, guaranteeing the latest code is reflected without manual cache clearing.
6+
17
## [G0.1.221] - 2026-06-08
28

39
### Engine Upgrades

version.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "XFPM (XyPriss Package Manager)",
33
"description": "The ultra-fast package manager for the XyPriss ecosystem.",
44
"warning": "CRITICAL: Public modifications to this file are strictly forbidden. Internal Nehonix metadata ONLY.",
5-
"latest": "vG0.1.221",
6-
"message": "Features: Integrated XRU v0.2.8 with full `--name` argument support and hardened `#IF` evaluation logic.",
5+
"latest": "vG0.1.222",
6+
"message": "Features: Fixed global CAS cache pollution during local `-P` installations by forcing local package extractions.",
77
"metadata": {
8-
"releaseDate": "2026-06-08",
8+
"releaseDate": "2026-06-09",
99
"channel": "stable"
1010
}
1111
}

0 commit comments

Comments
 (0)