Skip to content

uninstall of a tracked repo also removes independent nested declarations such as team/_b #898

Closed

Description

@runkids

Follow-up from #880.

#880 keeps tracked repository declarations that this machine has no checkout for, and fixed declaration-only removal so that forgetting _team no longer deletes an independent team/_b declaration (ForgetTrackedRepo now matches with unlinkedWith). Uninstalling a checkout still matches with removedWith, which keeps the broad legacy-group check, so the same loss can happen there.

Steps

  1. Machine A: skillshare install org/a --track --name team -g, then skillshare install org/b --track --into team -g. Metadata records team/_b as {Tracked: true, Group: "team"}. Push.
  2. Machine B: pull. _team gets a checkout; team/_b stays a declaration without a checkout (for example its clone failed).
  3. On B: skillshare uninstall _team -g.

Result

team/_b's declaration and its audit acceptances are removed together with _team:

  • moveOut saves them into _team's trash entry (Extract uses removedWith).
  • Run then prunes them through RemoveByNames → removedWith → inLegacyRepoGroup, which matches every tracked entry with Group == "team" (internal/install/metadata.go).

Reconcile cannot restore the record because there is no checkout. Only skillshare trash restore _team -g brings it back; if B pushes first, A loses it too.

This is not a regression from before #880, where reconcile pruned the declaration anyway, but it defeats what #880 preserves.

Expected

Uninstalling _team removes _team, its namespace and its genuine legacy members, and keeps independently installed prefixed repositories such as team/_b, the same way ForgetTrackedRepo and unlink now do.

Suggested fix

Apply the guard unlinkedWith already uses (!utils.IsTrackedRepoDir(path.Base(full))) to the legacy-group clause of removedWith, ideally by moving it into one shared legacy-group rule, so Extract, RemoveByNames, ForgetTrackedRepo and unlink share one definition. Add the case above to the RemoveByNames / Extract tests and check the existing legacy-group tests still pass.

Activity

  1. added
    bug
    on Nov 14, 2026
  2. added a commit that references this issue on Nov 14, 2026
    58ccb2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions