Files
skillshare/ai_docs/tests/windows_pi_extensions_runbook.md
T
Willie 539f1d0f03 fix(pi): recover Windows stale locks and protect private registrations (#361)
* test(pi): reproduce Windows private registration access failures

Use NTFS DACL assertions instead of POSIX mode bits and verify that broadly accessible existing records cannot be read or silently reused. Keep the Unix mode assertion unchanged.

* fix(pi): reclaim Windows locks and protect private registration state

Anchor stale directories with delete sharing and delete the verified empty Windows directory by handle, keeping inode, lease and racing-owner guards. Create new registration directories with protected owner/SYSTEM DACLs and validate existing owner/access rules without changing their ACLs. Leave Unix permissions and directory-only removal unchanged.

* test(pi): capture Windows lock identity before path replacement

Windows Lstat lazily fetches file IDs by pathname. Snapshot the stale fixture through its anchored handle and add a matching-mtime replacement regression before first verification or release.

* fix(pi): snapshot Windows lock IDs and accept privileged default owners

Capture acquired lock identity through a handle before Windows can lazily resolve a replaced pathname. Elevated tokens can default file ownership to Administrators; permit privileged owners only alongside a verified current-user-only DACL. Refuse unsafe existing registration directories without modifying their ACLs or writing records.

* docs(pi): record Windows acceptance and isolated regression workflow

Document private Windows ACL requirements and refusal without permission rewrites. Add pinned devcontainer kit packaging, token-isolated full/basic acceptance, preserved UTF-8 logs and a reproducible UTM runbook. Preserve the original Unix permission assertion.

* test(backup): isolate explicit agent backup from sync snapshots

Sync automatically backs up target-local agents. Creating the fixture before sync makes the exact-one-backup assertion depend on both commands sharing a timestamp second. Create it after successful sync so the explicit backup is the only operation that snapshots it, without weakening the assertion.
2026-10-03 23:19:34 +08:00

5.2 KiB

Windows Pi lock and private registration verification

Scope

Follow-up to #350 / #358: reclaim only unchanged empty expired native locks, retain racing owners, snapshot acquired Windows file IDs before path reuse, and protect preserved filtered registrations with Windows ACLs. Test the existing global, project and account import lifecycles and Pi 0.99.2/1.0.0 native interoperability. No extension factories, native trust changes, user settings, or global Pi installs.

Environment

Use a running Linux devcontainer for all builds and a logged-in UTM Windows desktop user for execution. SYSTEM is setup/transport only. Run both Interactive full and runas /trustlevel:0x20000 basic tokens. Record the pinned commit, native architecture, Node version and Developer Mode state. All guest files belong under C:\Users\Public\sstest\; preserve existing kits and reports.

Steps

1. Probe and build the pinned kit

Run from the repository on the host. Choose an immutable commit and the guest's native architecture; ss-pi-ext below is the task-owned devcontainer.

bash scripts/windows/utm.sh probe
PIN=$(git rev-parse HEAD)
bash scripts/windows/build-pi-kit.sh "$PIN" ss-pi-ext arm64

Expected: started VM, nonempty desktop user, architecture ARM64. The builder prints the full commit, architecture and repository-local ignored kit.zip path. It uses git archive, never working-tree source. The kit includes the CLI, plugin test binary, pinned testdata/native probes, runner and commit.txt. An existing kit is refused rather than overwritten.

2. Create and unpack a fresh guest kit (SYSTEM setup only)

Keep these shell variables for later steps. Change the suffix for a repeated run; never replace an existing kit. This setup script is stored inside the repository.

KIT=".playwright-mcp/windows-pi-${PIN:0:8}-arm64"
GUEST="C:\\Users\\Public\\sstest\\pi-extensions-${PIN:0:8}"
printf '%s\n' "\$root='$GUEST'" \
  'if (Test-Path $root) { throw "Use a fresh kit." }' \
  'New-Item -ItemType Directory $root | Out-Null' > "$KIT/setup.ps1"
bash scripts/windows/utm.sh ps "$KIT/setup.ps1" 30
bash scripts/windows/utm.sh push "$KIT/kit.zip" "$GUEST\\kit.zip"
printf '%s\n' "\$root='$GUEST'" \
  'Expand-Archive (Join-Path $root "kit.zip") $root' > "$KIT/unpack.ps1"
bash scripts/windows/utm.sh ps "$KIT/unpack.ps1" 40

Expected: fresh directory and successful archive extraction. Setup does not run the product. Do not treat utm.sh ps transport completion as product evidence.

3. Execute full, then basic token acceptance

The first run installs only the two exact native versions into this kit, with scripts disabled and fresh npm configuration/cache. Wait for full completion before basic so it can reuse those isolated installations. -NativeRoot can instead point to a previously verified sstest kit; omit -InstallNative in that case. Never use a user profile or global installation as the native prefix.

bash scripts/windows/utm.sh task sstest-pi-extensions-full "$GUEST\\run.ps1" -- \
  -Root "$GUEST" -Token full -InstallNative
bash scripts/windows/utm.sh pull "$GUEST\\result-full.txt"

Expected: report ending in DONE, REGRESSIONS_EXIT=0, and both LAUNCHER_<version>_EXIT=0 / NATIVE_<version>_EXIT=0. No ERROR or MISSING markers. pull can exit zero when a file is missing: inspect content, not its exit status. The initial regression pass intentionally has no PI_ROOT; its native-lock test skips there and must pass separately in both native-version passes.

bash scripts/windows/utm.sh task sstest-pi-extensions-basic "$GUEST\\run.ps1" --basic -- \
  -Root "$GUEST" -Token basic
bash scripts/windows/utm.sh pull "$GUEST\\result-basic.txt"

Expected: the same zero markers and DONE under the basic token. Native lock interoperability runs longer than ten seconds. The runner reports failures in its exit status as well as markers, and exports child logs as .log.utf8 without changing the original streams. Inspect regressions.log.utf8 and native logs; do not relabel environment skips as executed tests. Symlink creation may be unavailable without the relevant privilege/Developer Mode; report that case explicitly.

4. Check safety results and retain evidence

bash scripts/windows/utm.sh pull "$GUEST\\full\\regressions.log.utf8"
bash scripts/windows/utm.sh pull "$GUEST\\basic\\regressions.log.utf8"

Expected: stale empty directory replaced with a distinct file ID; renewed, replaced, nonempty, future, file and supported symlink cases retained. A replacement with matching mtime before first verification is refused and survives release. Registration directories/files have real private DACLs; broadly accessible existing files cannot be read/reused, and unsafe existing directories keep their ACL/settings bytes with no new raw record. Global/project/account lifecycle cases pass.

Pass Criteria

  • Full/basic reports and child logs retained, with exact commit/architecture/token.
  • Regression and both versions' launcher/native checks exit zero; skips disclosed.
  • No shared/user settings, trust, Developer Mode, global installs or existing ACLs changed.
  • No broad cleanup: keep earlier failed kits and existing preview/container resources.