Skip to content

fix(sync): replace copy-mode copies with links when switching back to merge - #506

Merged
runkids merged 8 commits into
mainfrom
runkids/merge-mode-switch
Oct 9, 2026
Merged

runkids merged 8 commits into
mainfrom
runkids/merge-mode-switch

Conversation

@runkids

@runkids runkids commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

Linked Issue

Found by real-user simulation (copy → merge/flat return); no tracking issue.

Closes #

What changed

Switching a target from copy mode back to merge left every copy whose entry name did not change as a real folder. Merge sync treated it as the user's own folder, so status and doctor kept saying "run skillshare sync" while sync changed nothing, and only sync --force turned it into a link.

Copy mode already replaces merge-mode links with copies on its own. Merge sync now does the reverse: a folder the manifest records with a checksum (a copy-mode copy) is replaced with a link, without --force. Folders the manifest does not record, or records as a link, stay untouched.

Change Covering test
SyncTargetMergeWithSkills replaces a manifest-recorded copy-mode copy that still hashes to its recorded checksum (Manifest.OwnsCopy) TestSyncTargetMerge_ReplacesCopyModeCopy, ..._DryRun (internal/sync/merge_test.go)
A folder recorded as a link, not recorded, or edited since copy mode made it is kept TestSyncTargetMerge_KeepsFolderRecordedAsLink, TestSyncTargetMerge_KeepsEditedCopyModeCopy, TestSync_MergeMode_EditedCopyModeCopy_NeedsForce, existing TestSyncTargetMerge_SkipsLocalCopy
CLI diff names these entries Modified / "copy mode copy (sync replaces with link)" instead of suggesting --force TestDiff_MergeMode_CopyModeCopy_SyncReplacesWithoutForce (tests/integration/diff_test.go, also runs the real sync)
Dashboard diff stream reports the same reason TestComputeTargetDiff_MergeModeCopyModeCopyIsReplacedWithLink (internal/server)
The folder is parked (under a fixed-length hashed name) until the link exists, so a failed link keeps it; the manifest drops copy-mode Mtimes/Naming TestReplaceWithLink_KeepsFolderWhenLinkFails, TestReplaceWithLink_KeepsLeftoverParkedCopy, TestReplaceWithLink_LongEntryName, TestSyncTargetMerge_ReplacesCopyModeCopy
Dashboard Sync page words the replacement as "Copy made by copy mode. Will be replaced by a link" (11 locales) syncView.test.ts ("says a copy-mode copy in a merge target is replaced by a link")
Docs: sync-modes.md, plus diff.md Modified and Local override rows, say only unedited copies are replaced; English plus ja/ko/zh-Hans/zh-Hant python3 scripts/ai-context.py check

The CLI and the Web API share one code path (SyncSkillTarget → SyncTargetMergeWithSkills), so both get the fix. Symlink mode (the whole target is a link) is converted by ensureRealTargetDir before this branch and is unaffected.

Each new test failed before the fix (unit tests and the integration test against an origin/main build; the server test against origin/main handler_diff_stream.go).

Checks

  • make check in the devcontainer: passes (fmt, lint, unit, integration).
  • python3 scripts/ai-context.py check: ok.
  • /simplify on origin/main: four angles (reuse, simplification, efficiency, altitude). Changed: the manifest check is nil-safe (the CLI diff ignores the manifest read error); the new unit tests lost an unused file write and a redundant two-skill case; CopyToLinkReason moved next to IsCopyModeCopy in manifest.go. Skipped: a shared "symlink" constant and a shared "local copy" reason constant (both pre-existing literals, outside this change).
  • /code-review (standards + spec axes) with origin/main as the fixed point: no hard violations. Added the dashboard diff test and the diff.md Modified-label update (English plus four locales). Left as is: reference/commands/sync.md --force row (still true: --force replaces any existing folder).
  • Codex round 1: second /simplify pass on the follow-up merged the two integration tests' config helper and fixed a comment; its reuse/altitude notes about ignore patterns and prefixed names are the known limit above.
  • Consumer sweep before review round 2: CLI diff text and --json, sync text / --json / --dry-run / --force, status, project mode (-p), server diff stream and sync, dashboard Sync page, UI locales, docs and i18n, built-in skill. Ran copy→merge end to end in the devcontainer for global and -p (plain, --dry-run, --json, --force, an edited copy, a user folder). Found and fixed the dashboard wording; status/doctor and skills/skillshare needed no change. Full UI test run (86 files), tsc -b and eslint pass.
  • Codex round 3 (docs): the sync-modes sentence did not mention edited copies; fixed in all five languages. Docs-only /simplify pass: no change needed.
  • Codex round 4 (P2): /simplify on the follow-up: a stale parked folder now stops the sync instead of being deleted; moving the helper next to reformatLink and generalizing it was skipped as a wider refactor. Full diff re-read before the next round.
  • Codex round 5 (P1, 2x P2): long names fixed with a hashed parked name, the other two documented or declined above. /simplify on the follow-up extracted parkedPath so the test shares the name formula. make check exits 0 on the head.
  • Not run: Windows (UTM) link runbook. Windows junction behavior is untested here.

Notes and known limits

  • The diff wording change is small and goes beyond the sync fix, but without it diff would suggest --force for something plain sync now does. It does not touch feat(sync): make prefixed target naming misconfigurations visible #503 or fix(sync): close gaps found while simulating the prefixed naming switch #504 areas (their warnings, target pairing, skipped-skill listing, kept-legacy rows); the changed lines in diff.go / handler_diff_stream.go sit beside, not on, the kept-legacy code.

  • A copy the user edited since copy mode made it is kept (Codex review): replacement needs the folder to still hash to the manifest checksum, because sync --json and project-mode dashboard sync take no pre-sync backup. sync --force still replaces it.

  • A copy whose name: was rewritten by prefixed naming, or made with custom ignore patterns, no longer hashes to the source checksum, so it is kept and needs --force (safe direction; covering it would need a checksum of the written copy in the manifest and a migration for old manifests).

  • Not forced, because they need unusual setups: a kept legacy-named entry can show a different diff row than sync's active name.

  • If the process is killed between parking the folder and creating the link, the parked folder stays hidden beside the entry; the next sync links the entry, and a later copy → merge switch stops with a message naming the parked path (declined in the Codex thread).

  • Changing target_naming in the same sync as the copy → merge switch gives a copy a new entry name, and the existing prune pass removes it as an orphan whether or not it was edited (documented in sync-modes; the pre-sync backup holds it). Guarding orphan pruning would change every managed directory, so it is left for a separate change.

  • status and doctor still say "run skillshare sync" for a copy that sync keeps (edited, or a user folder). That wording belongs to feat(sync): make prefixed target naming misconfigurations visible #503, so it is not changed here.

  • Other remove-then-create sites (--force on agents, copy mode's overwrite) are older and unchanged; only the merge-mode skill replacement this PR widens got the parked-folder protection.

  • A copy whose only change is a file mode bit (for example chmod +x) still hashes the same, so it is replaced; the pre-sync backup of a plain sync holds it (declined in the Codex thread: copy mode tracks content only and replaces managed copies whenever the source changes).

  • The dashboard matches the server's reason string for the new row text, like the existing missing / (target naming) checks, instead of adding a reason code to the diff API for one case.

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

… merge

Switching a target from copy back to merge left every copy whose entry name
did not change as a real folder. Merge sync treated it as the user's own
folder, so status and doctor kept saying "run skillshare sync" while sync
changed nothing, and only `sync --force` turned it into a link.

Copy mode already replaces merge-mode links with copies on its own, so merge
sync now replaces a folder the manifest records with a checksum (a copy-mode
copy) with a link, without --force. Folders the manifest does not record, or
records as a link, stay untouched. The pre-sync target backup is unchanged.

The CLI and dashboard diffs name these entries as copies sync replaces
instead of suggesting --force, and the sync-modes docs describe the switch.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T16:04:55.514929Z bbd905e Manual request
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e5bd1e924

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/sync/sync.go Outdated
Comment on lines 665 to 669
if force || manifest.IsCopyModeCopy(activeName) {
// Force, or a copy left by copy mode: replace it with a symlink
if dryRun {
if !quietDryRun {
fmt.Fprintf(DiagOutput, "[dry-run] Would replace local copy: %s\n", activeName)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve modified copies before replacing them

When a user edits or replaces a previously copy-mode-managed directory and then switches the target to merge mode, the stale manifest entry still makes IsCopyModeCopy true, so a normal sync now executes os.RemoveAll without checking whether the target still matches the recorded copy. This can permanently discard those edits because global CLI sync --json skips pre-sync backups and project-mode dashboard sync explicitly excludes skill backups. Verify the existing directory is still the managed copy, require --force when it has diverged, or guarantee a recoverable backup before deleting it.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3e842a5. Verified: sync --json and project-mode dashboard sync take no pre-sync backup, and IsCopyModeCopy only read the manifest, so an edited copy was deleted. Merge sync now replaces a managed copy only while the folder still hashes to the recorded checksum (Manifest.OwnsCopy); an edited copy is kept and sync --force still replaces it. The CLI and dashboard diffs use the same check, so they keep suggesting --force for an edited copy. Known limit: a copy whose name: was rewritten by prefixed naming, or made with custom ignore patterns, no longer hashes to the source checksum and is kept too (the safe direction). Covered by TestSyncTargetMerge_KeepsEditedCopyModeCopy and TestSync_MergeMode_EditedCopyModeCopy_NeedsForce (both failed before the change).

The first version replaced any folder the manifest recorded as a copy-mode
copy. The manifest checksum is only a record, so a copy edited since copy
mode made it was deleted too, and `sync --json` and project-mode dashboard
sync take no pre-sync backup to restore it from.

Replace the folder only while it still hashes to the recorded checksum
(Manifest.OwnsCopy). An edited copy is kept and `sync --force` still
replaces it; diff keeps suggesting --force for it. A copy whose name: was
rewritten by prefixed naming, or that was made with custom ignore patterns,
no longer hashes to the source checksum and is kept the same way.
@runkids

runkids commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e842a5a4f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/sync/manifest.go
Comment on lines +75 to +76
sum, err := DirChecksumWithIgnore(dir, DefaultFileIgnorePatterns())
return err == nil && sum == recorded

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include file modes when identifying untouched copies

When a user changes only a copied file's permissions—for example, making a target-local script executable—and then switches the target from copy to merge mode, this checksum still matches because DirChecksumWithIgnore hashes only paths and contents. OwnsCopy therefore treats the directory as untouched, and merge sync removes it without --force, silently discarding the permission change. Track or compare file modes (and other meaningful filesystem metadata) before automatically replacing the copy.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this one. Copy mode records only a content checksum of the source, and it already replaces a managed copy whenever the source changes, so a permission-only edit on a managed copy is not something the manifest or any sync mode tracks today. Guarding it would need a new manifest field (modes of the written copy) plus a migration for existing manifests, and file modes have no meaning on Windows. A copy whose contents were edited is kept (3e842a5). A copy with only a changed mode bit is replaced, and the pre-sync target backup (plain sync) still holds it. Recorded as a known limit in the PR description.

The Sync page picks a row's text from the diff item's action alone. The
copy-mode copy that merge sync now replaces comes from the server as an
update, which the page worded as "Link is broken or points elsewhere. Will
be relinked" even though no link exists yet.

Match the server's reason and show "Copy made by copy mode. Will be replaced
by a link" instead, in all eleven dashboard languages.
@runkids

runkids commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09502a77ee

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/docs/understand/sync-modes.md Outdated
skillshare sync
```

Copies that copy mode made are replaced with links on that sync, without `--force`. Folders you made yourself, which the manifest does not record, are kept; `--force` replaces those too.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Qualify which copy-mode copies are replaced

This promise is false when the managed copy has been edited: Manifest.OwnsCopy only permits replacement while the directory still hashes to the recorded checksum, so normal merge sync keeps an edited copy and still requires --force. It is also false for prefixed copies whose rewritten name: makes their target checksum differ. Document the checksum/unedited limitation rather than contrasting only with unrecorded user folders, and align the translated versions.

AGENTS.md reference: AGENTS.md:L13-L15

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 290f947. Verified against Manifest.OwnsCopy: an edited copy, and a copy whose name: copy mode rewrote for prefixed naming, no longer hash to the recorded checksum and stay until sync --force. sync-modes.md now says only unedited copies are replaced and lists the cases that are kept (a folder you made yourself, an edited copy, a prefixed-rewritten copy). The diff reference's Modified and Local override rows are qualified the same way, and the ja, ko, zh-Hans and zh-Hant copies of both pages carry the same wording. Docs only, so no new test; make check and ai-context.py check pass.

…sync

The sync-modes paragraph promised that copies copy mode made are replaced
with links without --force. Merge sync keeps a copy that no longer hashes to
the checksum copy mode recorded, so an edited copy, or one whose name: copy
mode rewrote for prefixed naming, still needs --force.

State the three cases in sync-modes and qualify the diff Modified and Local
override labels, in English and the ja, ko, zh-Hans and zh-Hant copies.
@runkids

runkids commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 290f947df8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/sync/sync.go
// It's a real directory
if force {
// Force: replace local copy with symlink
if force || manifest.OwnsCopy(activeName, targetSkillPath) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the copy until the replacement link exists

When the checksum guard succeeds but createLink fails—such as on a Windows/network filesystem where neither a junction nor a permitted symlink can be created—the code has already removed the working copy with os.RemoveAll, so sync returns an error with the target skill now missing. Rename the copy aside and restore it on link-creation failure, or otherwise create/validate the replacement before permanently deleting the directory.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 8f76bae. Verified: the old code ran os.RemoveAll and then createLink, so a failed link left the skill missing, and a plain sync now reaches that code. replaceWithLink now moves the folder to a hidden sibling, creates the link, and deletes the parked folder only after the link exists; if the link fails the folder is moved back. A parked folder left by a run that died mid-way is not deleted (it could be the only copy): the next sync stops and names the path. The manifest also drops the copy-mode Mtimes/Naming records of an entry that became a link. Covered by TestReplaceWithLink_KeepsFolderWhenLinkFails, TestReplaceWithLink_KeepsLeftoverParkedCopy and the extended TestSyncTargetMerge_ReplacesCopyModeCopy. make check passes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction: the reply above said make check passed on 8f76bae. It did not: TestRawWriteRatchet failed because replaceWithLink's new os calls were not registered in raw_writes.tsv. Fixed in 4f0670a (the four target-side calls are registered and the stale os.RemoveAll targetSkillPath allowance is removed). make check now exits 0 on this head.

Replacing a copy-mode copy removed the folder first and then created the
link. If creating the link failed (no symlink or junction rights on a
Windows or network filesystem), sync returned an error with the skill gone
from the target. This path now also runs on a plain sync, not only on
--force.

Park the folder beside the entry, create the link, then delete the parked
folder; on failure the folder is moved back. A parked folder left by a run
that died mid-way may be the only copy, so the next sync stops with a message
instead of deleting it. The manifest also forgets the copy-mode mtime and
naming records of an entry that is now a link.
@runkids

runkids commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

…rite ratchet

The previous commit moved the merge-mode folder replacement into
replaceWithLink, which the ratchet reports as new raw os calls and the old
os.RemoveAll allowance as stale. All of them act on the sync target, not the
skills source, like the neighbouring entries.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f76baefe0

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread website/docs/understand/sync-modes.md Outdated
skillshare sync
```

Unedited copies that copy mode made are replaced with links on that sync, without `--force`. Everything else is kept until you run `sync --force`: a folder you made yourself (the manifest does not record it) and a copy you edited after copy mode made it. A copy whose `name:` copy mode rewrote for `prefixed` naming also counts as edited.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve edited copies during simultaneous naming changes

When users change both mode: copy → merge and target_naming in one sync—for example, an edited flat copy group__alpha becomes standard name alpha—merge legacy detection accepts only links, so sync creates alpha and then the prune pass removes the manifest-recorded group__alpha directory without checking its checksum. Thus the edited copy is deleted despite this new promise that it is kept until --force. Fresh evidence beyond the earlier wording thread is this simultaneous mode-and-naming transition; either preserve/checksum-guard the legacy copy or explicitly warn about this exception.

AGENTS.md reference: AGENTS.md:L15-L15

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing the code; documented in bbd905e. Verified: in merge mode the legacy-name detection only accepts links, and the prune pass removes a manifest-recorded directory whose name is no longer valid without looking at its content. That is how a copy-mode directory under an old name has always been treated (the issue's own simulation shows 7 pruned for the renamed entries), and it applies to any naming change, not to the copy → merge switch this PR fixes. Guarding it would change orphan pruning for every managed directory, which is a separate change. sync-modes (all five languages) now says that when the same sync also changes target_naming, the copy gets a new entry name and is removed as an orphan, edited or not; the backup of a plain sync holds it.

Comment thread internal/sync/sync.go
Comment on lines +722 to +724
// A leftover may be the only copy if an earlier run died before it could restore it.
if _, err := os.Lstat(parked); err == nil {
return fmt.Errorf("%s is left from an earlier replacement; move or delete it, then sync again", parked)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recover parked copies before handling missing targets

If the process exits after os.Rename(path, parked) but before the link is created, the next sync sees the original path as missing and takes the ordinary create-link branch without ever calling this leftover check. The sync then succeeds while the hidden parked directory remains; after another copy-mode run, a later copy-to-merge transition fails permanently on this stale sibling until the user discovers and removes it. Detect and restore or reconcile the parked path before branching on whether the target exists.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this one. It needs the process to be killed in the microseconds between os.Rename(path, parked) and the symlink call. If that happens, the parked folder is the copy that would have been replaced anyway (it was either unedited or the user passed --force), the sync that follows creates the link, and a later copy → merge switch stops with a message that names the parked path, so nothing is lost silently. Reconciling it at the start of every entry would add a lookup per skill per sync for that window. Recorded as a known limit in the PR description.

Comment thread internal/sync/sync.go Outdated
// replaceWithLink swaps the real folder at path for a link. The folder waits
// beside it until link has run, so a failed link leaves the folder as it was.
func replaceWithLink(path string, link func() error) error {
parked := filepath.Join(filepath.Dir(path), "."+filepath.Base(path)+".skillshare-replaced")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a bounded name for the parked copy

On filesystems with a 255-byte component limit, a valid existing flat target name longer than 234 bytes cannot be replaced because adding . and .skillshare-replaced makes the sibling basename exceed the limit, causing os.Rename to fail. Nested skills can readily produce such long flattened names even though the original copy was created successfully; use a short fixed or hashed temporary name instead of appending to the full basename.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in bbd905e. Reproduced first: a 250-byte entry name failed with file name too long on the rename. The parked name is now .skillshare-replaced- plus the SHA-256 of the entry name, a fixed 85 bytes, and still starts with a dot so the target scanners skip it. Covered by TestReplaceWithLink_LongEntryName (failed before the change); make check exits 0.

…tion

The folder parked while a link is created was named after the entry, so an
entry near the 255-byte filename limit (a long flattened nested skill)
could not be moved aside and its replacement failed. The parked name is now
a fixed-length hash of the entry name.

sync-modes also says what happens when `target_naming` changes in the same
sync: the copy gets a new entry name and the prune pass removes it as an
orphan whether or not it was edited, as it did before this change.
@runkids

runkids commented Oct 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: bbd905ef24

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Main gained the kept-legacy diff rows (#504), the manifestSymlink constant and prefixed-naming warnings (#503), and the BOM-tolerant frontmatter reader (#505). The diff stream checks the kept legacy entry before the copy-mode copy, since sync leaves a folder on a name held for a kept legacy entry alone; the docs keep both new rows.
@runkids
runkids merged commit c638b46 into main Oct 9, 2026
8 checks passed
@runkids
runkids deleted the runkids/merge-mode-switch branch October 9, 2026 16:13
runkids added a commit that referenced this pull request Oct 9, 2026
The generated entry listed every commit, including about thirty fixes to
target_naming: prefixed made before it was ever released, a test commit
and an internal helper. Group what users will notice: the prefixed naming
feature, the shared-folder conflict notices, and the fixes to released
behavior (#498, #505, #506, #508, combined --mode/--target-naming).
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