Repository navigation
fix(sync): close gaps found while simulating the prefixed naming switch - #504
Conversation
Simulating the #497 reporter's switch from merge + flat to copy + prefixed turned up four problems: - `target X --mode copy --target-naming prefixed` applied only --mode, since the setter dispatch returned after the first flag. Both flags given together now check the final pair, then apply in an order that keeps the saved pair valid (copy mode first, any other mode last). - Skipped skills were only counted, so a prefixed name over 64 characters vanished with "1 skill(s) skipped". Sync now names the first five with their reason; the cap keeps huge sources from flooding the output. - In copy mode a merge-mode link to the skill was not a managed entry, so when a local folder held the new name the old link was pruned and the skill left the target, contrary to the documented "old managed entry is preserved". Copy mode now migrates such links like managed copies. - PATCH /api/targets validated the mode/naming pair against the current skills state, so disabling skills while changing mode was rejected. It now checks the state the request leaves the target in.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64d2f8ea07
ℹ️ 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".
| if err := first(); err != nil { | ||
| return err | ||
| } | ||
| return second() |
There was a problem hiding this comment.
Persist paired target settings atomically
When both flags are supplied, each setter writes the configuration independently. If the process is interrupted or the second save fails after first() succeeds, the command leaves only half of the requested transition persisted—for example, changing prefixed/copy to flat/merge can leave flat/copy behind. Mutate both fields and perform one save so the paired command either commits its final state or leaves the configuration unchanged.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0c82506. When both flags are given, updateTargetModeAndNaming now checks the final pair, sets mode and naming on the target together, and saves the config once, so it either holds the whole change or none of it; the two-setter ordering is gone. Covered by TestTarget_SetModeAndNamingInOneCommand (both directions, and a rejected pair leaves the config unchanged). A failed save itself is not simulated in a test, since with one write there is no intermediate state left to observe.
…tries - `target X --mode M --target-naming N` ran the two setters, each saving the config, so a failed second save left half the change behind (Codex on #504). Both fields are now set and saved once, after the final pair is checked. - When a local folder holds the name a skill's naming now gives it, sync keeps the skill under its old entry and leaves the folder alone, even with --force. diff still called the folder a "local copy" and suggested `sync --force`, which does nothing for it. CLI and Web API diff, copy and merge mode, now report the folder and the entry the skill stays at.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0c82506d0c
ℹ️ 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".
| if utils.IsLinkMode(entryPath, info.Mode()) { | ||
| return isSymlinkToSource(entryPath, skill.Skill.SourcePath) |
There was a problem hiding this comment.
Require ownership before migrating a legacy link
When a copy-mode target contains an unmanaged symlink at an old naming candidate that points to this source skill, this branch assumes the link was created by merge mode even when it has no manifest record. A normal sync can consequently rename the user's link and replace it with a managed copy, whereas unmanaged target entries are otherwise preserved. Require the manifest to identify the link as managed (for example, with a "symlink" record) before treating it as a legacy entry.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 663b6f1. In copy mode a link at an old naming's name now counts as a managed legacy entry only when the manifest records it as "symlink" (what merge mode writes for links it creates) and it still points at the skill's source; a user's own link is left untouched, and the skill gets its copy under the new name. The manifest value is now the constant manifestSymlink. Covered by TestSync_TargetNamingPrefixed_LeavesUnmanagedLinkAlone (fails before the fix); TestSync_TargetNamingPrefixed_FromMergeKeepsLinkWhenLocalSkillTakesNewName still covers the merge-made link.
Copy mode treated any link to the skill's source at an old naming's name as the entry merge mode left behind, so a user's own link was renamed and replaced with a copy (Codex on #504). A link now migrates only when the manifest records it as "symlink", which merge mode writes for links it makes; other links stay as the user left them. The value is now a named constant.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 663b6f144d
ℹ️ 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".
| if old, ok := renamedFrom[resolved.TargetName]; ok { | ||
| dt.Items = append(dt.Items, diffItem{Skill: resolved.TargetName, Action: "skip", Reason: ssync.KeptLegacyReason(old), Kind: kindSkill}) |
There was a problem hiding this comment.
Represent legacy conflicts separately from forceable skips
When a naming migration finds the new name occupied, this emits the same skip action used for local copies. The dashboard's resourceGroups maps every skip through editedRow(force), so it hides KeptLegacyReason and, when Force is enabled, counts and labels this entry as one that will be replaced. The sync path deliberately keeps the destination and the legacy entry even with force, so the preview promises a change that never occurs; use a distinct action or teach the UI to recognize this reason.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bf08ef0. The Web API diff now sends this case as its own kept action instead of skip, and the dashboard's resourceGroups renders it like the (target naming) row: it shows the reason (KeptLegacyReason) and is not counted, with or without Force. Covered by TestComputeTargetDiff_LocalFolderOnNewNameKeepsLegacyEntry (asserts kept) and a syncView.test.ts case that checks the row is uncounted with Force on.
| if err := config.TargetNamingModeError(naming, mode); err != nil { | ||
| return err | ||
| } | ||
| oldNaming := config.EffectiveTargetNaming(sc.TargetNaming) |
There was a problem hiding this comment.
Report the effective inherited naming as the old value
When a target has no per-target target_naming and inherits standard or prefixed from the global/project config, sc here is the raw value returned by EnsureSkills, so sc.TargetNaming is empty and EffectiveTargetNaming reports flat. A combined --mode/--target-naming update therefore prints an incorrect transition such as flat -> prefixed even though the effective old value was standard; capture the effective naming before calling EnsureSkills or pass it into this helper.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in bf08ef0. Both callers now pass the effective naming from SkillsConfig() (which fills in the inherited global/project value) as the old value, so a target inheriting standard prints standard -> prefixed. Covered by TestTarget_SetModeAndNamingReportsInheritedNaming (fails before the fix).
Two problems Codex found on #504: - The Web API diff sent a local folder on a skill's new name as a "skip", which the dashboard shows as an edited entry that Force replaces. Sync keeps that folder and the legacy entry even with force, so the preview promised a change that never happens. It is now its own "kept" action, shown with its reason and not counted. - `target X --mode M --target-naming N` printed the target's own naming as the old value, so a target inheriting standard or prefixed showed "flat -> ...". It now prints the naming the target had in effect.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf08ef0edb
ℹ️ 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".
| case strings.HasPrefix(item.reason, sync.KeptLegacyPrefix): | ||
| add("kept", "warn", "Local only, skill kept under old name", item.name) |
There was a problem hiding this comment.
Exclude kept-name conflicts from syncable changes
When this is the only difference, assigning it kind: "warn" still reaches the default branch of renderDiffGroup, which sets next.skills = true, while renderGroupedDiffs counts the target as “to sync.” The CLI consequently recommends skillshare sync even though sync deliberately leaves both entries unchanged and the updated command documentation says the local folder must be renamed or deleted first; handle this category as non-syncable and retain that remediation in the output.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b664b50. Kept rows now carry a kept flag on the diff entry and count as neither sync nor local, so they no longer add to "N to sync"; their category has its own kind with the hint skillshare sync after renaming or removing the local folders kept under the old name, and a target whose only row is kept still shows the row and that hint. Covered by TestDiff_LocalFolderOnNewName_ReportsKeptLegacyEntry (copy and merge), which now asserts no "to sync" and the hint.
| // A kept item: a local folder holds the new name, so sync keeps the old entry, with or without force. | ||
| if (item.skill === '(target naming)' || item.action === 'kept') rows.push({ ...row, icon: 'kept', text: null, detail: item.reason, counts: false }); |
There was a problem hiding this comment.
Separate change sets with different legacy locations
When two targets migrate the same skill from different previous naming schemes—for example, one from flat and another from standard—these new rows have the same part, name, icon, and null text but different detail values naming the old entry. changeSets omits detail from its signature, so it merges the targets and displays the first target's legacy location for both; include the detail in grouping or keep these rows in separate sets.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b664b50. changeSets now includes the row detail in its signature, so targets keeping the same skill at different old entries stay in separate sets. Covered by a new syncView.test.ts case with two targets and different old names.
Two problems Codex found on #504: - A local folder on a skill's new name counted toward "N to sync" and fell through to the plain `skillshare sync` hint, though sync changes nothing there until the folder is renamed or removed. Such rows now carry a kept flag, count as neither sync nor local, and print their own hint; a target whose only row is kept still shows that row. - The dashboard grouped targets by row name and icon only, so two targets keeping the same skill at different old entries merged and showed one target's old location for both. The row detail is now part of the key.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b664b50ac7
ℹ️ 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".
| if info, err := os.Stat(targetSkillPath); err == nil { | ||
| if info.IsDir() { | ||
| if old, ok := renamedFrom[resolved.TargetName]; ok { | ||
| r.items = append(r.items, copyDiffEntry{action: "remove", name: resolved.TargetName, reason: sync.KeptLegacyReason(old), kept: true, dstDir: dstDir}) |
There was a problem hiding this comment.
Suppress file deletions for kept naming conflicts
When a copy-mode naming migration is blocked by a local folder, retaining dstDir on this kept entry makes diff --stat and diff --patch call diffSkillFiles("", dstDir), so every file in the untouched local folder is displayed with - as if sync will delete it. Sync deliberately preserves that folder, so omit its file-level diff or have the renderer skip stats for kept entries.
AGENTS.md reference: AGENTS.md:L15-L15
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 48bf4d0. Kept entries no longer carry dstDir, so ensureFiles builds no file list for them: diff --stat/--patch show nothing for the untouched folder, and the TUI no longer offers to expand it. Covered by TestDiff_LocalFolderOnNewName_ReportsKeptLegacyEntry, which now also runs diff --stat and asserts the folder's SKILL.md is not listed (fails before the fix).
A kept row (a local folder on a skill's new name) still pointed at that folder, so `diff --stat` and `--patch` listed each of its files as removed, though sync never touches the folder (Codex on #504). Kept rows no longer point at a target directory, so no file-level diff is built for them in the CLI or the TUI.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 48bf4d0acc
ℹ️ 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".
| if g.result.syncCount+g.result.localCount > 0 { | ||
| needCount += len(g.names) | ||
| } |
There was a problem hiding this comment.
Avoid reporting blocked naming migrations as in sync
When a target's only item is a kept naming conflict, this deliberately leaves needCount at zero even though r.synced is false. The summary then enters the no-differences branch and prints <target> is in sync or All N targets in sync, contradicting the conflict row and the manual rename/remove action required before migration can complete. Track kept-conflict groups separately so they remain non-syncable without being described as synchronized.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 69de979. Kept-only targets are now counted separately: the summary reads e.g. 1 target: 1 kept under old name (or 2 targets: 1 kept under old name, 1 in sync) with a warning mark, never "in sync", and Next still prints; the scan progress counts all rows. Covered by TestDiff_LocalFolderOnNewName_ReportsKeptLegacyEntry and TestDiff_KeptOnlyTargetIsCountedInSummary. The same review also fixed the JSON action, the old-location display and a bogus file stat for link renames (see the commit message).
| case item.kept: | ||
| add("kept", "kept", "Local only, skill kept under old name", item.name) |
There was a problem hiding this comment.
Show kept-entry remediation in the TUI
When diff launches its default interactive TUI and a naming migration is blocked by a local folder, this new kept category reaches buildDiffDetail, but that renderer neither displays the item's reason nor handles kept in its Next-step switch. The user therefore sees only the generic category and desired name, with no legacy location or instruction to rename/remove the blocking folder; add a kept-specific detail and remediation as the plain renderer now does.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 69de979. The TUI now shows each kept row as name (stays at old-name), gives the kept kind the warning style and the same Next hint as plain output (sync after renaming or removing the local folders kept under the old name), lists kept-only targets as N kept instead of "differs", and counts them as "kept under old name" in the title. Covered by TestDiffTUI_KeptOnlyTarget.
An exhaustive review of the kept-row change (prompted by two Codex findings on #504) found the same gap in several places: - A target whose only rows were kept was summarized as "in sync", and mixed summaries left it out of every count. Such targets now count as "N kept under old name" with a warning mark, and the scan progress counts them. - Plain output and the TUI hid where the skill stays; rows now read "name (stays at old-name)". The TUI also lacked the kept Next hint and called kept-only targets "differs"; it now matches the plain output. - `diff --json` emitted kept rows as "remove", indistinguishable from local-only folders; it now emits "kept", as the Web API does. The diff docs' JSON example also showed actions the CLI never emits. - Renamed rows whose old entry is a merge-made link showed a bogus file stat, because the link was walked as a file; a link now stands for the folder it points to. - A dry-run migration printed "Would copy" to the old path; it now names the new one.
|
@codex review |
…into runkids/sync-status-reporting Count a target whose rows need no sync but include kept skills as kept under old name, not in sync: #504 now reports kept rows separately, and this branch counts local-only targets as in sync. The diff docs keep both the synced and the kept-action sentences.
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…work (#509) Three reports told users to do something sync cannot do, or hid what it did: - Copy and merge sync kept a folder the user made on a skill's name but counted it as "up to date" with no hint. Sync now counts it as local and adds one capped line per target naming the folders and saying that `sync --force` replaces them. The line is added in SyncSkillTarget, so the dashboard gets it too. - status and doctor counted skills that sync skips on purpose (invalid names under standard or prefixed naming, name collisions) as "not synced — run skillshare sync". Running sync can never add them, so the advice looped. They now compare against the skills sync places. - diff marked a target whose only items were local-only folders as "to sync" and `synced: false`. Those items are still listed, but they no longer make the target pending.
…-ops as unchanged (#507) * fix(target): apply every setting flag, require flag values, report no-ops as unchanged `skillshare target <name>` dispatched --mode, --agent-mode and --target-naming through an if-chain that returned after the first match, so `--agent-mode copy --target-naming prefixed` applied one setting and silently dropped the other. Filters, --skills and --dry-run had the same early-return problem. - Check --mode, --agent-mode and --target-naming as a whole and save once, in global and project mode (one targetSettingsUpdate replaces six per-flag functions). - Reject --mode/--agent-mode/--target-naming combined with filters or --skills, and --dry-run without --skills, instead of dropping them. - A value flag followed by another flag (or an empty string) now reports "<flag> requires a value"; `--target-naming -p` used to report an invalid naming '-p'. - A value the target already has is reported as unchanged and the config is not rewritten. * fix(target): leave the skills pair alone on agents-only changes A target with skills off may keep target_naming prefixed with a merge mode it cannot sync; validateGlobalTarget and validateProjectTarget only check that pair for enabled skills. The combined settings update ran the pair check for every setting, so `target claude --agent-mode copy` was refused on such a target although the old agent-mode handler never looked at skills settings. Check the pair only when --mode or --target-naming is given. * docs(target): show combined settings in --help and the built-in skill The combined --mode/--agent-mode/--target-naming form is now the way to move a target to copy + prefixed in one step, but neither the help examples nor the built-in skill's target reference showed it.
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.
Type
proposals/only — see CONTRIBUTING.md)Follow-ups to #502 (
target_naming: prefixed), found by simulating the #497 reporter's switch frommerge+flattocopy+prefixedin the devcontainer.What changed
target X --mode copy --target-naming prefixedapplied only--mode. The setter dispatch returned after the first flag. Both flags given together now check the final pair first, then apply in an order that keeps the saved pair valid. Global and project (-p). An invalid final pair is rejected with the config unchanged.Skipped skills were only counted. A prefixed name over 64 characters disappeared behind
1 skill(s) skipped (naming validation), although the docs promise a warning. Sync now lists the first five skipped skills with their reason, then... and N more. The cap keeps very large sources from flooding the output, which is why the per-skill lines were collapsed in f01ec9e.Merge → copy plus a naming change pruned the old link when a local folder held the new name. Only links the manifest records as merge-made (
symlink) migrate; a user's own link is left alone (Codex on this PR). In copy mode, a merge-mode link to the skill was not a managed entry, so the documented "old managed entry is preserved" did not happen and the skill left the target. Copy mode now migrates such a link like a managed copy; the copy loop already replaces a link with a copy before writing, so nothing is written through the link.PATCH
/api/targetswithskills_enabled: falseplus a mode change was rejected (Codex on feat(sync): add target_naming: prefixed for copy-mode targets #502, r4231171818). It now validates the pair the request leaves the target in.diffcalled a local folder on a skill's new name a "local copy" and suggestedsync --force. Sync keeps the skill under its old entry and leaves that folder alone, even with--force. CLI and Web API diff (copy and merge) now report it asLocal only, skill kept under old namewith the entry the skill stays at. The Web API uses a separatekeptaction, which the dashboard shows with its reason and never counts as a Force replacement. These rows do not count toward "N to sync",--stat/--patchlist none of the folder's files, and diff's Next says to rename or remove the folder before syncing.Both flags given together are set and saved once (Codex on this PR), so the config never holds half of the change, and the printed old naming is the one the target had in effect (inherited or its own).
target.mdanddiff.md(and ja/ko/zh-Hans/zh-Hant) document passing both flags in one command and the new diff row.Linked Issue
Context: #497. Codex finding on #502: #502 (comment)
Checks run (devcontainer)
make check: passedTestTarget_SetModeAndNamingInOneCommand,TestDiff_LocalFolderOnNewName_ReportsKeptLegacyEntry,TestComputeTargetDiff_LocalFolderOnNewNameKeepsLegacyEntry,TestSync_TargetNamingPrefixed_FromMergeKeepsLinkWhenLocalSkillTakesNewName,TestSync_TargetNamingStandard_InvalidSkillWarnsAndSkips(extended),TestHandleUpdateTarget_DisablingSkillsSkipsNamingCheck/simplify(applied: reuseconfig.IsValidSyncMode; reuse the caller'sLstatresult viautils.IsLinkMode) and two-axis code review (fixed a stray space in the ja doc);/simplifyagain on the second round (applied: sharedKeptLegacyPrefixinstead of a duplicated string literal); and on the third round (applied:manifestSymlinkconstant, nil-manifest check hoisted); and on the fourth round (applied: thekeptrow reuses the existing info-row condition); and on the fifth round (applied: akeptflag on the diff entry instead of matching the reason text in two places); the sixth round found nothing to changevitest run src/components/syncandtsc --noEmitin the devcontainer: passedpython3 scripts/ai-context.py check: passedKnown limits (not changed here)
--agent-modecombined with--modeor--target-namingstill applies only--agent-mode(pre-existing, same dispatch pattern).Checklist
make check) — for code changes