@@ -646,6 +646,10 @@ echo "Reference API navigation seeded.\\n";
646646async function validateSnapshotWithServer ( deps , snapshotPath , logDir , manifest ) {
647647 const restoreBlueprint = path . join ( path . dirname ( snapshotPath ) , 'restore-blueprint.json' ) ;
648648 const pathInZip = await detectPathInZip ( snapshotPath ) ;
649+ const smokeResult = {
650+ ok : false ,
651+ pathInZip : pathInZip || '' ,
652+ } ;
649653 const blueprint = {
650654 $schema : deps . playground . blueprintSchema ,
651655 preferredVersions : {
@@ -688,6 +692,7 @@ async function validateSnapshotWithServer(deps, snapshotPath, logDir, manifest)
688692 child . stdout . on ( 'data' , ( chunk ) => { output += chunk . toString ( ) ; } ) ;
689693 child . stderr . on ( 'data' , ( chunk ) => { output += chunk . toString ( ) ; } ) ;
690694
695+ let smokeError = null ;
691696 try {
692697 await waitForHttp ( `http://127.0.0.1:${ port } /reference/` , 180_000 ) ;
693698 const routeResults = { } ;
@@ -701,12 +706,23 @@ async function validateSnapshotWithServer(deps, snapshotPath, logDir, manifest)
701706 }
702707 routeResults [ route ] = { bytes : body . length } ;
703708 }
709+ smokeResult . ok = true ;
710+ smokeResult . routes = routeResults ;
704711 manifest . checks . routes = routeResults ;
705712 manifest . checks . pathInZip = pathInZip || '' ;
713+ } catch ( error ) {
714+ smokeError = error ;
715+ smokeResult . error = error instanceof Error ? error . message : String ( error ) ;
706716 } finally {
707717 child . kill ( 'SIGTERM' ) ;
708718 await fs . writeFile ( path . join ( logDir , 'restore-smoke.log' ) , output ) ;
709719 }
720+
721+ manifest . checks . restoreSmoke = smokeResult ;
722+ if ( smokeError ) {
723+ console . warn ( `Warning: docs Playground restore smoke failed: ${ smokeResult . error } ` ) ;
724+ logGroup ( 'Docs Playground restore smoke output' , output ) ;
725+ }
710726}
711727
712728async function normalizeSnapshotArchive ( inputZip , outputZip ) {
@@ -874,7 +890,8 @@ async function fetchText(url) {
874890 res . on ( 'data' , ( chunk ) => { body += chunk ; } ) ;
875891 res . on ( 'end' , ( ) => {
876892 if ( ( res . statusCode || 0 ) >= 400 ) {
877- reject ( new Error ( `${ url } returned ${ res . statusCode } ` ) ) ;
893+ const excerpt = bodyExcerpt ( body ) ;
894+ reject ( new Error ( `${ url } returned ${ res . statusCode } ${ excerpt ? `\nResponse body:\n${ excerpt } ` : '' } ` ) ) ;
878895 } else {
879896 resolve ( body ) ;
880897 }
@@ -887,6 +904,30 @@ async function fetchText(url) {
887904 } ) ;
888905}
889906
907+ function bodyExcerpt ( body , limit = 4000 ) {
908+ const clean = String ( body || '' ) . replace ( / \0 / g, '' ) ;
909+ if ( ! clean ) {
910+ return '' ;
911+ }
912+ if ( clean . length <= limit ) {
913+ return clean ;
914+ }
915+ return `${ clean . slice ( 0 , limit ) } \n...[truncated ${ clean . length - limit } chars]` ;
916+ }
917+
918+ function logGroup ( title , body , limit = 20000 ) {
919+ const clean = String ( body || '' ) . trim ( ) ;
920+ if ( ! clean ) {
921+ return ;
922+ }
923+ const excerpt = clean . length > limit
924+ ? `${ clean . slice ( clean . length - limit ) } \n...[truncated ${ clean . length - limit } earlier chars]`
925+ : clean ;
926+ console . log ( `::group::${ title } ` ) ;
927+ console . log ( excerpt ) ;
928+ console . log ( '::endgroup::' ) ;
929+ }
930+
890931async function getFreePort ( ) {
891932 return new Promise ( ( resolve , reject ) => {
892933 const server = http . createServer ( ) ;
0 commit comments