mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
fix(torch): handle self-copy update paths and record bitvid context note
This commit is contained in:
1 parent
75632cb780
commit
b5d8caa280
2 files changed
+28
-2
No files matched your search
@@ -16,3 +16,19 @@
|
||||
## Operational note
|
||||
- In this repo, when `torch-lock update` is run with `--prefix torch`, path resolution can collide on `torch/src`.
|
||||
- If that occurs, running the updater from repo root is a reliable fallback.
|
||||
|
||||
## Resolution Applied - 2026-02-26
|
||||
- Implemented same-path guards in `torch/src/ops.mjs`:
|
||||
- `copyDir(src, dest)` now skips when `path.resolve(src) === path.resolve(dest)`.
|
||||
- `copyFile(src, dest, ...)` now skips no-op self-copy operations for identical resolved paths.
|
||||
- This aligns with upstream TORCH fix notes for self-hosted installs where package root equals install target.
|
||||
|
||||
## Validation After Fix
|
||||
- `npx --prefix torch --no-install torch-lock update --force` now succeeds (no `src and dest cannot be the same` error).
|
||||
- Update created backup: `torch/_backups/backup_2026-02-26T13-45-30-661Z`.
|
||||
- `npx --prefix torch --no-install torch-lock doctor` reports: `7 passed, 0 warned, 0 failed`.
|
||||
|
||||
## Operator Context Note (Adam)
|
||||
- `bitvid` is a different project Adam is working on.
|
||||
- If a prompt context references `bitvid` instead of `SeedPass`, treat it as a likely working-directory mismatch.
|
||||
- In that case, ask Adam to confirm whether the active directory/repo is correct before making changes.
|
||||
+12
-2
@@ -85,9 +85,15 @@ function getPaths(root, installDirName) {
|
||||
* @param {string} dest - Destination directory path.
|
||||
*/
|
||||
function copyDir(src, dest) {
|
||||
if (fs.existsSync(src)) {
|
||||
fs.cpSync(src, dest, { recursive: true });
|
||||
if (!fs.existsSync(src)) return false;
|
||||
|
||||
// Guard self-hosted installs where source and target resolve to the same path.
|
||||
if (path.resolve(src) === path.resolve(dest)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fs.cpSync(src, dest, { recursive: true });
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,6 +132,10 @@ function transformContent(content, installDirName) {
|
||||
* @returns {boolean} - True if copied/overwritten, false if skipped or source missing.
|
||||
*/
|
||||
function copyFile(src, dest, transform = false, overwrite = true, installDirName = 'torch') {
|
||||
if (path.resolve(src) === path.resolve(dest)) {
|
||||
return false; // Skip no-op self-copy
|
||||
}
|
||||
|
||||
if (fs.existsSync(dest) && !overwrite) {
|
||||
return false; // Skipped
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user