fix(plugins): close R2 workspace gaps
This commit is contained in:
@@ -694,6 +694,59 @@ describe('buildPluginWorkspaceProjection', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('keeps device and project snapshots visible and marks only their retained rows stale after refresh errors', () => {
|
||||
const catalogOnly = {
|
||||
...catalog.items[0]!,
|
||||
pluginId: 'makelore.catalog-only',
|
||||
title: 'Catalog Only',
|
||||
};
|
||||
const result = buildPluginWorkspaceProjection(input({
|
||||
catalog: { ...catalog, items: [...catalog.items, catalogOnly], total: 2 },
|
||||
devicePackages: {
|
||||
schemaVersion: 1,
|
||||
generation: 8,
|
||||
packages: [devicePackage('local.cached', 'Cached Local', true)],
|
||||
},
|
||||
project: {
|
||||
...project,
|
||||
unknownPluginIds: ['makelore.retained'],
|
||||
},
|
||||
sourceFailures: { device: true, project: true },
|
||||
}));
|
||||
|
||||
expect(result.items.map(({ key }) => key)).toEqual([
|
||||
'official:makelore.notes',
|
||||
'official:makelore.catalog-only',
|
||||
'local:local.cached',
|
||||
'retained:makelore.retained',
|
||||
]);
|
||||
expect(result.items.find(({ key }) => key === 'official:makelore.notes')?.stale).toBe(true);
|
||||
expect(result.items.find(({ key }) => key === 'official:makelore.catalog-only')?.stale).toBe(false);
|
||||
expect(result.items.find(({ key }) => key === 'local:local.cached')?.stale).toBe(true);
|
||||
expect(result.items.find(({ key }) => key === 'retained:makelore.retained')?.stale).toBe(true);
|
||||
});
|
||||
|
||||
it.each(['current', 'stale', 'unavailable'] as const)(
|
||||
'projects %s policy status onto project-backed and retained rows without changing actions',
|
||||
(policyStatus) => {
|
||||
const result = buildPluginWorkspaceProjection(input({
|
||||
project: {
|
||||
...project,
|
||||
policyStatus,
|
||||
unknownPluginIds: ['makelore.retained'],
|
||||
},
|
||||
}));
|
||||
|
||||
expect(result.items.find(({ key }) => key === 'official:makelore.notes')).toMatchObject({
|
||||
projectPolicyStatus: policyStatus,
|
||||
});
|
||||
expect(result.items.find(({ key }) => key === 'retained:makelore.retained')).toMatchObject({
|
||||
projectPolicyStatus: policyStatus,
|
||||
commands: [{ kind: 'disable_project', projectId: 'project-a', pluginId: 'makelore.retained' }],
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it('offers sign-in for a signed-out free catalog item but fails closed for an authenticated Library failure', () => {
|
||||
const signedOut = buildPluginWorkspaceProjection(input({
|
||||
authenticated: false,
|
||||
|
||||
Reference in New Issue
Block a user