Exploratory CLI, dashboard and real-Windows testing of single-file extras found paths that corrupted another shared file, lost user content, or reported the wrong state. - One shared file per link/copy target is now enforced in config validation, so the CLI, sync and API all refuse it; an import is never written through a link into another shared file (409 instructions_target_held in the API). - Restore recreates an original Windows junction as a junction, which needs no privilege, and remove restores before saving config so a failed restore no longer orphans the record. - Imports into dotfiles links, damaged managed blocks, repointed links and CRLF files keep the user's content; project imports use paths relative to the file so a moved repo keeps working. - Mode and assign responses carry sync warnings; dry-run says when an edit would be backed up; invalid modes no longer show as healthy. - An edited copy reports modified, identical unowned copies count as synced without being owned, and relative project links no longer show drift. - sync extras --json exits non-zero on errors; extras <name> --help works; --add-target gains --as; detach messages match behavior. Refs #299
4.8 KiB
Windows Runbook: File Links and Copy Fallback
Manual runbook (not mdproof): it runs on a real Windows machine, driven from a macOS
host through UTM's utmctl. It checks that file-based link modes never produce a
junction to a file, that they fall back to copies without file-symlink rights, and
that skills stay junctions recognised as links.
Scope
- Skills (merge): directory junction, tag
0xa0000003, not re-linked on resync. - Agents (merge), directory extra (merge), single-file extra
AGENTS.md(merge):- with file-symlink rights: symlink, tag
0xa000000c, readable; - without: regular file with source content and the warning
file links need Windows Developer Mode; copying instead.
- with file-symlink rights: symlink, tag
-Extended: two source edits propagate without drift backups or a "backed up" line, removed source agent is pruned while an untracked agent stays, a junction-to-fileAGENTS.mdis replaced, andstatus/doctor/list/extras listoutput is captured.
Environment
- Windows guest in UTM with the guest agent (runs as SYSTEM). Everything lives under
C:\Users\Public\sstest\. The script overridesUSERPROFILE,HOME,APPDATA,LOCALAPPDATAandTEMP, and aborts unlessdoctorreports the config under the test root. - The desktop user must be logged in: the
-LogonType Interactivetask in step 3 only runs in an interactive session, and restarting the VM logs the user out. Do not substituteS4U; its token can differ from what a real user gets. utmctl execis asynchronous and returns no output. The script writes a report and ends it withDONE; poll it withutmctl file pull.- SYSTEM and administrators (including an admin with UAC off, where
-RunLevel Limitedstill yields a full token) can create file symlinks. For the fallback path run throughrunas /trustlevel:0x20000(basic-user token); the report'sSeCreateSymbolicLinkPrivilege: absentandfile symlink probe: FAILEDlines confirm it.
Steps
-
Build in the devcontainer and copy out (
GOARCH=amd64for x64 guests):docker exec -w /workspace "$CONTAINER" bash -lc \ 'GOOS=windows GOARCH=arm64 go build -o /tmp/ss.exe ./cmd/skillshare' docker cp "$CONTAINER":/tmp/ss.exe ./ss.exeFor a baseline, build
git archive HEADextracted to a temp dir the same way. -
Push files (create
C:\Users\Public\sstestfirst and grant the desktop user access, e.g.icacls C:\Users\Public\sstest /grant '<user>:(OI)(CI)F'):U=~/Applications/UTM.app/Contents/MacOS/utmctl $U file push Windows 'C:\Users\Public\sstest\ss.exe' < ss.exe $U file push Windows 'C:\Users\Public\sstest\e2e-file-links.ps1' < scripts/windows/e2e-file-links.ps1 -
Run as the desktop user through a scheduled task registered from SYSTEM (push this as
launch.ps1andutmctl execit withpowershell.exe -File):$ps = 'powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\Users\Public\sstest\e2e-file-links.ps1 -Exe C:\Users\Public\sstest\ss.exe -Root C:\Users\Public\sstest\run -Out C:\Users\Public\sstest\out.txt -Extended' $a = New-ScheduledTaskAction -Execute 'runas.exe' -Argument "/trustlevel:0x20000 `"$ps`"" # or -Execute powershell.exe for a full token $p = New-ScheduledTaskPrincipal -UserId '<user>' -LogonType Interactive -RunLevel Limited Register-ScheduledTask -TaskName sstest-run -Action $a -Principal $p -Force Start-ScheduledTask -TaskName sstest-run -
Poll until the last line is
DONE:$U file pull Windows 'C:\Users\Public\sstest\out.txt' -
Clean up from SYSTEM:
Unregister-ScheduledTask -TaskName sstest-* -Confirm:$falseandcmd /c rmdir /s /q C:\Users\Public\sstest(rmdirdoes not follow junctions).
Pass Criteria
- Baseline (before the fix) reproduces the bug: agent, rule and
AGENTS.mdentries areLinkType=Junction, tag0xa0000003,read=NO. - Fixed, full token: those entries are
LinkType=SymbolicLink, tag0xa000000c,read=yeswith the source content. - Fixed, basic-user token: those entries have
reparseTag=none,read=yes; the warning line appears for agents and each file extra;.skillshare-manifest.jsonexists in the agents and rules targets. - Both fixed runs:
demo-skillis a junction andskill junction recreated: False; (a) target readsshared v2,drift backups before/after source edits: 0/0andbacked-up message after source edits: False; (b)demo-agent.md : MISSING,my-own.mdkept; (c) the junction becomes a readable file or symlink after sync. - Fixed, basic-user token:
status agents lineshowscopied … [copy] 1/1 linkedanddoctor agents lineshows[copy] synced (1/1 linked). - Note:
utmctl file pullexits 0 even when the file is missing; check its output forfailed to openwhen verifying cleanup.