Skip to content

fix(diff): leave files sync does not copy out of the file diff - #992

Merged
runkids merged 1 commit into
mainfrom
runkids/ignore-consumers
Nov 23, 2026
Merged

runkids merged 1 commit into
mainfrom
runkids/ignore-consumers

Conversation

@runkids

@runkids runkids commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)
  • Approved feature or large change (the linked issue has the approved label)

Linked Issue

No issue.

What was wrong

For a copy-mode target, the file-level diff (skillshare diff --stat, --patch, and the file view in the diff TUI) walked every file in the source skill:

  • Files that ignore: or its default patterns (.DS_Store, .git/, __pycache__/) keep sync from copying showed as + notes.md on every run, though sync never copies them.
  • A symlinked folder inside a skill showed as one entry, while the copy makes real files from it.
$ skillshare diff --stat    # config has `ignore: [notes.md]`
claude
  Modified  skill-a
            ~ SKILL.md (10 → 9 bytes)
            + notes.md (18 bytes)

With this fix, the + notes.md line is gone.

The skill-level result (changed or not) was already right, because the checksum walk applies the same rules as the copy.

Fix

  • internal/sync: the checksum walk becomes walkCopiedFiles, shared by the checksum and a new CopiedFiles. It applies the ignore rules with their ! negations, skips .git, and follows directory symlinks, as the copy does. The checksum's behavior is unchanged.
  • cmd/skillshare/diff*.go: for a copy-mode target, the source side of the file diff comes from CopiedFiles. The target side and merge-mode targets are unchanged. Global and project mode share this path.
  • Docs: diff.md and the ignore section of configuration.md say that the file-level diff leaves these files out, in English and the four translations.

Tests

  • TestCopiedFiles_ListsWhatTheCopyCopies copies a skill and checks that CopiedFiles lists exactly the files the copy made. The skill includes:
    • an ignored file, at the top and nested;
    • an ignored folder with a !-re-included file;
    • the default patterns and .git;
    • a symlinked folder holding an ignored file.
  • TestDiff_CopyMode_FileStatLeavesOutIgnoredFiles runs diff --stat with ignore: [notes.md]. It fails on main with + notes.md (18 bytes).

Checks

  • make check passes in the devcontainer, including the raw-walk guard. Its allowlist entry is renamed to walkCopiedFiles.
  • python3 scripts/ai-context.py check passes.

Not covered

  • OwnsCopy, which decides whether merge sync may replace a leftover copy-mode copy with a link, hashes the copy with the default patterns only. It still agrees with the recorded checksum for any user pattern, because the copy already lacks those files. It disagrees only when ignore: re-includes a default pattern, such as !.DS_Store. Then an unedited copy is kept and reported as a local copy until sync --force. Nothing is lost. Fixing it means passing the patterns through merge sync.
  • The "source changed" and "target changed" times that diff prints still count ignored files.

Checklist

  • I've read CONTRIBUTING.md, including its AI-assisted contributions section
  • I've reviewed every line of the diff and can explain it
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

For a copy-mode target, `skillshare diff --stat`, `--patch` and the diff
TUI's file view walked every file in the source skill. Files that
`ignore:` or its default patterns keep sync from copying showed up as
"+ notes.md" on every run, and a symlinked folder inside a skill showed
as one entry instead of the files the copy makes from it.

The checksum walk already lists exactly what copy mode copies: it applies
the ignore rules with their negations and follows directory symlinks.
That walk is now shared, and the file diff uses it for the source side
of a copy-mode target, so the file view, the checksum and the copy agree.
Merge-mode targets are unchanged.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T06:22:32.889885Z 8f3574a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@runkids
runkids merged commit b20eacd into main Nov 23, 2026
10 checks passed
@runkids
runkids deleted the runkids/ignore-consumers branch November 23, 2026 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant