Skip to content

fix(sync): recognize a copy made under ignore: negations as unedited - #993

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

runkids merged 1 commit into
mainfrom
runkids/owns-copy-ignore

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. Follow-up to #992, which listed this under "Not covered".

What was wrong

When a target switches from copy to merge, merge sync replaces each copy that copy mode made and nobody edited with a link. diff and the dashboard report it as copy mode copy (sync replaces with link).

OwnsCopy decides "unedited" by hashing the copy and comparing it with the checksum copy mode recorded. It hashed the copy with the default ignore patterns only, but the recorded checksum used the effective patterns (defaults plus ignore:).

With ignore: ["!.DS_Store"], sync copies .DS_Store, and the recorded checksum includes it. OwnsCopy left it out, so the hashes never matched. Merge sync then kept the unedited copy as a local copy until sync --force, and diff and the dashboard said the same.

Fix

  • OwnsCopy takes the effective patterns. It hashes the copy with the defaults plus only the ! rules from ignore:.
  • The other ignore: rules stay out on purpose. Suppose ignore: names notes.md and the user adds a notes.md to the copy. That is their edit, so the copy must still count as edited and be kept. Hashing with the full patterns would hide the file and replace the copy.
  • All three callers pass the patterns:
    • merge sync, through a new SyncTargetMergeWithSkillsOptions that mirrors the copy side's ...Options variant;
    • diff;
    • the dashboard diff.
  • Global and project mode already build the effective patterns for these paths.

Tests

  • TestSyncTargetMerge_ReplacesCopyWithReincludedDefault copies a skill under !.DS_Store, then merge-syncs it. It fails on main.
  • TestSyncTargetMerge_KeepsCopyWithAddedIgnoredFile adds a notes.md that ignore: names to the copy and checks that merge sync keeps it. It passes on main and guards the case above.
  • TestDiffMergeModeCopyWithReincludedDefaultIsReplacedWithLink and TestComputeTargetDiff_MergeModeCopyWithReincludedDefaultIsReplacedWithLink cover the CLI and dashboard diff wiring. Both fail when OwnsCopy ignores the patterns.

Checks

  • make check passes in the devcontainer. The raw-write ratchet entry for merge sync's os.Remove moves to the new function name.
  • No docs change. sync-modes.md already says unedited copies are replaced, and this makes it true for ! rules.

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

When a target switches from copy to merge, merge sync replaces a copy
that copy mode made and nobody edited with a link, and diff and the
dashboard say so. It decided "unedited" by hashing the copy with the
default ignore patterns only, while the recorded checksum used the
effective patterns. With `ignore: ["!.DS_Store"]` the copy holds the
.DS_Store, the hashes never matched, and an unedited copy was kept as a
local copy until `sync --force`.

The copy is now hashed with the defaults plus the `!` rules from
`ignore:`, so it counts every file sync copied. The other `ignore:`
rules stay out on purpose: a file the user added to the copy is their
edit even when `ignore:` names it, and the copy must be kept.
@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:34:51.986082Z a71d6e1 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 7af3ad7 into main Nov 23, 2026
10 checks passed
@runkids
runkids deleted the runkids/owns-copy-ignore branch November 23, 2026 06:40
runkids added a commit that referenced this pull request Nov 23, 2026
…#994)

Three gaps left after the ignore: fixes in #986-#993:

- `disable` kept the line it wrote when a "!" rule kept the skill
  enabled, so the ignore file gained a rule that did nothing. The line is
  now removed again when it disables none of the skills it names.
- `skillshare disable inner` writes the folder name, but the list TUI and
  the dashboard removed only the skill's path line on enable, so the
  skill stayed disabled with no way to turn it back on there. They now
  also remove the folder-name line, unless it disables a skill or agent
  that is not being enabled.
- `diff` counted files that ignore: keeps out of the copy in the "source
  changed" time of a copy-mode target. It now counts only what sync
  copies.
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