Skip to content

fix(reconcile): keep tracked repo declarations this machine has not cloned - #880

Merged
runkids merged 32 commits into
runkids:mainfrom
salmonumbrella:fix/preserve-pulled-skill-records
Nov 14, 2026
Merged

runkids merged 32 commits into
runkids:mainfrom
salmonumbrella:fix/preserve-pulled-skill-records

Conversation

@salmonumbrella

@salmonumbrella salmonumbrella commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

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)

Maintainer go-ahead given directly; see #823. This is slice 1a, preserving tracked repository declarations across machines. Pulling does not install missing checkouts here.

What changed

  • Global reconcile preserves sourced tracked declarations and their audit acceptances when this machine has no checkout or discovery skips the path.
  • Declaration-only uninstall preserves independent grouped repositories and their acceptances. CLI and dashboard use shared name resolution and unlink cleanup in internal/uninstall.
  • Global unlink saves its removed metadata beside the trashed link for undo, and reports metadata cleanup faults as partial results. Owner tests cover scope, persistence and refusal rules; callers cover translation and wiring.
  • Status, check, update and doctor offer global users both restore and record-removal guidance. Project mode suggests project install only.
  • CLI JSON and CLI/API operation logs identify record-only removals. The wiki, English command docs, existing translations and built-in guidance describe the contracts.
  • Dashboard declarations and messages remain available in all 11 locales. Against integrated upstream 08ecb7af: 97 files, +2,643/−203.

Why

A installs a tracked repository and pushes. B pulls the metadata but has no ignored checkout. Installing another skill on B used to prune the declaration and its acceptance, which B then pushed back to A. Keeping the declaration prevents that loss; unlink and declaration-only uninstall provide supported ways to remove it.

Schematic explainer recorded at 3bc20e31 (UI and terminal examples):

fix-reconcile-keep-tracked-repo-declarations-this-machine-has-not-cloned.mp4

Usage

skillshare uninstall _team -g --json
skillshare unlink _dev-skills -g
skillshare trash restore _dev-skills -g

Use global mode for declaration-only removal. Run skillshare install -g to restore a missing checkout. Project mode retains its existing behavior.

uninstall --json keeps all successful names in removed and identifies removals without trash undo in the optional record_only subset. With dry_run: true, these are planned actions. CLI operation logs carry the same subset; API operation logs include recordOnly and movedToTrash.

Limitations

  • Existing reconcile rules can normalize an occupied non-checkout path into ordinary metadata. A later uninstall then uses ordinary removal behavior; occupant protection applies while the record is still a tracked declaration.
  • Moving a checkout outside skillshare can leave the old declaration and a new record. This PR does not infer a rename.
  • Historical underscore-prefixed member records without a recorded parent can be indistinguishable from repository declarations.
  • Metadata reload and execution-time checkout checks are not a cross-process filesystem transaction.
  • Declaration-only removal moves nothing to trash. Unlink undo restores the metadata saved with that link.

Verification

At ccfd958431bc311a0d07c3a9608bfe77475a1eb5:

  • make check passed once on a fresh isolated Linux checkout of this exact commit, as UID 65534 with no capabilities, synthetic HOME/XDG, and no GIT_CONFIG_GLOBAL. Go unit/build/integration checks and all 138 Herdr tests passed in 2m20s; the Boat machine was deleted and deletion completion confirmed. Full output SHA-256: e63ff42bd70a017b796431402faaa2df2bc500db0d3c3065affe46b1887272e5.

  • Upstream CI and Nix passed: seven checks, including Linux/macOS integration, Windows and the offline sandbox. The online sandbox and redteam signal jobs were skipped by their workflows.

  • Focused Boat tests passed before each staged push. The blocking declaration regression first failed against the old matcher, then passed with the fix. The final focused checks cover install/uninstall/source links, source filesystem and walk ratchets, CLI/API translation, and real CLI unlink/uninstall flows.

  • All five website locale builds passed on the final patch, whose committed diff exactly matches the tested patch.

  • Retained dashboard validation and captures below are from 3bc20e31: UI lint, 899 tests across 109 files, the UI build and browser capture passed in run 43422084512. Visual review covered 66 stills, all 635 sampled frames through contact sheets, and 111 full-size caption/transition frames. Not every encoded frame was separately viewed. This packet is historical dashboard evidence; it was not rerun for the new internal/CLI repairs.

  • Earlier Boat runner failures remain recorded: mode-000 tests also failed on unchanged main 08ecb7af with CAP_DAC_READ_SEARCH, and a later runner incorrectly shared Git config across test homes. The corrected environment uses UID 65534, zero capabilities, and no GIT_CONFIG_GLOBAL; no test was weakened.

The retained browser packet uses an isolated backend and synthetic files. Its labelled 500, status-409 and unlink-warning responses demonstrate client handling, not backend persistence failures. Owner save-failure coverage and routed reload-failure coverage are separate. No real native-client or Windows-VM manual run was performed.

Dashboard captures

Retained isolated dashboard builds: Before b7c34d6a, After 3bc20e31. Dark Clean style, synthetic data, headless browser DPR 1. Desktop app viewport is 1440×1044 and German narrow viewport 1024×844; a separate 56px caption matte makes the exports 1440×1100 and 1024×900. No app content is scaled or covered by captions. The baseline has no declaration-only rows, so those Before cells show its actual loaded dashboard.

After action recording (H.264, 128.43 seconds). It retains the confirmation, refusal, explicit force and result steps. One 1.65-second Dashboard-to-Skills loading interval is omitted at exported time 114.22s; this is a chaptered recording, not continuous real time. Captions identify synthetic 500/status-409/warning responses; these demonstrate client handling, not backend persistence failures.

removal-sequence.mp4
33 Before/After pairs, including German narrow confirmation
State / viewport Before After
Desktop / absent row Before: Desktop / absent row After: Desktop / absent row
Desktop / occupied row Before: Desktop / occupied row After: Desktop / occupied row
Desktop / absent confirm Before: Desktop / absent confirm After: Desktop / absent confirm
Desktop / absent result Before: Desktop / absent result After: Desktop / absent result
Desktop / occupied confirm Before: Desktop / occupied confirm After: Desktop / occupied confirm
Desktop / occupied result Before: Desktop / occupied result After: Desktop / occupied result
Desktop / blocked confirm (labelled synthetic response) Before: Desktop / blocked confirm (labelled synthetic response) After: Desktop / blocked confirm (labelled synthetic response)
Desktop / blocked error (labelled synthetic response) Before: Desktop / blocked error (labelled synthetic response) After: Desktop / blocked error (labelled synthetic response)
Desktop / restored confirm Before: Desktop / restored confirm After: Desktop / restored confirm
Desktop / restored guard Before: Desktop / restored guard After: Desktop / restored guard
Desktop / restored checkout confirm Before: Desktop / restored checkout confirm After: Desktop / restored checkout confirm
Desktop / restored result Before: Desktop / restored result After: Desktop / restored result
Desktop / restored dirty confirm Before: Desktop / restored dirty confirm After: Desktop / restored dirty confirm
Desktop / restored dirty guard Before: Desktop / restored dirty guard After: Desktop / restored dirty guard
Desktop / restored dirty checkout confirm Before: Desktop / restored dirty checkout confirm After: Desktop / restored dirty checkout confirm
Desktop / restored dirty refusal Before: Desktop / restored dirty refusal After: Desktop / restored dirty refusal
Desktop / restored dirty result Before: Desktop / restored dirty result After: Desktop / restored dirty result
Desktop / restored status confirm Before: Desktop / restored status confirm After: Desktop / restored status confirm
Desktop / restored status guard Before: Desktop / restored status guard After: Desktop / restored status guard
Desktop / restored status checkout confirm Before: Desktop / restored status checkout confirm After: Desktop / restored status checkout confirm
Desktop / restored status refusal (labelled synthetic response) Before: Desktop / restored status refusal (labelled synthetic response) After: Desktop / restored status refusal (labelled synthetic response)
Desktop / restored status result Before: Desktop / restored status result After: Desktop / restored status result
Desktop / clean confirm Before: Desktop / clean confirm After: Desktop / clean confirm
Desktop / clean result Before: Desktop / clean result After: Desktop / clean result
Desktop / dirty confirm Before: Desktop / dirty confirm After: Desktop / dirty confirm
Desktop / dirty refusal Before: Desktop / dirty refusal After: Desktop / dirty refusal
Desktop / dirty result Before: Desktop / dirty result After: Desktop / dirty result
Desktop / unlink healthy confirm Before: Desktop / unlink healthy confirm After: Desktop / unlink healthy confirm
Desktop / unlink healthy result Before: Desktop / unlink healthy result After: Desktop / unlink healthy result
Desktop / unlink warning confirm (labelled synthetic response) Before: Desktop / unlink warning confirm (labelled synthetic response) After: Desktop / unlink warning confirm (labelled synthetic response)
Desktop / unlink warning result (labelled synthetic response) Before: Desktop / unlink warning result (labelled synthetic response) After: Desktop / unlink warning result (labelled synthetic response)
German narrow / long row Before: German narrow / long row After: German narrow / long row
German narrow / long confirm Before: German narrow / long confirm After: German narrow / long confirm

Complete hosted packet, traces, checksums and source identities.

Linked Issue

Refs #823

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

AI assistance was used. The two author confirmations remain for Vladimir to complete personally. Vladimir will answer the maintainer review directly.

salmonumbrella and others added 13 commits November 12, 2026 19:02
Exercise the two-machine push and pull sequence and reconciliation states so
missing tracked clones cannot silently erase shared install intent.
Pull transfers tracked repository metadata but not ignored clones. Keep the
missing records during global reconciliation so another install and push cannot
erase shared intent or accepted audit findings on every machine.
Use the shared sandbox fixture for both reconciliation tests so their home
and configuration paths remain isolated from the invoking environment.
Legacy tracked members and unfollowed source links can hide declarations
from the local walk. Preserve sourced tracked records regardless of their
path so unrelated installs cannot erase them or their audit acceptances.

Document restoring a missing checkout before uninstalling it and cover
migration, link collisions, aliases, and explicit removal.
The tracked-record unit test also seeded a missing plain record and a
live plain record. TestReconcileGlobalSkills_PrunesStaleEntries already
pins both outcomes: a sourced plain record whose folder is gone is
pruned, and one on disk survives. The tracked record with no source
still catches a fix that keeps everything or skips the prune.

The two-machine test passed HOME and SKILLSHARE_CONFIG to RunCLIEnv,
which already sets both from the sandbox for each child process.
Separate homes, XDG paths, client overrides and git config remain.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Expect sourced tracked declarations to survive reconciliation with either
source-link policy, so the test matches the cross-machine retention contract.
Retain only sourced tracked repository declarations during reconciliation.
Migrated member records are not restorable as repositories and retaining them
would leave permanent misleading install requests and audit acceptances.
A source link can exist before a tracked repository declaration is pulled. Preserve that declaration when the linked folder is not a checkout so later reconciliation does not discard its record and audit acceptances.
A followed group can contain the path of a pulled legacy repository declaration, which must retain its tracked intent while its key migrates.
Keep the isolated CLI runner in the collision subtest that uses it so the integration test package can compile.
A retained declaration cannot restore a checkout while another folder or source link occupies its destination, and restoration requires a reachable source. State those prerequisites in each manifest translation.
A migrated underscore-named member can otherwise survive a missing checkout as a repository declaration. Check recorded ancestor paths while preserving ambiguous grouped declarations and unrelated aliases.
Explain that project declarations without local install records remain available so teammates can install them after cloning.
@salmonumbrella

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 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-13T06:32:18.117460Z b7c34d6 Draft marked ready
ℹ️ 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

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@salmonumbrella
salmonumbrella marked this pull request as ready for review November 13, 2026 05:24

@runkids runkids left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for tracking this down. The two-machine push/pull test makes the original record loss easy to see.

I'm requesting changes. Tracked records are now never pruned, and that causes two behaviour problems. There are also a few smaller items. Line numbers refer to b7c34d6.

1. A linked checkout's record outlives unlink (blocking)

  1. skillshare link ~/code/dev-skills --enable creates _dev-skills.
  2. The next reconcile sees .git through the link and records _dev-skills as tracked, with its origin as the source. This already happens on main.
  3. skillshare unlink _dev-skills removes the link but leaves the record. Both the CLI (cmd/skillshare/link.go:194) and the dashboard (internal/server/handler_source_links.go:122) only call sourcelink.Remove.
  4. On main, the next install pruned that record. With this PR, the new loop in internal/config/reconcile.go:43-67 keeps it. As a result:
    • doctor, status, check and update --all report a missing clone.
    • skillshare install clones the user's own repo as a tracked repo.
    • uninstall _dev-skills says not found.
    • push sends the record to every other machine.

Reconcile can't tell this record from a pulled declaration. Two possible fixes:

  • unlink drops the matching record.
  • Reconcile doesn't record checkouts behind a followed link as tracked. This matches TrackedAncestor, which says "a checkout behind a link … does not count".

2. A kept declaration has no way out

  • The source is unreachable from this machine.

    • install fails on every run.
    • uninstall says not found.
    • The dashboard's DELETE /api/repos/{name} says "not a tracked repository".
    • check --exit-code returns 1 indefinitely.

    The only ways out are to uninstall on a machine that has the checkout, which removes the repo everywhere, or to edit .metadata.json by hand.

  • The _team path is occupied by a link or a plain folder.

    • status and check say "directory is absent" (cmd/skillshare/tracked_metadata.go:20) while the directory exists.
    • The suggested skillshare install skips the entry as "already exists" (internal/install/install_config.go:199-208).
    • update --all sends the linked folder to update.TrackedRepo (cmd/skillshare/update.go:274, update_batch.go:115).

    On main this state lasted only until the first install. Now it is permanent.

Please add a supported way to remove a declaration that has no checkout, with tests for both cases above. One option is to let uninstall <name> accept a tracked record that exists only in metadata. That would also resolve the first item in the PR's Limitations.

Keeping Tracked across a followed link (internal/config/reconcile_core.go:119) doesn't look necessary for the pulled-record fix, and it is what makes the occupied-path state permanent. I'd prefer to drop it from this PR.

3. Docs

  • website/docs/understand/declarative-manifest.md:82: the install-then-uninstall step needs a reachable source, and it restores every missing declaration, not only the one being removed. Please revise this once the change from section 2 is in.
  • These pages should say that deleting a checkout no longer removes its declaration, and explain how to remove one:
    • troubleshooting/common-errors.md:303-319
    • reference/commands/uninstall.md:171-190
    • understand/tracked-repositories.md:160-170
    • the translations of those pages

Smaller items (non-blocking)

  • tests/integration/link_test.go:218 re-tests rules that internal/config/reconcile_test.go:592 and :618 already cover. wiki/testing.md asks for each rule to be tested once, in the package that owns it. The push/pull test is a real cross-package flow, so keep that one.
  • The new loop in reconcile.go follows the same pattern as keepNestedRecords (reconcile_core.go:219). Consider extracting it into a helper next to that function.
  • At reconcile_core.go:119, existing.Source != "" is always true, and d.Name() already gives the basename.
  • The new unit tests use testutil.NewSandbox, while the rest of reconcile_test.go uses t.TempDir() with t.Setenv.
  • The same client env override appears in both link_test.go:226 and push_pull_test.go:170.

Last, the two author checkboxes are still unchecked, and the PR body says no local tests were run. The AI-assisted section of CONTRIBUTING.md asks you to run make check locally and tick both boxes before the next round.

Thanks again for the careful write-up!

@salmonumbrella
salmonumbrella marked this pull request as draft November 13, 2026 06:23
@salmonumbrella
salmonumbrella marked this pull request as ready for review November 13, 2026 06:26
Restore baseline normalization for present paths while retaining absent
repository declarations through the shared metadata predicate. Isolate the
reconcile fixtures without building a CLI and share native-client overrides
without changing the original two-machine record and audit regression.

Validation: gofmt, git diff --check and context-router check only.
Runtime, builds and tests were not executed under the source-only gate.
Extend the metadata and uninstall owners to remove a declaration without
reading or moving its occupant, contacting its source, or changing trash
and gitignore. A failed metadata save makes every metadata-only result fail.

Clean up global unlink records in CLI and API, preserve existing-path name
precedence, report record-only results truthfully, and list declarations in
the dashboard API with noCheckout. Keep project removal behavior unchanged.
Remove the obsolete grouped-link walker-policy assertion while preserving
grouped absent declarations and the original record/audit A/B regression.

Validation: source-only five-pass review, gofmt, git diff --check and the
context-router check. No runtime, builds, tests or frontend tooling ran.
Stop at commit 15 for the mandatory Luna checkpoint before UI and docs work.
Preserve CLI records and audit acceptances written while the dashboard is open. Resolve new declarations from disk and refuse stale-cache saves after a reload failure, retaining unlink success when its link already moved.
Show declaration-only rows without checkout actions or status promises. Reuse Uninstall with record-specific confirmation and feedback, keep real-checkout force handling, and refresh the missing-entry list after repository removal or unlink.
Document direct global declaration removal and optional restore in English and all four translations, including occupied paths and normalization after reconcile. Keep built-in guidance accurate and use the existing API removal result for dashboard success feedback after concurrent CLI changes.
A tracked declaration can be restored through the CLI while its dashboard
row still says there is no checkout. Treat a forceable uninstall refusal
as evidence of the current checkout and promote the existing confirmation
to its dirty or unreadable-status warning before allowing explicit force.

Author stale-row regressions for both forceable codes before the source
repair, and retain nonforceable failure and actual-result success feedback.
Validation: five serial source review passes, git diff --check, and the
context-router check. Tests, builds, runtime and frontend tooling were not
run under the source-only gate.
The overview fixture added declarations only to the in-memory skills store,
which the real request's config reload replaced with on-disk metadata. The
hosted unit, offline, and Nix jobs consequently returned no tracked rows.

Save the complete fixture through MetadataStore before serving the request
and fail setup on a save error. Keep the middleware, assertions, and
production behavior unchanged.
Removing a missing _team declaration from the dashboard could resolve the
different org/_team checkout by basename and trash it instead.

Reload metadata before declaration lookup, give exact declarations priority,
and preserve checkout resolution before non-exact declaration fallback.
Add routed absent/occupied regressions and checkout precedence guards, and
persist existing checkout fixtures so the metadata reload keeps their state.

Validation: gofmt, git diff --check, and context-router check passed.
Tests were authored but not run under the source-only fleet restriction.
Bind dashboard record-only removal to its canonical declaration and refuse
restored checkouts before checkout resolution or force. Refresh the row and
require another confirmation before moving a restored checkout to trash.

Keep unresolved uninstall inputs and their reasons in JSON failed results,
including all-invalid requests, partial successes and dry runs. Report unlink
metadata cleanup failures as partial results, refresh completed unlinks and
show localized warnings. Keep CLI and dashboard guidance aligned.

Regression tests were authored before source changes and remain unrun under
the source-only task restriction. Static formatting, diff and router checks
passed; no build, product runtime, frontend tooling or test suite was run.
Write the unlink result after global metadata cleanup so load and save
failures retain their diagnostic and report partial success. Preserve the
successful link removal, warning, target and exit policy, and the existing
link, project unlink and native removal failure behavior.

Add the corrupt-metadata regression before the fix; leave it unrun under
the source-only authorization. Formatting, diff and context-router checks
pass; runtime verification remains with the coordinator.
Reconcile can normalize a followed link's record to untracked, and linked
collections can retain nested repository declarations. Clean the removed
namespace through the existing metadata path owner in both unlink callers,
including audit acceptances, while keeping declaration uninstall strict.

Author CLI and route regressions before the source fix for normalized and
nested records, sibling preservation, and subsequent bare install. Tests
remain unrun under the source-only task restriction; static checks only.
A declaration selected while absent can become a checkout before removal
runs. Recheck the resolved source-relative name in the shared metadata-only
execution owner and refuse before touching metadata, regardless of force.

Reuse the existing dashboard conflict response and refresh/reselection flow
for this refusal, preserving the earlier record-only intent guard. CLI
results already carry shared execution failures through text and JSON.

Author restoration, force, absent/occupied control and client boundary
regressions before production edits. Correct the unlink fixture name and
response-key assertion found in serial static review. All tests remain
unrun under the source-only restriction; formatting/diff/router checks pass.
Merge upstream/main at 08ecb7a
so the final validation includes credential-safe operation logging (runkids#881)
and fail-closed audit-rule loading for installs (runkids#882).

Retain the released record-preservation and maintainer removal rework
at 2facc52 in full. The merge applied
without conflicts; both documentation contracts remain present.

Preserve upstream's synthetic loopback fixture without edits. Use Vladimir's
one-time --no-verify exception for this exact merge after proving the staged
tree equals the automatic merge, checking the hook paths, and confirming the
scanner reports only the exact synthetic fixture finding. Later commits use
normal hooks.

Five serial source-review passes, git diff --check, and the context-router
check passed. Runtime checks were not run under the source-only brief.
Resolve a declaration or checkout to one item and canonical name before
using the existing uninstall, conflict, log and success response tail.
Keep metadata-only removal unforced, preserve its error and cache recovery
behavior, and report movedToTrash from the selected item.

Preserve exact declaration precedence, record-only checkout refusals,
ordinary checkout errors and project behavior without changing tests.
Five serial source review passes, gofmt, diff checks and the context-router
check completed. Tests and builds remain unrun under the source-only brief.
Limit unlink's legacy group matching to members so a retained declaration
such as team/_repo survives unlinking _team. Share snapshot and removal
matching while keeping generic uninstall's legacy contract unchanged.

Save the exact removed records, audit acceptances and target overrides
through uninstall's existing trash sidecar owner before pruning metadata.
Keep metadata on sidecar failure and preserve completed-unlink warnings,
fresh reloads, cache refresh and project-mode behavior.

Author owner, CLI and API regressions for namespace collisions, undo,
partial failures and project/empty controls. Source-only verification:
gofmt, diff check and context-router check passed; runtime tests, builds,
frontend checks and final make check remain unrun for root-owned gates.

@runkids runkids left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the rework. Every blocking item from the last round is addressed: unlink now forgets the linked record and keeps a copy for trash restore, a declaration without a checkout can be removed from the CLI and the dashboard, the followed-link Tracked change is gone, and the docs and translations are updated.

I'm still requesting changes for one data-loss bug in the new removal path, plus a few smaller items. Line numbers refer to 3bc20e31c.

1. Removing _team's record also deletes team/_b (blocking)

ForgetTrackedRepo (internal/install/metadata.go:446) matches with removedWith, whose legacy-group check inLegacyRepoGroup matches every tracked entry with Group == "team".

  1. On machine A: skillshare install org/a --track --name team, then skillshare install org/b --track --into team. Reconcile records team/_b as {Tracked: true, Group: "team"}.
  2. A pushes; B pulls and has neither checkout.
  3. On B, skillshare uninstall _team -g (or the dashboard's record removal) also deletes team/_b and its audit acceptances.
  4. Record-only removal writes no trash entry, so there is no undo, and the next push removes team/_b everywhere.

On a normal checkout uninstall, reconcile restores the record from disk, so this match was harmless. A declaration has no checkout, so the loss is permanent. 3bc20e31c fixed the same match for unlink with unlinkedWith (metadata.go:473). Please do the same for declaration removal, and add the case to the test: tracked_declaration_test.go:98 removes team/_repo before ForgetTrackedRepo("_team") runs at :102, so it never covers it.

2. The missing-repo hint still only says install

Declarations now stay until they are removed, but status, check, update (cmd/skillshare/tracked_metadata.go:16) and doctor (cmd/skillshare/doctor.go:895) still only suggest skillshare install. When the source is unreachable, that advice fails on every run, and the user is never told about uninstall <name> -g. Please mention it in global mode (project mode has no record-only removal), and update website/docs/reference/commands/update.md:122 and :251 with their translations.

3. Smaller items

  • Logic duplicated between the CLI and the server. The name-resolution order (exact declaration, then disk, then declaration shorthand) is in both cmd/skillshare/uninstall.go:182 and internal/server/handler_skills.go:436-480. The unlink cleanup is in both cmd/skillshare/link.go:206-215 and internal/server/handler_source_links.go:131-155. wiki/cli-development.md asks for one shared implementation in internal/, so a fix in one place reaches the other. Item 1 is an example of why.
  • Tests repeat the same rules at several levels. For example, the unlink cleanup scope is asserted in internal/install, internal/uninstall, the server handler and tests/integration/link_test.go. The restored-checkout refusal is asserted in three places too. wiki/testing.md asks for each rule once, in the package that owns it, with handler and CLI tests covering translation only.
  • The wiki is stale. wiki/cli-development.md:61 still says unlink moves only the link to trash. wiki/audit.md:59 still lists only two error_codes, and does not mention recordOnly, noCheckout, movedToTrash: false or the unlink warning field.
  • Record-only removal looks like a normal uninstall. The operation log writes type: repo in both cases (handler_skills.go:503), and CLI --json only reports removed, so a script or skillshare log can't tell whether there is anything to restore from trash.

Last, the two author checkboxes are still unticked. CONTRIBUTING.md's AI-assisted section also asks the author to answer reviews directly, so please reply here yourself rather than through drafted replies.

Thanks again for working through all of this!

Limit declaration-only cleanup to the precise namespace and legacy members already used by unlink. Keep independently installed prefixed repositories, their audit acceptances, and overrides when forgetting a missing checkout.
Offer global record removal when restoring an unreachable source is unwanted. Keep project recovery scoped to install -p, share the hint with doctor, and align update documentation in every existing locale.
Keep declaration resolution and unlink metadata ordering in shared owners so CLI and API preserve the same scope and recovery behavior. Consolidate domain regressions while retaining caller translation coverage.

Distinguish record-only removals in API and CLI operation logs and CLI JSON, including mixed batches and dry runs. Document outcome fields, warning semantics, and current API error codes across existing locales.
@salmonumbrella

Copy link
Copy Markdown
Contributor Author

@runkids thanks for the second review. Everything from it is fixed and pushed in ccfd958: the _team removal no longer touches team/_b (with the missing test case), the global missing-repo hint now mentions uninstall -g, and the CLI/server logic, test duplication, wiki and record-only log/JSON output are cleaned up. make check passes and CI is green. Could you take another look when you have time?

@runkids runkids left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the third pass. Everything from the second review is addressed: removing _team's declaration keeps team/_b with a test for it, the missing-repo hint mentions uninstall <name> -g in global mode, name resolution and unlink cleanup now live in internal/uninstall, the wiki is current, and record-only removals show up in --json and the operation logs.

One related case remains on the checkout uninstall path: removedWith still uses the broad legacy-group match, so uninstalling a _team checkout can drop a team/_b declaration that has no checkout. It is not a regression from main, so I've filed it as #898 rather than holding this PR.

Approving and merging.

@runkids
runkids merged commit 3217d44 into runkids:main Nov 14, 2026
16 of 17 checks passed
runkids added a commit that referenced this pull request Nov 14, 2026
)

TestDoctor_JSON_StreamDefersPluginCheck required the pending plugins
row to follow hooks directly. Git status also runs in the background
in a streamed doctor and is recorded at whichever check comes next,
so on a fast runner its result can land between hooks and plugins,
and the test failed on ubuntu CI (seen on #880). The order the test
guards is unrelated to Git, so leave git_status out of the list.
runkids added a commit that referenced this pull request Nov 14, 2026
…up (#900)

Uninstalling the _team checkout matched every tracked entry grouped as
"team", so a repo installed with --into team (team/_b) lost its record
and audit acceptances too. Since #880 keeps declarations that have no
checkout on this machine, reconcile could no longer restore that record,
and the next push removed it on every machine; only trash restore of
_team brought it back.

#880 already excluded _-prefixed repo directories from the legacy match
for unlink and declaration-only removal. Move that guard into
inLegacyRepoGroup so checkout uninstall and its trash copy follow the
same rule.

Fixes #898
runkids added a commit that referenced this pull request Nov 14, 2026
Since #880, the Dashboard lists a tracked repository that is recorded in
metadata but not cloned on this machine, marks it "No checkout on this
machine", and its Uninstall removes only the record and audit acceptances.
The Dashboard row in the ui reference still described only checkout
uninstalls, so readers could expect the repo to move to trash.
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.

2 participants