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).
29 lines
923 B
Go
29 lines
923 B
Go
//go:build windows
|
|
|
|
package upgrade
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"syscall"
|
|
)
|
|
|
|
func skillPathFileIncarnation(info os.FileInfo) string {
|
|
stat, ok := info.Sys().(*syscall.Win32FileAttributeData)
|
|
if !ok {
|
|
return fmt.Sprintf("unknown:%T", info.Sys())
|
|
}
|
|
return fmt.Sprintf("%d:%d", stat.CreationTime.HighDateTime, stat.CreationTime.LowDateTime)
|
|
}
|
|
|
|
func skillPathSameFileIdentity(_, _ os.FileInfo) bool {
|
|
// MoveFile can surface different metadata identities for the same reparse
|
|
// point before and after rename, so Windows ownership relies on the
|
|
// separately checked creation-time incarnation plus the lexical fingerprint.
|
|
// That pair is strong evidence but not proof: NTFS file tunneling restores
|
|
// the original creation time when a same-named object is recreated in the
|
|
// same directory shortly afterwards, so a byte-identical concurrent
|
|
// replacement can still be attributed to this transaction.
|
|
return true
|
|
}
|