@@ -117,7 +117,7 @@ describe("external firmware bundle staging", () => {
117117 join (
118118 outputDirectory ,
119119 "firmware" ,
120- "v0.4.1 " ,
120+ "v0.4.2 " ,
121121 "esp32-s3-n16r8" ,
122122 "manifest.json" ,
123123 ) ,
@@ -128,14 +128,14 @@ describe("external firmware bundle staging", () => {
128128 join (
129129 outputDirectory ,
130130 "firmware" ,
131- "v0.4.1 " ,
131+ "v0.4.2 " ,
132132 "esp32-s3-n16r8" ,
133133 "firmware.bin" ,
134134 ) ,
135135 ) . then ( ( value ) => Array . from ( value ) ) ,
136136 ) . resolves . toEqual ( Array . from ( fixture . firmwareBytes ) ) ;
137137 await expect (
138- readdir ( join ( outputDirectory , "firmware" , "v0.4.1 " ) ) ,
138+ readdir ( join ( outputDirectory , "firmware" , "v0.4.2 " ) ) ,
139139 ) . resolves . not . toContain ( "esp32-c3-4mb" ) ;
140140 expect ( fixture . descriptor . profiles . map ( ( { id } ) => id ) ) . toEqual ( [
141141 "esp32-4mb" ,
@@ -164,7 +164,7 @@ describe("external firmware bundle staging", () => {
164164 accessControlled : true ,
165165 deployment : "candidate" ,
166166 hilStatus : "pending" ,
167- version : "0.4.1 " ,
167+ version : "0.4.2 " ,
168168 } ) ;
169169 await expect (
170170 stageFixture ( {
@@ -205,7 +205,7 @@ describe("external firmware bundle staging", () => {
205205 accessControlled : false ,
206206 deployment : "public-beta" ,
207207 hilStatus : "pending" ,
208- version : "0.4.1 " ,
208+ version : "0.4.2 " ,
209209 } ) ;
210210 await expect (
211211 validatePreservedPublicFirmwareRelease ( stagedRoot , {
@@ -242,7 +242,7 @@ describe("external firmware bundle staging", () => {
242242
243243 await expect (
244244 validateAttestedPublicBetaBundle ( bundleDirectory , "public-beta" ) ,
245- ) . rejects . toThrow ( / a t t e s t e d .* v 0 \. 4 \. 1 / i) ;
245+ ) . rejects . toThrow ( / a u d i t e d .* v 0 \. 4 \. 2 / i) ;
246246 } ) ;
247247
248248 it ( "rejects external bytes that no longer match the generated bundle checksums" , async ( ) => {
@@ -633,6 +633,85 @@ describe("external firmware bundle staging", () => {
633633 . toBe ( repositoryRoot ) ;
634634 } ) ;
635635
636+ it ( "runs a public beta through the canonical audited-candidate and license gates" , async ( ) => {
637+ const stagingScript = join (
638+ process . cwd ( ) ,
639+ "scripts" ,
640+ "stage-firmware-release.js" ,
641+ ) ;
642+ const bundleDirectory = await temporaryDirectory (
643+ "public-beta-audit-bundle" ,
644+ ) ;
645+ const licenseEvidenceDirectory = await temporaryDirectory (
646+ "public-beta-license-evidence" ,
647+ ) ;
648+ const licenseBuildRoot = await temporaryDirectory (
649+ "public-beta-license-build" ,
650+ ) ;
651+ const firmwareSourceRoot = await temporaryDirectory (
652+ "public-beta-source-root" ,
653+ ) ;
654+ const fakeBin = await temporaryDirectory ( "public-beta-validator-bin" ) ;
655+ const fakePython = join ( fakeBin , "python3" ) ;
656+ const captureFile = join ( fakeBin , "public-beta-arguments.txt" ) ;
657+ await writeFile (
658+ fakePython ,
659+ [
660+ "#!/bin/sh" ,
661+ 'printf "%s\\n" "$@" > "${PYBLE_TEST_VALIDATOR_CAPTURE}"' ,
662+ "" ,
663+ ] . join ( "\n" ) ,
664+ "utf8" ,
665+ ) ;
666+ await chmod ( fakePython , 0o755 ) ;
667+
668+ const validationProgram = [
669+ `const staging = await import(${ JSON . stringify ( pathToFileURL ( stagingScript ) . href ) } );` ,
670+ `await staging.validateWithCanonicalReleaseTool(${ JSON . stringify ( bundleDirectory ) } , "public-beta");` ,
671+ ] . join ( "\n" ) ;
672+ const baseEnvironment : NodeJS . ProcessEnv = {
673+ ...process . env ,
674+ PATH : `${ fakeBin } :${ process . env . PATH ?? "" } ` ,
675+ PYBLE_TEST_VALIDATOR_CAPTURE : captureFile ,
676+ } ;
677+ delete baseEnvironment . PYBLE_FIRMWARE_LICENSE_EVIDENCE_DIR ;
678+ delete baseEnvironment . PYBLE_FIRMWARE_LICENSE_BUILD_ROOT ;
679+ delete baseEnvironment . PYBLE_FIRMWARE_SOURCE_ROOT ;
680+
681+ await expect (
682+ execFile (
683+ process . execPath ,
684+ [ "--input-type=module" , "--eval" , validationProgram ] ,
685+ { cwd : process . cwd ( ) , env : baseEnvironment } ,
686+ ) ,
687+ ) . rejects . toThrow ( ) ;
688+
689+ await execFile (
690+ process . execPath ,
691+ [ "--input-type=module" , "--eval" , validationProgram ] ,
692+ {
693+ cwd : process . cwd ( ) ,
694+ env : {
695+ ...baseEnvironment ,
696+ PYBLE_FIRMWARE_LICENSE_BUILD_ROOT : licenseBuildRoot ,
697+ PYBLE_FIRMWARE_LICENSE_EVIDENCE_DIR : licenseEvidenceDirectory ,
698+ PYBLE_FIRMWARE_SOURCE_ROOT : firmwareSourceRoot ,
699+ } ,
700+ } ,
701+ ) ;
702+ const arguments_ = ( await readFile ( captureFile , "utf8" ) )
703+ . trimEnd ( )
704+ . split ( "\n" ) ;
705+ expect ( arguments_ ) . toContain ( "--audited-candidate" ) ;
706+ expect ( arguments_ ) . not . toContain ( "--public" ) ;
707+ expect ( arguments_ ) . toContain ( "--license-evidence-dir" ) ;
708+ expect ( arguments_ ) . toContain ( "--license-build-root" ) ;
709+ expect ( arguments_ ) . toContain ( "--repo-root" ) ;
710+ expect ( arguments_ [ arguments_ . indexOf ( "--repo-root" ) + 1 ] ) . toBe (
711+ firmwareSourceRoot ,
712+ ) ;
713+ } ) ;
714+
636715 it ( "leaves no finalized version or selector when final staged-root validation fails" , async ( ) => {
637716 const fixture = createFirmwareReleaseFixture ( ) ;
638717 const realBundleDirectory = await temporaryDirectory ( "real-release-bundle" ) ;
@@ -693,7 +772,7 @@ describe("external firmware bundle staging", () => {
693772 ) . resolves . toEqual ( descriptor ) ;
694773
695774 await writeFile (
696- join ( stagedRoot , "firmware" , "v0.4.1 " , "release.json" ) ,
775+ join ( stagedRoot , "firmware" , "v0.4.2 " , "release.json" ) ,
697776 new Uint8Array ( [ 0x7b , 0x7d , 0x0a ] ) ,
698777 ) ;
699778 await expect (
0 commit comments