Two glob() calls in the load-manifest patch plugin (dist/cli/build/patches/plugins/load-manifest.js in @opennextjs/cloudflare 1.20.1; its src counterpart) feed codegen directly without sorting. glob's own README documents the filesystem walk as indeterminate order, by design. getEvalManifestRule then orders paths with .toSorted((a, b) => b.length - a.length) — a stable sort — so equal-length paths keep whatever order glob() returned.
Repro: any app with two routes whose *_client-reference-manifest.js paths are equal length (ours: /request and /privacy). The generated if ($PATH.endsWith(...)) chain in handler.mjs swaps branch order between builds of the same commit — we observed ~1 divergent build in 13 from-scratch builds with every input file byte-identical.
Impact: breaks byte-reproducible builds; runtime behavior unaffected (branches are mutually exclusive exact-suffix checks).
Fix: sort both glob() results at the call site — (await glob(...)).sort() in getLoadManifestRule and getEvalManifestRule. We run exactly that as a pnpm patch in production; happy to open a PR.
Two
glob()calls in the load-manifest patch plugin (dist/cli/build/patches/plugins/load-manifest.jsin@opennextjs/cloudflare1.20.1; itssrccounterpart) feed codegen directly without sorting.glob's own README documents the filesystem walk as indeterminate order, by design.getEvalManifestRulethen orders paths with.toSorted((a, b) => b.length - a.length)— a stable sort — so equal-length paths keep whatever orderglob()returned.Repro: any app with two routes whose
*_client-reference-manifest.jspaths are equal length (ours:/requestand/privacy). The generatedif ($PATH.endsWith(...))chain inhandler.mjsswaps branch order between builds of the same commit — we observed ~1 divergent build in 13 from-scratch builds with every input file byte-identical.Impact: breaks byte-reproducible builds; runtime behavior unaffected (branches are mutually exclusive exact-suffix checks).
Fix: sort both
glob()results at the call site —(await glob(...)).sort()ingetLoadManifestRuleandgetEvalManifestRule. We run exactly that as apnpm patchin production; happy to open a PR.