Skip to content

Commit 86246c5

Browse files
committed
test(cloud-connection): an uninstall's answer carries the copy-record cleanup's outcome
Claude-Session: https://claude.ai/code/session_01FEkQ5pQJCx8STEq28nr3Ej Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 79be15e commit 86246c5

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

‎packages/cloud-connection/src/marketplace-install-local-uninstall-meta-reads.test.ts‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ type Handler = (c: any) => Promise<any>;
5959
const ROUTE = '/api/v1/marketplace/install-local';
6060
const APP_ID = 'com.example.crmlite';
6161
const OBJECTS = ['crmlite_account', 'crmlite_contact'];
62+
/**
63+
* [#30808] The door's own uninstall cleanup — the record of the unmanaged
64+
* copies it made — runs on every uninstall and removes nothing for a package
65+
* that is no copy: a successful outcome, never a failure.
66+
*/
67+
const COPY_RECORD_CLEANUP = { name: 'install-local:unmanaged-copy-record', success: true, removed: 0 };
6268
const APP = 'crmlite_app';
6369
const PERMISSION_SET = 'crmlite_user';
6470

@@ -266,7 +272,7 @@ describe('#24070: an install-local uninstall withdraws the package from every me
266272

267273
expect(res.status, JSON.stringify(res.payload)).toBe(200);
268274
// Nothing failed: no withdrawal outcome rides on the response.
269-
expect(res.payload.data.cleanups).toEqual([]);
275+
expect(res.payload.data.cleanups).toEqual([COPY_RECORD_CLEANUP]);
270276
expect(await readMeta(h.protocol)).toEqual(WITHDRAWN);
271277
for (const name of OBJECTS) expect(await h.copyOf(name)).toBeUndefined();
272278
expect(h.warnings()).toEqual([]);
@@ -281,7 +287,7 @@ describe('#24070: an install-local uninstall withdraws the package from every me
281287
const res = await h.uninstall();
282288

283289
expect(res.status, JSON.stringify(res.payload)).toBe(200);
284-
expect(res.payload.data.cleanups).toEqual([]);
290+
expect(res.payload.data.cleanups).toEqual([COPY_RECORD_CLEANUP]);
285291
expect(await readMeta(h.protocol)).toEqual(WITHDRAWN);
286292
expect(h.warnings()).toEqual([]);
287293
});
@@ -300,7 +306,7 @@ describe('#24070: an install-local uninstall withdraws the package from every me
300306
const res = await h.uninstall();
301307

302308
expect(res.status, JSON.stringify(res.payload)).toBe(200);
303-
expect(res.payload.data.cleanups).toEqual([]);
309+
expect(res.payload.data.cleanups).toEqual([COPY_RECORD_CLEANUP]);
304310
expect(await h.copyOf(OBJECTS[0])).toEqual(authored);
305311
expect(await h.copyOf(OBJECTS[1])).toBeUndefined();
306312
});
@@ -320,7 +326,7 @@ describe('#24070: an install-local uninstall withdraws the package from every me
320326
success: false,
321327
removed: 0,
322328
error: expect.any(String),
323-
}]);
329+
}, COPY_RECORD_CLEANUP]);
324330
// The cause goes to the operator log, never onto the wire.
325331
expect(JSON.stringify(res.payload)).not.toContain('read-only');
326332
expect(runCleanups).toHaveBeenCalledTimes(1);
@@ -363,7 +369,7 @@ describe('#24182: an install-local uninstall of an extender restores the owner\'
363369
const res = await h.uninstall(EXTENDER_ID);
364370

365371
expect(res.status, JSON.stringify(res.payload)).toBe(200);
366-
expect(res.payload.data.cleanups).toEqual([]);
372+
expect(res.payload.data.cleanups).toEqual([COPY_RECORD_CLEANUP]);
367373
const fields = await servedFields(h.protocol, OBJECTS[0]);
368374
expect(fields).not.toContain('ext_score');
369375
expect(fields).toEqual(Object.keys(h.ql.registry.getObject(OBJECTS[0])!.fields ?? {}));

0 commit comments

Comments
 (0)