refactor(application): read the host from HostPlatform in the remaining application modules (#11124)

Scenario planning and plan Evidence take a required platform. Host file operations (target resolution, output trees, Windows spelling lookup, executable checks, native snapshot admission), the Linux distribution read and the process CLI adapter read HOST_PLATFORM explicitly. ByteEntropyService takes an optional platform seam, so its Windows casing test injects win32 instead of stubbing process.platform. src/application no longer reads process.platform or process.arch.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 22:03:14 +08:00
1 parent 341924d043
commit 271e375924
15 files changed
+55 -46

No files matched your search

@@ -1,3 +1,4 @@
import { HOST_PLATFORM } from "../../platform/HostPlatform.js";
import { absoluteCallerPath } from "../../filesystem/callerPath.js";
import { createHash } from "node:crypto";
import { constants } from "node:fs";
@@ -67,6 +68,8 @@ export class ByteEntropyService {
"open" | "stat"
> = { open, stat },
resources: ArtifactResourceScope = new ArtifactResourceScope(),
// The selected path is read on this host unless a caller selects one.
private readonly platform: NodeJS.Platform = HOST_PLATFORM.platform,
) {
this.#resources = resources;
}
@@ -189,7 +192,7 @@ export class ByteEntropyService {
admitted = true;
// Only an admitted selected file may consult filesystem spelling. Do not
// replace symlink/junction/8.3 aliases or touch source-derived paths.
if (process.platform === "win32") {
if (this.platform === "win32") {
const canonical = await realpath(input.path).catch(() => undefined);
assertArtifactReadActive(options?.signal);
if (canonical?.toLowerCase() === input.path.toLowerCase())