feat(plugins): share hosted admission resolution

This commit is contained in:
2026-09-01 01:11:53 +08:00
parent c4db68767f
commit 1edd75e246
5 changed files with 474 additions and 22 deletions

View File

@@ -94,7 +94,7 @@ async function fixture() {
})),
getInstalledRelease: vi.fn(async () => ({
pluginId: 'makelore.game-resource', releaseId: RELEASE_ID, version: '1.0.0',
sha256: 'a'.repeat(64), channel: 'stable',
sha256: 'a'.repeat(64), sizeBytes: 1, channel: 'stable',
})),
} as unknown as Pick<PluginPackageStore, 'getInstalled' | 'getInstalledRelease'>,
makeloreVersion: '2.0.0',
@@ -181,4 +181,22 @@ describe('GameResourcePluginAdapter', () => {
releaseId: RELEASE_ID, releaseAdmissionId: 'admission-a', kind: 'pixel',
});
});
it('fails closed when a worker has no frozen release instead of using the current package', async () => {
const { adapter, context, client, resolve } = await fixture();
await expect(adapter.invoke(
{ ...context, pluginReleaseId: undefined },
tool('game_resource_templates'),
{ kind: 'pixel' },
)).resolves.toMatchObject({
success: false,
status: 409,
code: 'plugin_release_unavailable',
retryable: false,
});
expect(resolve).not.toHaveBeenCalled();
expect(client.templates).not.toHaveBeenCalled();
});
});