Repository navigation
fix(reconcile): keep tracked repo declarations this machine has not cloned - #880
Conversation
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.
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
runkids
left a comment
There was a problem hiding this comment.
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)
skillshare link ~/code/dev-skills --enablecreates_dev-skills.- The next reconcile sees
.gitthrough the link and records_dev-skillsas tracked, with itsoriginas the source. This already happens on main. skillshare unlink _dev-skillsremoves 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 callsourcelink.Remove.- On main, the next install pruned that record. With this PR, the new loop in
internal/config/reconcile.go:43-67keeps it. As a result:doctor,status,checkandupdate --allreport a missing clone.skillshare installclones the user's own repo as a tracked repo.uninstall _dev-skillssays not found.pushsends the record to every other machine.
Reconcile can't tell this record from a pulled declaration. Two possible fixes:
unlinkdrops 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.
installfails on every run.uninstallsays not found.- The dashboard's
DELETE /api/repos/{name}says "not a tracked repository". check --exit-codereturns 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.jsonby hand. -
The
_teampath is occupied by a link or a plain folder.statusandchecksay "directory is absent" (cmd/skillshare/tracked_metadata.go:20) while the directory exists.- The suggested
skillshare installskips the entry as "already exists" (internal/install/install_config.go:199-208). update --allsends the linked folder toupdate.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-319reference/commands/uninstall.md:171-190understand/tracked-repositories.md:160-170- the translations of those pages
Smaller items (non-blocking)
tests/integration/link_test.go:218re-tests rules thatinternal/config/reconcile_test.go:592and:618already cover.wiki/testing.mdasks 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.gofollows the same pattern askeepNestedRecords(reconcile_core.go:219). Consider extracting it into a helper next to that function. - At
reconcile_core.go:119,existing.Source != ""is always true, andd.Name()already gives the basename. - The new unit tests use
testutil.NewSandbox, while the rest ofreconcile_test.gousest.TempDir()witht.Setenv. - The same client env override appears in both
link_test.go:226andpush_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!
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
left a comment
There was a problem hiding this comment.
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".
- On machine A:
skillshare install org/a --track --name team, thenskillshare install org/b --track --into team. Reconcile recordsteam/_bas{Tracked: true, Group: "team"}. - A pushes; B pulls and has neither checkout.
- On B,
skillshare uninstall _team -g(or the dashboard's record removal) also deletesteam/_band its audit acceptances. - Record-only removal writes no trash entry, so there is no undo, and the next push removes
team/_beverywhere.
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:182andinternal/server/handler_skills.go:436-480. The unlink cleanup is in bothcmd/skillshare/link.go:206-215andinternal/server/handler_source_links.go:131-155.wiki/cli-development.mdasks for one shared implementation ininternal/, 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 andtests/integration/link_test.go. The restored-checkout refusal is asserted in three places too.wiki/testing.mdasks 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:61still says unlink moves only the link to trash.wiki/audit.md:59still lists only twoerror_codes, and does not mentionrecordOnly,noCheckout,movedToTrash: falseor the unlinkwarningfield. - Record-only removal looks like a normal uninstall. The operation log writes
type: repoin both cases (handler_skills.go:503), and CLI--jsononly reportsremoved, so a script orskillshare logcan'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.
|
@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
left a comment
There was a problem hiding this comment.
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.
) 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.
…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
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.
Type
proposals/only — see CONTRIBUTING.md)approvedlabel)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
internal/uninstall.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
Use global mode for declaration-only removal. Run
skillshare install -gto restore a missing checkout. Project mode retains its existing behavior.uninstall --jsonkeeps all successful names inremovedand identifies removals without trash undo in the optionalrecord_onlysubset. Withdry_run: true, these are planned actions. CLI operation logs carry the same subset; API operation logs includerecordOnlyandmovedToTrash.Limitations
Verification
At
ccfd958431bc311a0d07c3a9608bfe77475a1eb5:make checkpassed once on a fresh isolated Linux checkout of this exact commit, as UID 65534 with no capabilities, synthetic HOME/XDG, and noGIT_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
08ecb7afwithCAP_DAC_READ_SEARCH, and a later runner incorrectly shared Git config across test homes. The corrected environment uses UID 65534, zero capabilities, and noGIT_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, After3bc20e31. 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
Complete hosted packet, traces, checksums and source identities.
Linked Issue
Refs #823
Checklist
make check) — for code changesAI assistance was used. The two author confirmations remain for Vladimir to complete personally. Vladimir will answer the maintainer review directly.