fix(setup): stop remaining uninstall removals after a client fails
A configuration that passes the preflight can still fail when uninstall rereads it to edit, for example when it changes concurrently. Rereading keeps that edit from overwriting the newer file; stopping at the failure keeps later clients, the skill, and REA data from being removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5cc841d5c1
commit
fd975c75fa
3 files changed
+80
-3
No files matched your search
@@ -91,7 +91,8 @@ export interface UninstallHost {
|
||||
/**
|
||||
* Remove only REA-owned registrations and managed files, optionally including
|
||||
* local state. A client configuration that cannot be read safely stops the
|
||||
* operation before anything is removed.
|
||||
* operation before anything is removed; one that fails during removal stops
|
||||
* the remaining removals.
|
||||
*/
|
||||
export const runUninstall = async (
|
||||
purgeData: boolean,
|
||||
@@ -127,13 +128,29 @@ export const runUninstall = async (
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Each client is reread when it is edited, so a concurrent change is never
|
||||
* overwritten. A client that fails then still stops the remaining removals.
|
||||
*/
|
||||
const removeAll = async (
|
||||
clients: readonly SetupClient[],
|
||||
purgeData: boolean,
|
||||
host: UninstallHost,
|
||||
): Promise<UninstallItem[]> => {
|
||||
const items: UninstallItem[] = [];
|
||||
for (const client of clients) items.push(await host.removeClient(client));
|
||||
for (const client of clients) {
|
||||
const removed = await host.removeClient(client);
|
||||
items.push(removed);
|
||||
if (removed.status === "failed")
|
||||
return [
|
||||
...items,
|
||||
item(
|
||||
"uninstall",
|
||||
"skipped",
|
||||
"Uninstall stopped at this failure; the items above report what changed. Repair the failed configuration, then rerun uninstall.",
|
||||
),
|
||||
];
|
||||
}
|
||||
items.push(await host.removeSkill());
|
||||
if (purgeData) items.push(...(await host.purgeData()));
|
||||
return items;
|
||||
|
||||
Reference in new issue
Block a user