← Back to Pull requests

fix: prevent forced skill installs from deleting source files #418

Closed
unknown closed this pull request without merging on Dec 04, 2026 22:14 UTC
View on GitHub
unknown unknown commented on Dec 01, 2026 16:05 UTC
Author

What Problem This Solves

Fixes #419

On a case-insensitive filesystem, a destination such as SKILLS can point to the checkout’s skills directory. A forced install can mistake those paths for separate directories and delete the source skill it is trying to install.

User Impact

The installer skips a destination that points to the source skill and refuses any destination inside or containing the source tree. Dry runs report the same decisions.

Why This Change Was Made

The installer compares filesystem identities for the destination and its parent directories. This detects overlapping paths even when they are spelled with different capitalization.

Evidence

On macOS, three regression cases failed before the fix and passed afterward in both dry-run and real installs. They cover installing directly onto the source, installing inside it, and installing into a directory that contains it.

All 16 installer tests passed with Python 3.13 and 3.14. scripts/validate-skills validated all nine skills, and git diff --check passed.

End-to-end installer proof

Ran scripts/install-skills on a confirmed case-insensitive macOS 27.2.1 arm64 filesystem with Python 3.14.10. Each alias case used a disposable archive of the exact base (20eb80f43244) or PR head (9f74bb7ca6bd).

| Destination | Base, real run | PR head, dry run and real run |
| --- | --- | --- |
| SKILLS aliases the source directory | Replaced the source skill with a self-referential symlink | Skipped the source, exit 0 |
| SKILLS/autoreview/nested is inside the source | Created an installation inside the source | Refused the overlap, exit 1 |
| Destination entry autoreview aliases the containing AutoReview checkout | Deleted the disposable checkout and left a dangling symlink | Refused the overlap, exit 1 |

Dry runs preserved the file snapshots on both revisions. On the PR head, all real alias runs preserved the checkout. Fresh installs on the PR head and forced upgrades from the latest stable release, v0.7.0 (a056640843cb), succeeded in copy and symlink modes. Hash and symlink checks confirmed the upgraded skill matched the PR head. Unselected data, synthetic external settings and data, and both source checkouts were preserved.

<details>
<summary>Redacted terminal output and filesystem assertions</summary>

macOS 27.2.1 (arm64), Python 3.14.10
Base: 20eb80f4324479ee764101f0ce940b1b823c7d42
PR head: 9f74bb7ca6bdde90ed4ab9a92554ba4809d0a814
Latest stable v0.7.0: a056640843cb9b7701a451c2d43ef554709ab988
Confirmed case-insensitive scratch filesystem by directory identity.

### Case-insensitive aliases

Source itself
Base:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS --force --dry-run autoreview
  stdout: remove <scratch>/<fixture>/AutoReview/SKILLS/autoreview
  stdout: would symlink autoreview -> <scratch>/<fixture>/AutoReview/SKILLS/autoreview
  exit: 0
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS --force autoreview
  stdout: symlink autoreview -> <scratch>/<fixture>/AutoReview/SKILLS/autoreview
  exit: 0
  Original skill replaced by a self-referential symlink.
PR head:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS --force --dry-run autoreview
  stderr: target is source, skipping: <scratch>/<fixture>/AutoReview/SKILLS/autoreview
  exit: 0
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS --force autoreview
  stderr: target is source, skipping: <scratch>/<fixture>/AutoReview/SKILLS/autoreview
  exit: 0
  Checkout matches its pre-install snapshot after the real run.

Inside the source
Base:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested --force --dry-run autoreview
  stdout: would symlink autoreview -> <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested/autoreview
  exit: 0
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested --force autoreview
  stdout: symlink autoreview -> <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested/autoreview
  exit: 0
  Installer created an installation inside the source.
PR head:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested --force --dry-run autoreview
  stderr: target overlaps source, refusing: <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested/autoreview
  exit: 1
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested --force autoreview
  stderr: target overlaps source, refusing: <scratch>/<fixture>/AutoReview/SKILLS/autoreview/nested/autoreview
  exit: 1
  Checkout matches its pre-install snapshot after the real run.

Containing the checkout
Base:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture> --force --dry-run autoreview
  stdout: remove <scratch>/<fixture>/autoreview
  stdout: would symlink autoreview -> <scratch>/<fixture>/autoreview
  exit: 0
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture> --force autoreview
  stdout: symlink autoreview -> <scratch>/<fixture>/autoreview
  exit: 0
  Checkout replaced by a dangling symlink.
PR head:
  $ python3.14 scripts/install-skills --target <scratch>/<fixture> --force --dry-run autoreview
  stderr: target overlaps source, refusing: <scratch>/<fixture>/autoreview
  exit: 1
  Files and directories unchanged after dry run.
  $ python3.14 scripts/install-skills --target <scratch>/<fixture> --force autoreview
  stderr: target overlaps source, refusing: <scratch>/<fixture>/autoreview
  exit: 1
  Checkout matches its pre-install snapshot after the real run.

### Fresh installs and upgrades from v0.7.0

copy mode
  $ python3.14 scripts/install-skills --target <scratch>/fresh-copy --mode copy autoreview
  stdout: copy autoreview -> <scratch>/fresh-copy/autoreview
  exit: 0
  Fresh installation matches the PR head source.
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-copy --mode copy autoreview
  stdout: copy autoreview -> <scratch>/upgrade-copy/autoreview
  exit: 0
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-copy --mode copy autoreview
  stderr: exists, skipping: <scratch>/upgrade-copy/autoreview
  exit: 0
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-copy --mode copy --force --dry-run autoreview
  stdout: remove <scratch>/upgrade-copy/autoreview
  stdout: would copy autoreview -> <scratch>/upgrade-copy/autoreview
  exit: 0
  Install without --force and forced dry run both preserve the stable installation.
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-copy --mode copy --force autoreview
  stdout: copy autoreview -> <scratch>/upgrade-copy/autoreview
  exit: 0
  Upgraded to the PR head. Unselected skill data, external settings/data, and both source checkouts match their pre-upgrade snapshots.

symlink mode
  $ python3.14 scripts/install-skills --target <scratch>/fresh-symlink --mode symlink autoreview
  stdout: symlink autoreview -> <scratch>/fresh-symlink/autoreview
  exit: 0
  Fresh installation matches the PR head source.
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-symlink --mode symlink autoreview
  stdout: symlink autoreview -> <scratch>/upgrade-symlink/autoreview
  exit: 0
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-symlink --mode symlink autoreview
  stderr: exists, skipping: <scratch>/upgrade-symlink/autoreview
  exit: 0
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-symlink --mode symlink --force --dry-run autoreview
  stdout: remove <scratch>/upgrade-symlink/autoreview
  stdout: would symlink autoreview -> <scratch>/upgrade-symlink/autoreview
  exit: 0
  Install without --force and forced dry run both preserve the stable installation.
  $ python3.14 scripts/install-skills --target <scratch>/upgrade-symlink --mode symlink --force autoreview
  stdout: symlink autoreview -> <scratch>/upgrade-symlink/autoreview
  exit: 0
  Upgraded to the PR head. Unselected skill data, external settings/data, and both source checkouts match their pre-upgrade snapshots.

All CLI assertions passed.

</details>

Diff: 650 lines (+487 / -163) across 8 files Reviewer: steipete Review duration: 4688m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
0.52
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.388
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #418"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52% (MEDIUM) · Higher = larger blast radius
52%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.5% · Safe to merge
20.5%