fix: close marketplace client review findings

This commit is contained in:
2026-08-28 21:01:51 +08:00
parent 8dfa542860
commit 1614f7efc1
25 changed files with 1224 additions and 143 deletions

View File

@@ -325,13 +325,14 @@ describe('Marketplace public Library projection', () => {
},
];
it('rebuilds fresh-process installation state and exposes only the latest safe release', async () => {
it('rebuilds fresh-process installation state from the Package Store current selection', 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], packageRoot: 'ignored', definition: {} }),
resolveAndInstall: vi.fn(), removeUnused: vi.fn(),
};
const service = createCodingPluginMarketplaceService({
@@ -343,7 +344,7 @@ describe('Marketplace public Library projection', () => {
library: snapshot,
installations: [{
status: 'installed', pluginId: 'makelore.notes',
releaseId: 'release-new', version: '1.5.0',
releaseId: 'release-old', version: '1.0.0',
}],
});
expect(JSON.stringify(result)).not.toMatch(/sha256|sizeBytes|installedAt|packageRoot|definition|account|admission|token/i);
@@ -356,6 +357,7 @@ describe('Marketplace public Library projection', () => {
};
const packageStore = {
readInstalledIndex: vi.fn().mockResolvedValue(records.slice(1, 2)),
getInstalled: vi.fn().mockResolvedValue({ ...records[1], packageRoot: 'ignored', definition: {} }),
resolveAndInstall: vi.fn(), removeUnused: vi.fn(),
};
const service = createCodingPluginMarketplaceService({
@@ -367,6 +369,6 @@ describe('Marketplace public Library projection', () => {
installations: [{ status: 'installed', pluginId: 'makelore.notes', releaseId: 'release-new', version: '1.5.0' }],
});
expect(marketplace[action]).toHaveBeenCalledWith('makelore.notes');
expect(packageStore.readInstalledIndex).toHaveBeenCalledOnce();
expect(packageStore.getInstalled).toHaveBeenCalledOnce();
});
});