@@ -17,6 +17,7 @@ import { PACKAGE_INSTALL_GUARD_RELATIVE_PATH } from "../../scripts/lib/package-d
1717import { WORKSPACE_TEMPLATE_PACK_PATHS } from "../../scripts/lib/workspace-bootstrap-smoke.mjs" ;
1818
1919const CHECK_SCRIPT = "scripts/check-openclaw-package-tarball.mjs" ;
20+ const NODE_DEFAULT_SPAWN_MAX_BUFFER_BYTES = 1024 * 1024 ;
2021const FLAT_PLUGIN_SDK_DECLARATION = "dist/plugin-sdk/provider-entry.d.ts" ;
2122const DEEP_PLUGIN_SDK_DECLARATION = "dist/plugin-sdk/src/plugin-sdk/provider-entry.d.ts" ;
2223const AI_RUNTIME_PACKAGE_JSON = JSON . stringify ( {
@@ -140,6 +141,36 @@ describe("check-openclaw-package-tarball", () => {
140141 expect ( extra . stderr ) . not . toContain ( "OpenClaw package tarball does not exist" ) ;
141142 } ) ;
142143
144+ it ( "accepts tarballs whose entry list exceeds Node's default spawn buffer" , ( ) => {
145+ const longNameSuffix = "x" . repeat ( 80 ) ;
146+ const largeEntryList = Object . fromEntries (
147+ Array . from ( { length : 8_000 } , ( _ , index ) => [
148+ `dist/control-ui/assets/large-entry-list/asset-${ String ( index ) . padStart ( 5 , "0" ) } -${ longNameSuffix } .txt` ,
149+ "" ,
150+ ] ) ,
151+ ) ;
152+
153+ withTarball (
154+ [ "dist/index.js" ] ,
155+ { "dist/index.js" : "export {};\n" , ...largeEntryList } ,
156+ ( tarball ) => {
157+ const listing = spawnSync ( "tar" , [ "-tf" , tarball ] , {
158+ encoding : "utf8" ,
159+ maxBuffer : NODE_DEFAULT_SPAWN_MAX_BUFFER_BYTES * 2 ,
160+ } ) ;
161+ expect ( listing . status , listing . stderr ) . toBe ( 0 ) ;
162+ expect ( Buffer . byteLength ( listing . stdout ) ) . toBeGreaterThan (
163+ NODE_DEFAULT_SPAWN_MAX_BUFFER_BYTES ,
164+ ) ;
165+
166+ const result = spawnSync ( "node" , [ CHECK_SCRIPT , tarball ] , { encoding : "utf8" } ) ;
167+
168+ expect ( result . status , result . stderr ) . toBe ( 0 ) ;
169+ expect ( result . stdout ) . toContain ( "OpenClaw package tarball integrity passed." ) ;
170+ } ,
171+ ) ;
172+ } ) ;
173+
143174 it . runIf ( process . platform !== "win32" ) (
144175 "removes the extract dir when tar extraction fails" ,
145176 ( ) => {
0 commit comments