fix(skills): make obsolete-copy retirement non-fatal and harden install

A universal Agent whose obsolete private copy cannot be retired installs
nothing there, yet every entry point counted that retirement failure as an
install failure — aborting `npm install`, `dws skill setup`, and the shell
installers even when the canonical store and all links published correctly,
and skipping the skills-state write. Route retirement failures to a separate
warning path across all surfaces (Go upgrade + skill setup, npm, PowerShell,
install.sh, install-skills.sh, install-event.sh, install-devapp.sh).

Also:
- Add a checked-rename fallback for filesystems that reject the atomic
  no-replace flag (NFS, FUSE, overlayfs); the no-clobber contract is kept and
  the previously unsupported platforms build and work.
- PowerShell multi-mode links only bundle skills, never the shared canonical
  store, so third-party/user skills are no longer fanned into every Agent root.
- Prune ~/.dws/skill-backups to the newest 5 on every surface; encode
  HOME-relative backup names on PowerShell to preserve origin.
- Add simulated-win32 junction coverage and rewrite the tautological
  no-replace test; remove dead code whose tests gave false coverage.
- Soften the overstated Windows ownership-proof comment (NTFS tunneling).
This commit is contained in:
玉澜 committed 2026-08-15 14:26:11 +08:00
1 parent 24bbdda423
commit 7581955892
27 files changed
+1266 -319

No files matched your search

+15 -2
View File
@@ -424,8 +424,21 @@ func TestCrossPlatformCoverageUpgradeAgentBranchFailures(t *testing.T) {
return origRename(src, dst)
})
result, err := UpgradeSkillLocations(makeSource(t))
if err != nil || len(result.Failed()) != 1 {
t.Fatalf("retire failure = %#v, %v", result, err)
if err != nil {
t.Fatalf("retire failure must not fail the upgrade: %v", err)
}
if len(result.Failed()) != 0 {
t.Fatalf("retire failure must not count as an install failure: %#v", result.Failed())
}
warnings := result.RetireWarnings()
if len(warnings) != 1 || warnings[0].Err == nil {
t.Fatalf("retire warnings = %#v", warnings)
}
if len(result.Succeeded()) == 0 {
t.Fatalf("canonical must still be published: %#v", result)
}
if _, statErr := os.Lstat(victim); statErr != nil {
t.Fatalf("unretired copy must be preserved: %v", statErr)
}
})