Repository navigation
feat(provider): darkbloom uninstall, remove everything or keep models - #1772
Merged
Merged
Conversation
…m's folders An end user on provider 0.10.7 ran `darkbloom stop --uninstall`, saw "Provider service uninstalled", and still had the cluster setup, the pairing and the settings; his agent then wiped things by hand to start over. These checks describe the command that replaces that: one `darkbloom uninstall` that either keeps models and settings or removes everything, and never deletes outside Darkbloom's folders. ProviderUninstallTests runs on a fake home in a temporary root: the real provider, watchdog and cluster service agent removals go through a fake launchctl (LaunchctlControl's task-local runner and home), and the drain, `cluster pair --forget` and `cluster link --remove` are recorded stand-ins. - (a) keep: every agent is booted out and its file removed; every other file is unchanged; nothing is unpaired. - (b) everything: settings, caches, Darkbloom's models, the cluster model store, the command link and ~/.darkbloom (last) are gone; forget and link remove run once each, forget first; another tool's model and a chosen model folder stay. - (c) dry run: lists every action and path with sizes; no file and no launchctl call changes. - (d) a model folder linked to another disk, settings linked elsewhere, a foreign command link and a link inside ~/.darkbloom: refused or not followed, and what they point to stays. A model cache that is a link, or shared with another install, is kept. - (e) without a terminal, no mode (or no --yes) refuses with one line. - (f) a paired leader and member end with the right line about the other Mac, in both modes. - (g) a failed step is reported and the safe steps after it still run; a service that did not stop keeps every file; a provider that did not drain keeps its agents. A second run fails nothing. UninstallCommandTests parses `uninstall` and its flags, refuses conflicting flags, and keeps `stop --uninstall` as it is. Red on origin/dev (0f99ddb): ProviderUninstallTests does not compile ("cannot find type 'ProviderUninstall' in scope"); with it set aside, UninstallCommandTests fails 3 of 3 (unexpectedExtraValues "uninstall", "Unknown option '--keep-data'", stop's help names no uninstall). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…emoving everything `darkbloom stop --uninstall` printed "Provider service uninstalled" and left the cluster service, the pairing, the cable port setup, the settings, the models and the app on the Mac. An end user (provider 0.10.7, four Macs in two pairs) could not start over without having his agent wipe files by hand. The team's call: "never coming back (remove config & weights); might be coming back (keep the config & weights)". `darkbloom uninstall` does that. In a terminal it shows what each choice removes, with sizes, and asks 1, 2 or 3: 1. Keep models and settings: the drain of `darkbloom stop`, then `darkbloom cluster stop` (with `--local-only` when the other Mac does not answer), then the provider, watchdog and desktop API agents as `stop --uninstall` removes them. Every file stays. The summary ends with how to come back: install again, then `darkbloom start` or `darkbloom cluster`. 2. Remove everything: also `cluster pair --forget` for each pairing (one call each, before the cable is touched, so a leader still tells its member), `cluster link --remove` (the same macOS prompt), and then Darkbloom's folders one step each: settings, encrypted caches, the models Darkbloom downloaded (a receipt or an unfinished download in the default cache), the cluster model store, the `/usr/local/bin` link the installer made, and ~/.darkbloom last, since the app this command runs from is in it. The summary says what was removed and the space freed on the home volume. 3. Cancel. For scripts and agents: `--keep-data` or `--everything` with `--yes`, `--dry-run` (with `--json`), and stop's `--timeout`/`--force`. Without a terminal, no mode (or no `--yes`) prints one usage line and exits 64. Safety. ProviderUninstall.inventory lists every target with its size and a verdict. A target is deleted only when its resolved path is one of Darkbloom's roots or inside one (ProviderUninstallPaths.roots); a link to elsewhere, or a folder with another disk mounted inside, is refused and reported. FileManager removes links inside a folder without following them. A model or cache folder the person chose, a default model cache that is a link, other tools' models, and models another install (~/.darkbloom-dev) shares are kept and listed. Keep mode never reaches a delete. Keychain items are never touched; the summary says so. Each step is idempotent and reported as done, skipped or failed with its reason; a failure stops only what depends on it (a provider that did not drain keeps its agents; a service that did not stop keeps every file). On a paired Mac both modes end with a line about the other Mac, by name and role: run `darkbloom uninstall` there too, or `darkbloom cluster` on it to pair it with another Mac. `stop --uninstall` is unchanged; its help now points to `uninstall`. WatchdogAgent.plistPath follows LaunchctlControl.homeDirectory(), as LaunchAgent and ClusterServiceAgent do, so tests can bind a fake home; production paths are the same. Docs: cli-reference (`darkbloom uninstall`), installation (Uninstall), two-mac-cluster (Uninstall), troubleshooting (Uninstall and start over), and changelog.d/provider-uninstall-keep-or-remove.md. Green: ProviderUninstallTests 9/9 and UninstallCommandTests 3/3; with DARKBLOOM_RELEASE_ENVIRONMENT=prod (as CI), the LaunchAgent removal and lifecycle, watchdog adapter and cluster service agent suites pass too (75 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ved setup Check (f) composed the last line from a role and a name handed in. This one writes the leadership record `darkbloom cluster` keeps (ClusterSetupStore) in a private temporary home, as a leader and then as a member, and expects the role and the other Mac's name to come from it: "The other Mac (Apple M4 Max, 128 GB) followed this one" on the leader, "… led this pair" on the member. With no saved setup, or one saved for another pairing, the pairing's own name is used and no role is claimed. Red against the previous commit: "type 'ProviderUninstallPairing' has no member 'describing'". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProviderUninstallPairing.read now loads the pairings and hands the peers, the latest pairing and this Mac's link pairing to describing(peers: latest:home:local:), which reads the leadership record and the control claim as before. Behavior is unchanged; the previous commit's check now drives the reader with a leadership record saved as a leader and as a member. Green (DARKBLOOM_RELEASE_ENVIRONMENT=prod, as CI): ProviderUninstallTests 10/10, UninstallCommandTests 3/3, and the LaunchAgent removal and lifecycle, watchdog adapter and cluster service agent suites (76 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l can run again `cluster link --remove` needs an administrator's approval. When it is declined, or cannot be shown (over SSH it prints `sudo sh ~/.darkbloom/cluster-device/link-remove.sh`), the cable port setup stays. Its record, that script and the app that can undo it are all in ~/.darkbloom. So --everything must keep ~/.darkbloom and the command link, saying why, and still delete the settings, caches and models. Check (g) now expects exactly that. Red against the previous commit (DARKBLOOM_RELEASE_ENVIRONMENT=prod): the folder holding the pairing and the command link are deleted, and no step says it was kept (3 issues in (g)). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…be undone ProviderUninstall.inventory marks the two items whose deletion takes the `darkbloom` command away: the command link and ~/.darkbloom, which holds the app, the cable records `cluster link --remove` reads, and the administrator's link-remove.sh it writes when no prompt can be shown. ProviderUninstall.run skips both when the cable step failed. The reason reads: "kept, so the uninstall can run again and undo the cable port setup". Settings, caches, models and the cluster model store are still deleted. Running it again offers only what is left. The marker is not part of the JSON plan. The docs' step table, the installation section and the troubleshooting row say what happens. Green (DARKBLOOM_RELEASE_ENVIRONMENT=prod): ProviderUninstallTests 10/10, UninstallCommandTests 3/3, and the LaunchAgent removal and lifecycle, watchdog adapter and cluster service agent suites (76 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The owner's spec (2026-11-04): "darkbloom uninstall should have 2 options, 1 uninstall all items or uninstall but leave models". Both options now stop serving, remove every background service, revoke the account token (best effort), unpair, undo the cable port setup and delete settings, logs, caches, ~/.darkbloom (the app last) and the command link. The only difference: --keep-models keeps the model folders Darkbloom downloaded and the cluster model store, so a reinstall finds them. ProviderUninstallTests: - (a) keep models: everything but the models is removed, including the pairing (forget) and the cable setup (link remove). The model folders, locks and cluster store are unchanged, their receipts and refs are byte-identical, and a fresh `ModelScanner.scanAllModels` over the fake cache finds the model again. The summary says what was kept and where, and gives the install command, then `darkbloom start` or `darkbloom cluster`. - (b) everything: as before; revoke, forget and link remove once each. - (c) dry run for both choices, the approved screen's lines, and the JSON plan. - (e) sizes are clone-aware: a model cloned into the cluster store counts once, and not at all while a clone outside Darkbloom's folders holds the blocks. - (f) the token is revoked once, best effort: an unconfirmed revocation is reported as skipped and blocks nothing. A provider that did not stop keeps its token. - Every earlier safety check stays: outside targets, shared or linked caches, the terminal rule, the other Mac's line, failed steps and idempotency. UninstallCommandTests parses `--everything` and `--keep-models`, and refuses `--keep-data` with the usage. Red against 120975d (DARKBLOOM_RELEASE_ENVIRONMENT=prod, tests sandboxed with no-darkbloom.sb): - ProviderUninstallTests does not compile: 43 errors, such as "type 'ProviderUninstall.Mode' has no member 'keepModels'", "extra argument 'revokeToken'" and "type 'ProviderUninstall' has no member 'uniqueBytes'". - With it set aside, UninstallCommandTests fails 2 of 3 (5 issues): "Unknown option '--keep-models'", `--keep-data --yes` parsed, and the usage does not name `[--everything] [--keep-models]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dels
The owner's spec (2026-11-04): "darkbloom uninstall should have 2
options, 1 uninstall all items or uninstall but leave models". The
approved screen:
1) Remove everything
The app, settings, pairing, logs and all models · frees 412 GB
2) Keep models
Removes everything else; a reinstall reuses the 410 GB of models
Choose 1 or 2 (Esc cancels):
Steps. Both choices run the same steps:
- drain, then `cluster stop`, then remove the agents;
- revoke the account token best effort, through `darkbloom logout`'s own
`Logout.revokeSavedToken`, once the provider has stopped; it is
reported as done or skipped and never fails the uninstall;
- forget the pairing, then undo the cable port setup;
- delete settings, caches, the command link and ~/.darkbloom, the app
last.
`--keep-models` keeps every item of kind `model`: the receipted or
unfinished model folders in the default cache, their download locks and
the cluster model store. Their `refs/` and receipts are untouched, so a
reinstall's `ModelScanner` finds them again.
Sizes. They are clone-aware. `measure` records each file's
`ATTR_CMNEXT_PRIVATESIZE`, `_CLONEID` and `_CLONE_REFCNT`, and
`uniqueBytes` counts a pure-clone family's shared blocks once, and only
when every clone of them is being deleted. The cluster store's clones of
the downloaded models are therefore counted once. The screen reads one
key (Esc, q, Ctrl-C or Ctrl-D cancel). Its lines below the choices
appear only when this Mac has folders no choice deletes, or parts with
their own uninstall.
Summary. It says what was removed, what was kept and where, and the
space freed. After keep models it gives the way back: the install
command, then `darkbloom start` or `darkbloom cluster`, with the models
found automatically. A chosen model folder needs
`darkbloom models location`. Chosen, external or shared model folders
and Keychain keys are listed as never touched. On a paired Mac it ends
with the line about the other Mac.
Flags and cleanups:
- `--everything` | `--keep-models`, with `--yes`, `--dry-run` and
`--json`. `--keep-data` is gone, so the parser refuses it with the
usage; nothing had shipped. Non-TTY without a mode still prints the
one-line usage and exits 64.
- `Report.items` is dropped. The `removesTheCommand` marker becomes
`ProviderUninstallItem.kind` (`data`, `model`, `command`), which the
JSON plan carries.
- Docs: the CLI reference (the screen, the steps, a deletion table per
choice, a note on prod and dev sharing cluster files), installation,
two-mac-cluster and troubleshooting are updated, and the changelog
fragment is rewritten for the two choices.
Green (DARKBLOOM_RELEASE_ENVIRONMENT=prod, sandboxed with
no-darkbloom.sb): ProviderUninstallTests 12/12, UninstallCommandTests
3/3, and the LaunchAgent removal and lifecycle, watchdog adapter and
cluster service agent suites, 78 tests in all. No sandbox denial
touched ~/.darkbloom.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProviderUninstall.swift held the engine (the steps, their order and the rules that skip a step after a failure) and, below it, 240 lines of what the person reads: the screen, the dry run, the summary, choosing a mode and the dry-run JSON. The engine is the part a safety review reads; it now stands alone. - ProviderUninstall.swift keeps the engine: Mode, Outcome, Step, Operations, Report, the step names, run, removeAgent and StepFailure. - ProviderUninstallText.swift (new) holds the screen, the dry run, the summary, choosing a mode and the dry-run JSON. - ProviderUninstall.Plan, with the two item labels the inventory gives, moves to ProviderUninstallPlan.swift, beside the inventory that builds its items and the uniqueBytes that sizes them. Moves only: across the three files the non-blank lines are the same, apart from the new file's import. The docs' file citations (inventory in ProviderUninstallPlan.swift, run in ProviderUninstall.swift) still hold. The 78 sandboxed tests pass, and the screen, both dry runs, the JSON and the four summaries the tests write are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed pieces - ProviderUninstall.Mode.keeps(_:) is the only difference between the two choices: keep-models keeps every .model item. run's deletion loop and Plan.removed(_:) each wrote it out; changing one alone would have made the dry run list a deletion the run skips, or the reverse. - Step and Step.Status drop Codable. Nothing encodes a step or a report; only the dry run has JSON. - Uninstall.plan() no longer passes Plan an installCommand. It was a copy of the default that the tests check, so the CLI now prints the checked one. - ProviderUninstallTests: FakeLaunchd.failBootout, which no test ever set, is gone. The clone-size and token tests drop the (e) and (f) they borrowed from the checklist letters in 276f6b2, where (e) is the no-terminal rule and (f) the line about the other Mac. Every #expect and #require stays (112 before and after). No behavior or text change: the 78 sandboxed tests pass, and the screen, both dry runs, the JSON and the four summaries the tests write are byte-identical to 798585e's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… asks after 1 The validator's findings on #1772, as tests: - A models folder the person chose inside ~/.darkbloom (`models location ~/.darkbloom/models`) stays in both modes, with the cluster store beside it; the screen, both dry runs and the summary name them as kept, the rest of the folder goes and the app is deleted last. - Run as root (a user-id seam), every form of the command is refused, dry run included. - A folder it refused reads "not removed", the headline says Darkbloom is not fully removed, and the report is incomplete. - After 1 on the screen, one more question names the models' size; only y or yes goes on. - A disk mounted at a folder is told from one that is not. - The cluster store beside a chosen folder outside Darkbloom's is listed. Red at 6a6a36c: the suite does not compile (no `incomplete`, `rootRefusal`, `userID:`, `confirmed`, `everythingQuestion`, `isMountPoint`). The validator's cases run against the same sources (scratch, not committed): C and its Remove-everything variant delete the chosen model, the headline still says removed, the store beside a chosen folder is not listed, and a disk mounted at ~/Library/Caches/darkbloom is emptied before EBUSY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s root The validator's findings on #1772: - A models folder the person chose is never deleted, in either mode. With `models location ~/.darkbloom/models`, the folder and the cluster store beside it stay, with the folders that lead to them; the rest of ~/.darkbloom goes, the app last. The screen, the dry run and the summary list them as "Kept:" (outside Darkbloom's folders, "Never touched:"), and "frees" no longer counts them. - Run as root, every form of the command, dry run included, refuses with "Run `darkbloom uninstall` as yourself, not with sudo: ..." and exits 64. - A folder it refused reads "not removed: <why>", the first line says Darkbloom is not fully removed, and the command exits 1. A command link the installer did not make is not Darkbloom's, so it alone does not count. - After 1 on the screen it asks once: "Remove everything, including <size> of models? This can't be undone. [y/N]". Keep models and `--everything --yes` ask nothing more. - A folder that is another disk's mount point is refused ("another disk is mounted here"), as one holding a mount already was. - The cluster model store beside a chosen models folder is listed. The CLI reference, the installation, two-Mac and troubleshooting uninstall sections and the changelog fragment say so. `Cluster.Stop.parse([])` is unchanged; #1774 follows up on it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 4, 2026
…1772 Re-checked the lines that waited on the cluster-clarity redesign against #1778 (a148285), and the guide's #1774 (04dfdde) and #1772 (1821a01) facts: - After setup, the pair's model list is the screen ("The pair's model list"): Enter on the serving model sends one test request (✓ Already serving …; test response in N s, the ✗ block, or no local API to test from); another model asks once; " · not enough free disk" is refused; the local/Darkbloom switch and Start over (unpair and set up again) are list lines. - The success ending is the ✓ block and the pair's card (Model, Macs, Serves or Local, Logs, Starts by itself at login), then the shell. - The joining Mac follows the first start ("Waiting for the other Mac (…) to choose the model and start…", "Choose Retry on the other Mac (…)"); the offered line replaces "registered with, or offered to"; the follower says "This Mac runs its part by itself." and offers Close / Start over. - #1774: stop says "Stopped on both Macs." only once both parts end, else "Asked both Macs to stop; …" (exit 1); restart doesn't start again while a part still holds memory; single-Mac options are refused by name (exit 64); --solo only while the pair is stopped (rule 11 and the --solo row were wrong); a leftover cluster service is "not in a cluster". - #1772: sudo refused (exit 64), "not removed: <why>" exits 1, Remove everything asks once more on the screen. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 0.10.8 candidate's B12 and B11, as tests: - On a Mac with both the production and the DevNet app, each install's uninstall keeps what the other still uses: the pairing (no unpair call), the cable port setup (no cable call) and the cluster files every install shares (~/.darkbloom/cluster*, ~/.config/darkbloom/clusters). The screen, the dry run, --json and the summary name it, the summary's first line names the install it removed, and the run neither fails nor is incomplete. Its own app and command go; the other's stay. Both directions. - The install folder's row names the pairing and cluster setup only for ~/.darkbloom, where they are. - A cluster service running without its login agent is named in the dry run. Red at 1821a01: the B12 test runs and fails in both directions (the unpair and cable stand-ins are called, the production uninstall deletes the shared cluster files, nothing names them). With the B11 and label checks added, the suite does not compile (no `clusterServiceRunning:`, no `installFolderLabel`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… uses
B12, from the 0.10.8 candidate on the owner's kind of Mac: the DevNet app's
uninstall forgot the pairing and undid the cable port setup that the
production app on the same Mac uses (and the other way round, which also
deleted the shared cluster files in ~/.darkbloom).
- `ProviderUninstallPaths.otherEnvironment` tells the other install by its
app or its `bin/` command in its own folder, not by the folder alone:
~/.darkbloom also holds the cluster files a DevNet-only Mac writes.
- With another install present, the inventory lists "This Mac's pairing,
cluster setup and cable port setup" as kept, naming the other install and
its uninstall. The cluster files every install shares
(~/.darkbloom/cluster*, ~/.config/darkbloom/clusters) stay while the
rest of those folders goes. The run skips the unpair and cable steps
("kept: … on this Mac also uses it"), the dry run and --json leave them
out, and the summary's first line names the install it removed. Without
another install nothing changes.
- The install folder's row names the pairing and cluster setup only for
~/.darkbloom, where they are.
- B11: the dry run names a cluster service running without a login agent
(`ClusterService.running`, the service's lock), which step 2 stops.
The CLI reference, the installation, two-Mac and troubleshooting sections
and the changelog fragment say so. `Cluster.Stop.parse([])` is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Beside the other install (both directions, a fake home with both apps and stand-in launchd): step 2 never stops the pair (the cluster-stop stand-in is not called), removes only this install's own cluster service agent (`ClusterServiceAgentPlan.label` of its app), and leaves the other install's agent and any other agent loaded and installed. The dry run, --json and the summary say so. - F3: with `models location ~/.darkbloom`, the app folder stays with the chosen folder; the summary's first line says Darkbloom is not fully removed because its app folder is the models folder, the step says what to do, the dry run names it, and the run is incomplete (exit 1). Red at 4b4d8cb: both tests compile and fail (step 2 runs the cluster stop, which removes every cluster agent; F3's headline says "Darkbloom is removed from this Mac."). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ervice Finishes B12: with the cluster shared with the other install on this Mac, step 2 never stops the pair and never touches the other install's agent. It removes only this install's own cluster service agent, labelled by `ClusterServiceAgentPlan` for its app, through a small engine operation (`ProviderUninstall.removeOwnClusterAgent`), so #1774's `--service` follow-up only changes the unshared path. The dry run, --json and the summary say "Remove this install's cluster service: … the pair and the production Darkbloom's cluster service are left as they are"; the kept line says so too. Without another install, step 2 is unchanged (`Cluster.Stop.parse([])`). F3: when the models folder is ~/.darkbloom itself (or holds it), the app folder stays with it and is now refused rather than silently kept: the summary's first line says Darkbloom is not fully removed because its app folder is the models folder, the step says to move the models out and run ~/.darkbloom/bin/darkbloom uninstall again, and the command exits 1. Models inside a chosen folder still stay without counting, and a link is judged by where it is, not where it points, so the command link still goes. The CLI reference, troubleshooting and the changelog fragment say so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonathan308
added a commit
that referenced
this pull request
Nov 4, 2026
Brings #1763, #1765, #1764, #1770, #1772, #1767, #1768, #1769 and #1766 from dev. One conflict, in docs/provider/two-mac-cluster.md (2 hunks): before "## Undo", #1774's "Stopping and starting again", then #1770's "Pairing again"; Undo keeps #1770's opening, #1774's --service sentences, the Uninstall link, and #1772's "## Uninstall" section as written. Resolution verified in a dry run (tree 4737f00). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # docs/provider/two-mac-cluster.md
This was referenced Nov 4, 2026
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
From an end user (owner's call, 2026-11-03, provider 0.10.7, four Macs in two pairs):
darkbloom stop --uninstallprinted "Provider service uninstalled", yet the cluster setup, the pairing and the config stayed ("That's weird that it still shows your setup"). To start from scratch, the user had his agent wipe things by hand.The owner's spec: "darkbloom uninstall should have 2 options, 1 uninstall all items or uninstall but leave models".
darkbloom uninstallshows this screen, with this Mac's measured sizes (APFS clones counted once):Both choices:
darkbloom cluster stop;logout's path;cluster pair --forget) and undo the cable port setup (cluster link --remove);~/.darkbloom, with the app last.Keep models keeps the model folders Darkbloom downloaded and the cluster model store, so a reinstall finds them without downloading. The summary says what was removed, what was kept and where, the way back, and what to run on the other Mac. For scripts:
--everything|--keep-models,--yes,--dry-run [--json].stop --uninstallis unchanged.Linked issue
No issue filed (end-user report on the owner's call); link one if it exists.
Test plan
ProviderUninstallTestsdoes not compile (43 errors, e.g.no member 'keepModels',extra argument 'revokeToken',no member 'uniqueBytes').UninstallCommandTestsfails 2/3:Unknown option '--keep-models',--keep-dataaccepted, and the wrong usage.origin/devthe same way.sandbox-exec -f no-darkbloom.sb env DARKBLOOM_RELEASE_ENVIRONMENT=prod swift test --disable-sandbox --filter 'ProviderUninstallTests|UninstallCommandTests|LaunchAgentRemovalTests|LaunchAgentLifecycleTests|WatchdogLaunchAdapterTests|ClusterServiceAgentTests'gives 78 tests passing, with no sandbox denials. The new checks:ModelScanner.scanAllModelsfinds the model again.--keep-data: rejected with the usage, exit 64.make docs-impact-check BASE=origin/dev,make docs-check,make changelog-check,git diff --check.4a1f605b2a,6a6a36cba7): the same 78 tests pass sandboxed (prod identity), the two new suitespass in the dev identity (12 + 3), and the screen, both dry runs, the JSON and the four summaries are
byte-identical to before the pass.
reinstall →
darkbloom models listanddarkbloom clusterreuse the models; then Remove everything, first--dry-run, then for real. Results will be added here.Components touched
Protocol / interface changes
darkbloom uninstall(--everything,--keep-models,--yes,--dry-run,--json, plus stop's--timeout/--force).darkbloom_uninstall_plan_v1(dry run only).POST /v1/device/revokethroughdarkbloom logout's code.Documentation impact
docs/provider/cli-reference.md(screen, flags, steps, deletion table per choice, never-touched list);docs/provider/installation.mdanddocs/provider/two-mac-cluster.md(Uninstall);docs/provider/troubleshooting.md(Uninstall and start over).Changelog
changelog.d/provider-uninstall-keep-or-remove.mdand ranmake changelog-check.Notes for reviewers
Merge order with fix(cluster): on a paired Mac, darkbloom start/stop/restart/status control the pair; plain cluster status --json (stacked on #1764) #1774: merge this PR first. fix(cluster): on a paired Mac, darkbloom start/stop/restart/status control the pair; plain cluster status --json (stacked on #1764) #1774 changes plain
darkbloom cluster stopto stop the pair whileleaving the cluster service up; the old service-off stop becomes
cluster stop --service. This uninstall callsCluster.Stop.parse([])for its "Stop this Mac's cluster part and remove its service" step, so once both are indevit must pass
--service. That one-line change, with its dry-run text, test and docs, is prepared and goes into fix(cluster): on a paired Mac, darkbloom start/stop/restart/status control the pair; plain cluster status --json (stacked on #1764) #1774right after this PR merges.
Where things live (
ProviderCore/Service/Uninstall/):ProviderUninstall.swift: the engine only (the steps, their order and the skip rules;run,Mode.keeps);ProviderUninstallPlan.swift: the inventory, the clone-aware sizes andPlan;ProviderUninstallText.swift: what the person reads and presses (screen, dry run, summary, the one-key choice).The command reads one key and wires today's entry points.
Kinds. Items carry a kind:
model(kept by Keep models),command(~/.darkbloomand the link, kept when the cable step fails so the uninstall can run again), ordata.Deletion boundary. A target is deleted only if its
realpathis inside one of five roots under the canonical home. Anything else is refused and listed. Chosen or shared model folders and Keychain keys are never touched.Clone-aware sizes. These use
getattrlist'sATTR_CMNEXT_PRIVATESIZE,_CLONEIDand_CLONE_REFCNT. A pure-clone family's shared blocks count once, and only if every clone is being deleted.Token. It is revoked only after the provider stopped, as
logoutdoes. It never fails the uninstall.Shared cluster files. Prod and dev share the cluster files under
~/.darkbloom, and this is documented. The MDM profile is left todarkbloom unenroll.Not validated: a real Mac; the live drain, cluster stop, token, forget and cable prompt inside this command (existing paths, called as today); and the raw-mode key reader (its key mapping is tested).
Independent validation, round 3
Round 3 (independent validation). Two blockers and four minors, fixed red first.
~/.darkbloom(models location ~/.darkbloom/models), together with the cluster model store beside it. Darkbloom's folder is deleted around them, the app last. The screen, the dry run and the summary list them asKept:.sudo darkbloom uninstall …refuses in every form, dry run included, and exits 64: "Rundarkbloom uninstallas yourself, not with sudo: …". As root it would have read root's home and undone this Mac's cable setup.not removed: <why>. The first line then says Darkbloom is not fully removed, and the command exits 1. A command link the installer did not make does not count.--everything --yesstays non-interactive.Validation, at
1821a01b69:git diff --checkpass.flowchart LR subgraph Before b1["sudo darkbloom uninstall"] --> b2["reads /var/root; removes this Mac's cable setup; 'removed'"] b3["models location ~/.darkbloom/models"] --> b4["either choice deletes ~/.darkbloom whole, models included"] b5["1 on the screen"] --> b6["runs at once"] end subgraph After a1["sudo darkbloom uninstall"] --> a2["refused, exit 64; nothing listed or changed"] a3["models location ~/.darkbloom/models"] --> a4["inventory protects it + store beside it;<br/>deleteAround: the rest, app last; 'Kept:'"] a5["1 on the screen"] --> a6["'Remove everything, including N of models? [y/N]'"] endReal-Mac findings, round 4
Round 4 (0.10.8 candidate on real Macs: B12, B11).
Both apps on one Mac. On a Mac with both the production app and the DevNet app (
darkbloom-dev), uninstalling one keeps what the other still uses:~/.darkbloom/cluster*,~/.config/darkbloom/clusters).Its own app, command, settings, caches and logs go. The screen, the dry run,
--jsonand the summary sayKept: This Mac's pairing, cluster setup and cable port setup (…): the production Darkbloom on this Mac also uses them. Rundarkbloom uninstallthere to remove them.The headline names the install removed, such as "Darkbloom Dev is removed from this Mac.". The other-Mac line is left out while the pair still works.
How the other install is told: by its app or
bin/command, since~/.darkbloomalso exists on DevNet-only Macs. Without another install, nothing changes.B11: the dry run names a cluster service running without a login agent (
ClusterService.running).Validation, at
4b4d8cb957:git diff --checkpass.Known limit: step 2's
cluster stopis unchanged until #1774's--servicefollow-up.flowchart LR subgraph Before b1["darkbloom-dev uninstall<br/>(production app also on this Mac)"] --> b2["cluster pair --forget + cluster link --remove<br/>production pair broken"] b3["darkbloom uninstall<br/>(DevNet app also on this Mac)"] --> b4["the same, and deletes ~/.darkbloom/cluster* with ~/.darkbloom"] end subgraph After a0["ProviderUninstallPaths.otherEnvironment<br/>(other app or bin/ command)"] --> a1["inventory: Kept: pairing, cluster setup, cable port setup;<br/>deleteAround keeps ~/.darkbloom/cluster*, ~/.config/darkbloom/clusters"] a1 --> a2["run: steps 7–8 skipped (kept: … also uses it);<br/>headline names the install removed"] endRound 5
Round 5 (finishes B12; F3 from the final integration pass).
Plan.sharesCluster), step 2 no longer stops the pair or touches the other install's cluster service agent. It removes only this install's own agent (ClusterServiceAgentPlan.labelof its app), throughProviderUninstall.removeOwnClusterAgent.--jsonand the summary sayRemove this install's cluster service: … the pair and the production Darkbloom's cluster service are left as they are.Cluster.Stop.parse([])); fix(cluster): on a paired Mac, darkbloom start/stop/restart/status control the pair; plain cluster status --json (stacked on #1764) #1774's--servicefollow-up changes only that path.darkbloom models location ~/.darkbloom, the app folder stays with the chosen folder. The summary now says so:Darkbloom is not fully removed from this Mac: its app folder is your models folder, so it was kept (see below).~/.darkbloom/bin/darkbloom uninstallagain.Validation, at
9246f9fd85:git diff --checkpass.flowchart LR subgraph Before b1["uninstall beside the other install"] --> b2["step 2: cluster stop<br/>(every io.darkbloom.cluster-service.* agent; with #1774, --service removes them)"] b3["models location ~/.darkbloom"] --> b4["app folder kept silently; 'Darkbloom is removed from this Mac.'"] end subgraph After a1["uninstall beside the other install"] --> a2["step 2: removeOwnClusterAgent(own label)<br/>pair and other agent untouched"] a3["models location ~/.darkbloom"] --> a4["app folder refused and named; 'not fully removed … your models folder'; exit 1"] endBefore And After
Behavior
flowchart TB classDef cmd fill:#e8f1fb,stroke:#2f6db5,color:#0b2545 classDef bad fill:#fde2e1,stroke:#c0392b,color:#641e16 classDef keep fill:#fff4d6,stroke:#b9770e,color:#4d3200 classDef good fill:#e3f6e8,stroke:#1e8449,color:#0b3d1f subgraph BEFORE["Before (0.10.7)"] direction TB b1["darkbloom stop --uninstall"]:::cmd --> b2["'Provider service uninstalled'"]:::cmd b2 --> b3["cluster service, pairing,<br/>cable setup, settings,<br/>models, app: all still there"]:::bad b3 --> b4["'it still shows your setup'<br/>wiped by hand"]:::bad end subgraph AFTER["After"] direction TB a1["darkbloom uninstall"]:::cmd --> a2{"1 Remove everything · frees N GB<br/>2 Keep models · reuses M GB<br/>Esc cancels"}:::cmd a2 --> a3["both: drain · cluster stop · agents<br/>token revoke · unpair · cable undone<br/>settings, caches, link, app (last)"]:::good a3 -- "1" --> a4["models + cluster store deleted"]:::good a3 -- "2" --> a5["models + cluster store kept<br/>reinstall finds them"]:::keep a4 --> a6["steps done/skipped/failed · space freed<br/>never touched · the other Mac"]:::good a5 --> a6 endCode flow
flowchart LR classDef same fill:#eef2f7,stroke:#5d6d7e,color:#1b2631 classDef new fill:#e3f2fd,stroke:#1565c0,color:#0b2545 classDef changed fill:#fff4d6,stroke:#b9770e,color:#4d3200 subgraph CB["Before"] direction TB s1["Stop.run --uninstall"]:::same --> s2["ServiceDrain + stopDrainedProvider"]:::same s2 --> s3["Watchdog / Desktop / LaunchAgent .uninstall"]:::same end subgraph CA["After"] direction TB u1["Uninstall.run<br/>one key: ProviderUninstall.key"]:::new --> u2["inventory(paths): kinds data/model/command<br/>uniqueBytes (APFS clone facts)"]:::new u1 --> u3["ProviderUninstall.run(mode, items, operations)"]:::new u3 --> o1["ServiceDrain · Cluster.Stop · agents' .uninstall"]:::same u3 --> o2["Logout.revokeSavedToken (best effort)"]:::same u3 --> o3["Cluster.Pair --forget · ClusterLinkRepair.remove"]:::same u3 --> o4["delete inside roots; keep models skips kind=model;<br/>install folder last"]:::new w1["WatchdogAgent.plistPath →<br/>LaunchctlControl.homeDirectory()"]:::changed s9["Stop.run --uninstall (unchanged)"]:::same endLegend: blue = new, amber = changed (or kept, in the behavior figure), grey = unchanged; red = the reported problem, green = what the person gets.
Refactor Pass
A dedicated refactor subagent reviewed the finished feature (
798585e979) and made two behavior-preserving commits:4a1f605b2arefactor(provider): split the uninstall engine from what it printsProviderUninstall.swiftnow holds only the engine: the steps, their order and the skip rules.ProviderUninstallText.swift.ProviderUninstall.Planmoved toProviderUninstallPlan.swift, beside the inventory that builds its items.6a6a36cba7refactor(provider): state keep-models' one difference once, drop unused piecesMode.keeps(_:)replaces the two copies of the keep-models predicate inrunandPlan.removed.Stepdrops an unusedCodable.Plan's default install command.Checked and left unchanged:
getattrlistoffsets and the family rule are correct and minimal.darkbloom_uninstall_plan_v1.VMIN/VTIMElike the other raw-mode readers.Validation after the pass:
no-darkbloom.sb) withDARKBLOOM_RELEASE_ENVIRONMENT=prod: the same 78 tests pass. In the local dev identity, the two new suites pass too (12 + 3). No.darkbloomsandbox denials.make docs-impact-check BASE=origin/dev,make docs-check,make changelog-checkandgit diff --checkpass.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.