mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
* fix(install): keep a moved skill's record instead of reinstalling it Install records are keyed by path, so a skill moved with mv shows up as missing. "Install missing" (and bare `skillshare install`) then cloned it again at the old path, leaving two copies that both sync to targets, and reconcile could hand the new copy's record to the moved one. A gone record now follows an unrecorded directory of the same name whose files match the recorded hashes, when exactly one such directory exists. Install-from-config skips such entries and reconcile re-keys the record, so the moved copy keeps its source. Same-name skills with other files are left alone, so an update can never overwrite them from that source. Refs: #510 * fix(install): keep audit acceptances and unreadable links out of moves Re-keying a moved skill went through Remove, which also drops the audit findings accepted for the old path, so an unchanged skill could block or prompt again on its next update. MoveEntry now carries them to the new key. A record below a first-level source link that cannot be read looks gone to Lstat, so an identical copy elsewhere could take its record while the link was down. Such records are no longer matched as moved. * fix(install): drop legacy-path acceptances and respect lock pins on move A legacy basename key such as `demo` with group `old` keeps its accepted audit findings under `old/demo`. MoveEntry removed only the key's own acceptances, so the old path kept them and a later skill placed there would inherit them without a new --force. It now deletes the old path. When the lockfile pins another commit than the moved copy holds, treating the copy as the moved skill re-keyed its stale record and let the project lock be rewritten with the older commit. Such copies no longer count as a move, so the pinned commit is installed as before. * fix(install): search for moved skills only where reconcile looks The search for a moved copy walked into installed skills and tracked checkouts, which reconcile skips. A copy found there made install skip the skill, then reconcile never saw the copy and pruned the record, and in project mode the config entry with it. The search now stops at the same boundaries. * fix(install): never take a recorded skill as another's moved copy Two identical skills can be recorded at different paths. When one of them went missing, the other matched its hashes and was taken as its moved copy, so install skipped the missing skill and reconcile pruned its record. A directory with a record of its own is now never a move destination. * fix(install): derive moved-copy paths from the resolved source root sourcewalk.WalkDir reports paths under the resolved source root, but the moved-copy search took them relative to the unresolved one. With a linked source (or Windows short temp paths) every path came out as ../..., so the installed-skill boundary never matched and a copy inside an installed parent could be taken as the move, after which reconcile pruned the record. The search now resolves the root first, as reconcile does. * fix(install): move a record only to one copy of what the config declares Three cases still let a move drop or misplace a record: - In project mode the manifest can point a skill at a new source while a copy of the old one exists elsewhere; that copy was taken as the skill, so the new source was never installed. The record's source and branch must now match the config entry. - A git checkout reconcile treats as tracked could be accepted before the tracked boundary was checked; the boundaries now run first. - With two identical copies, reconcile re-keyed the record to whichever it walked first. Both reconcile and the install-from-config search now require exactly one destination, and reconcile decides after the walk. * fix(install): clear accepted findings left at a move destination A removed legacy grouped entry can leave findings accepted for its path behind. MoveEntry only wrote the destination when the moved skill had its own acceptances, so a skill moved into that path inherited findings it never accepted. The destination is now cleared before the transfer. * fix(install): follow a moved skill only while its declaration still matches The install-from-config search compared source and branch but not the tracking mode, so a skill switched to tracked was satisfied by an old plain copy and never cloned. Project reconciliation, which other installs also run, inferred moves without looking at the manifest at all. A record whose declaration now names another source could follow a copy of the old source, after which the manifest entry was rewritten to that old source. Moves in project mode now require the declaration to still match the record, through the same MatchesDeclaration check the install path uses. * fix(install): infer no move while a source link is unreadable An unreadable followed source link can hide a second identical copy, so a copy that looked unique could take the record arbitrarily. Reconcile and the install-from-config search now infer a move only from a complete inventory; reconcile already keeps the gone record in that case. * fix(install): infer no move when the source walk hit an error Both walks dropped traversal errors, so an unreadable directory that hid a second identical copy left the visible one looking unique and it could take the record. Any walk error now counts as an incomplete inventory, like an unreadable source link, and no move is inferred from it. * fix(install): keep a record whose move waits on a failed walk When a walk error deferred a move, the walk still counted as complete, so pruning dropped the gone record along with its accepted audit findings and it could never follow the copy. A failed walk that deferred a move now marks the inventory incomplete, as an unreadable source link does; a failed walk with no move candidate keeps the old behavior. Also correct InstallFromConfig's comments, which still said reconcile runs only after an install. * fix(install): move a moved skill's gitignore rule in project mode Project reconcile added the managed ignore rule for a moved skill's new path but left the old one, and the gitignore update only ever adds. If the old path later held source-controlled files, Git kept ignoring them without a word. Reconcile now reports the paths records moved away from, and project reconcile removes their managed rules before adding the new. * test(config): skip the unreadable-directory reconcile test on Windows Windows does not stop reading a directory created with mode 0, and os.Geteuid reports -1 there, so the root-only skip let the test run and fail on the Windows runner. * fix(install): count a candidate that cannot be hashed as an incomplete search MovedEntryKey dropped a same-name candidate whose files could not be hashed, so a readable identical copy beside it looked unique and could take the record. It now returns the hash error, and reconcile and the install-from-config search treat it like a walk error: no move is inferred from that scan, and reconcile keeps the record waiting.