feat(companion): emit release manifest metadata in bundles

This commit is contained in:
William Valentin
2026-02-26 19:39:11 -08:00
parent be8b1f29a4
commit 90b6d94a81
10 changed files with 71 additions and 7 deletions
+16
View File
@@ -50,6 +50,7 @@ describe('writeCompanionReleaseBundle', () => {
const launcherRaw = await readFile(result.launcherPath, 'utf8');
const readmeRaw = await readFile(result.readmePath, 'utf8');
const checksumsRaw = await readFile(result.checksumsPath, 'utf8');
const bundleManifestRaw = await readFile(result.releaseManifestPath, 'utf8');
const launcherStat = await stat(result.launcherPath);
expect(JSON.parse(manifestRaw)).toMatchObject({
@@ -64,6 +65,13 @@ describe('writeCompanionReleaseBundle', () => {
expect(checksumsRaw).toContain('companion.bootstrap.json');
expect(checksumsRaw).toContain('run-companion.sh');
expect(checksumsRaw).toContain('README.md');
expect(JSON.parse(bundleManifestRaw)).toMatchObject({
schemaVersion: 1,
bundle: { nodeId: 'ios-node', platform: 'ios' },
files: expect.arrayContaining([
expect.objectContaining({ path: 'CHECKSUMS.sha256' }),
]),
});
expect((launcherStat.mode & 0o111) !== 0).toBe(true);
await rm(tempDir, { recursive: true, force: true });
@@ -99,12 +107,20 @@ describe('writeCompanionReleaseBundle', () => {
});
expect(result.signaturePath).toBe(`${outputDir}/CHECKSUMS.sha256.sig`);
expect(result.releaseManifestPath).toBe(`${outputDir}/RELEASE_MANIFEST.json`);
const checksumsRaw = await readFile(result.checksumsPath, 'utf8');
const signatureRaw = await readFile(result.signaturePath!, 'utf8');
const bundleManifestRaw = await readFile(result.releaseManifestPath, 'utf8');
const signatureLine = signatureRaw.split('\n').find((line) => line.startsWith('signature='));
expect(signatureLine).toBeTruthy();
expect(signatureRaw).toContain('key_id=test-key');
expect(JSON.parse(bundleManifestRaw)).toMatchObject({
signature: {
path: 'CHECKSUMS.sha256.sig',
keyId: 'test-key',
},
});
const signature = Buffer.from(String(signatureLine).replace('signature=', ''), 'base64');
const verified = verify(