fix: complete marketplace client remediation

This commit is contained in:
2026-08-28 23:14:41 +08:00
parent 2c3baf6dff
commit 11d0af0166
18 changed files with 1007 additions and 90 deletions

View File

@@ -350,6 +350,31 @@ describe('Marketplace public Library projection', () => {
expect(JSON.stringify(result)).not.toMatch(/sha256|sizeBytes|installedAt|packageRoot|definition|account|admission|token/i);
});
it('projects an installed but client-incompatible package without discarding its cached release', async () => {
const marketplace = {
readCatalog: vi.fn(), readDetail: vi.fn(), readLibrary: vi.fn().mockResolvedValue(snapshot),
acquire: vi.fn(), remove: vi.fn(),
};
const packageStore = {
readInstalledIndex: vi.fn().mockResolvedValue(records),
getInstalled: vi.fn().mockResolvedValue({
...records[0], channel: 'beta', packageRoot: 'ignored', definition: {},
unavailableReason: 'plugin_incompatible_client' as const,
}),
resolveAndInstall: vi.fn(), removeUnused: vi.fn(),
};
const service = createCodingPluginMarketplaceService({
marketplace: marketplace as never, packageStore: packageStore as never, clientVersion: '3.0.0',
});
await expect(service.readLibrary()).resolves.toMatchObject({
installations: [{
status: 'unavailable', pluginId: 'makelore.notes', releaseId: 'release-old', version: '1.0.0',
channel: 'beta', reason: 'plugin_incompatible_client',
}],
});
});
it.each(['acquire', 'remove'] as const)('returns an authoritative joined snapshot after %s', async (action) => {
const marketplace = {
readCatalog: vi.fn(), readDetail: vi.fn(), readLibrary: vi.fn(),