@@ -310,6 +310,47 @@ test('local verification can repair mismatched metadata when requested', async (
310310 assert . equal ( updated . files [ 0 ] . size , installerBuffer . length ) ;
311311} ) ;
312312
313+ test ( 'local verification resolves renamed Windows installers when metadata lacks architecture suffix' , async ( t ) => {
314+ const workspace = await createTemporaryWorkspace ( t ) ;
315+ const version = '0.0.4' ;
316+ const releaseDir = path . join ( workspace , 'release-artifacts' , 'docforge-windows-ia32' ) ;
317+ await fs . mkdir ( releaseDir , { recursive : true } ) ;
318+
319+ const installerName = `DocForge-Setup-${ version } -ia32.exe` ;
320+ const installerPath = path . join ( releaseDir , installerName ) ;
321+ const binary = crypto . randomBytes ( 4096 ) ;
322+ await fs . writeFile ( installerPath , binary ) ;
323+
324+ const metadataPath = path . join ( releaseDir , 'latest.yml' ) ;
325+ const metadata = {
326+ version,
327+ path : `DocForge-Setup-${ version } .exe` ,
328+ sha512 : 'mismatched' ,
329+ files : [
330+ {
331+ url : `DocForge-Setup-${ version } .exe` ,
332+ sha512 : 'mismatched' ,
333+ size : 123 ,
334+ } ,
335+ ] ,
336+ } ;
337+ await fs . writeFile ( metadataPath , YAML . stringify ( metadata ) , 'utf8' ) ;
338+
339+ await runLocalVerification ( releaseDir , [ '--fix-metadata' ] ) ;
340+
341+ const expectedSha = computeSha512Base64 ( binary ) ;
342+ const updated = YAML . parse ( await fs . readFile ( metadataPath , 'utf8' ) ) ;
343+ assert . equal ( updated . path , installerName ) ;
344+ assert . equal ( updated . sha512 , expectedSha ) ;
345+ if ( Object . prototype . hasOwnProperty . call ( updated , 'size' ) ) {
346+ assert . equal ( updated . size , binary . length ) ;
347+ }
348+ assert ( Array . isArray ( updated . files ) && updated . files . length === 1 ) ;
349+ assert . equal ( updated . files [ 0 ] . url , installerName ) ;
350+ assert . equal ( updated . files [ 0 ] . sha512 , expectedSha ) ;
351+ assert . equal ( updated . files [ 0 ] . size , binary . length ) ;
352+ } ) ;
353+
313354test ( 'metadata updates remain isolated across artifact directories with identical installer names' , async ( t ) => {
314355 const workspace = await createTemporaryWorkspace ( t ) ;
315356 const version = '0.0.3' ;
0 commit comments