ReviewOS

also looking at this

stacks/drone

feat: own runtime firmware candidates

#49
Merged chris wants to merge codex/runtime-candidate-ownership into main
24 files +1245 -92
tests/fixtures/updates/epochs.tsmodified+4-0
Changes to tests/fixtures/updates/epochs.ts
@@ -20,6 +20,9 @@ export async function epochRepository(directory: string, duplicateSnapshotKey =
2020 async function publish(epoch: 1 | 2, version: number, releaseSequence: number) {
2121 if (epoch === 2) await writeFile(join(directory, 'metadata/2.root.json'), root(2))
2222 const image = Buffer.from('synthetic epoch image, never execute or flash\n')
23 const imageHash = digest(image), imagePath = join(directory, 'targets/runtime', `${imageHash}.pico2-bench.bin`)
24 await mkdir(join(directory, 'targets/runtime'), { recursive: true })
25 await writeFile(imagePath, image)
2326 const custom = { schema: 'drone-runtime-image-v1', platform, protocolVersion: 1, releaseSequence, sourceRevision: 'a'.repeat(40), profile: 'neutral-bench' }
2427 const targets = new Metadata(new Targets({ ...fields, version, targets: { [target]: new TargetFile({ path: target, length: image.length, hashes: { sha256: digest(image) }, unrecognizedFields: { custom: { drone: custom } } }) } }))
2528 targets.sign(keys.targets.sign)
@@ -32,6 +35,7 @@ export async function epochRepository(directory: string, duplicateSnapshotKey =
3235 await writeFile(join(directory, 'metadata/timestamp.json'), JSON.stringify(timestamp.toJSON()))
3336 await writeFile(join(directory, `metadata/${version}.snapshot.json`), snapshotBytes)
3437 await writeFile(join(directory, `metadata/${version}.targets.json`), targetBytes)
38 return { image, imageHash, imagePath }
3539 }
3640 return { rootPath, rootSha256: digest(anchor), publish }
3741}