diff --git a/.github/workflows/studio-server-windows-files.yml b/.github/workflows/studio-server-windows-files.yml index 31f918b045..a7866affbe 100644 --- a/.github/workflows/studio-server-windows-files.yml +++ b/.github/workflows/studio-server-windows-files.yml @@ -20,6 +20,8 @@ permissions: jobs: held-file: runs-on: windows-latest + env: + HF_LINKS_REQUIRED: "1" timeout-minutes: 15 steps: - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 diff --git a/packages/core/src/safePath.eisdir.test.ts b/packages/core/src/safePath.eisdir.test.ts index c47b53416a..e525c671f0 100644 --- a/packages/core/src/safePath.eisdir.test.ts +++ b/packages/core/src/safePath.eisdir.test.ts @@ -39,7 +39,8 @@ it("still resolves paths on a volume whose native realpath refuses with EISDIR", // fails without the fix: off the event loop a link on such a volume never resolved, so the private-file check read it // under its innocuous spelling. -// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up. +// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up, +// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping. const canLink = (() => { const dir = mkdtempSync(join(tmpdir(), "link-probe-")); try { @@ -51,6 +52,10 @@ const canLink = (() => { rmSync(dir, { recursive: true, force: true }); } })(); +if (!canLink && process.env.HF_LINKS_REQUIRED) + throw new Error( + "this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)", + ); it.skipIf(!canLink)( "resolves a link off the event loop on a volume whose native realpath refuses with EISDIR", diff --git a/packages/studio-server/src/helpers/projectDisk.eisdir.test.ts b/packages/studio-server/src/helpers/projectDisk.eisdir.test.ts index c80fa4bfe2..defa9117f3 100644 --- a/packages/studio-server/src/helpers/projectDisk.eisdir.test.ts +++ b/packages/studio-server/src/helpers/projectDisk.eisdir.test.ts @@ -19,7 +19,8 @@ afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); }); -// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up. +// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up, +// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping. const canLink = (() => { const dir = mkdtempSync(join(tmpdir(), "link-probe-")); try { @@ -31,6 +32,10 @@ const canLink = (() => { rmSync(dir, { recursive: true, force: true }); } })(); +if (!canLink && process.env.HF_LINKS_REQUIRED) + throw new Error( + "this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)", + ); describe.skipIf(!canLink)("the off-loop private-file check", () => { // fails without the fix: native realpath failed at every level, so the check compared the link's own spelling and diff --git a/packages/studio-server/src/helpers/projectDisk.test.ts b/packages/studio-server/src/helpers/projectDisk.test.ts index 428b8f81c8..e2a3bc3cbe 100644 --- a/packages/studio-server/src/helpers/projectDisk.test.ts +++ b/packages/studio-server/src/helpers/projectDisk.test.ts @@ -16,7 +16,8 @@ function project(): string { return dir; } -// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up. +// Windows makes a link only with the right to (an admin, or Developer Mode); without it these cases can't be set up, +// and where a run must cover them (HF_LINKS_REQUIRED) that fails instead of skipping. const canLink = (() => { const dir = mkdtempSync(join(tmpdir(), "link-probe-")); try { @@ -28,6 +29,10 @@ const canLink = (() => { rmSync(dir, { recursive: true, force: true }); } })(); +if (!canLink && process.env.HF_LINKS_REQUIRED) + throw new Error( + "this machine cannot make links, which these tests need (HF_LINKS_REQUIRED is set)", + ); describe.skipIf(!canLink)("the off-loop private-file check", () => { // fails without the fix: a path that is there but will not resolve (a link loop) was judged by its own spelling.