From 4cb08becfada8ededdcd2b6cc990bbe5618f37d5 Mon Sep 17 00:00:00 2001 From: Orca Worker Date: Sat, 5 Sep 2026 22:53:14 -0700 Subject: [PATCH] test(build): key the relay line-ending pin off the manifest, not a directory A path glob proves the directory is non-empty, not that it is still the directory build-relay reads from. Relocating an asset into config/scripts (where only **/*.mjs is pinned) reintroduced the CRLF bug with the suite fully green. RELAY_ARTIFACTS is the right anchor: build-relay refuses to emit an artifact absent from it, so a relocated or new asset cannot slip past. Bundles have no tracked source and drop out with zero hits. --- .../relay-asset-line-ending-pin.test.mjs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/config/scripts/relay-asset-line-ending-pin.test.mjs b/config/scripts/relay-asset-line-ending-pin.test.mjs index 95808cc8130..6e0f358f333 100644 --- a/config/scripts/relay-asset-line-ending-pin.test.mjs +++ b/config/scripts/relay-asset-line-ending-pin.test.mjs @@ -1,5 +1,6 @@ import { execFileSync } from 'node:child_process' import { resolve } from 'node:path' +import { RELAY_ARTIFACTS } from '../../src/shared/relay-artifacts.ts' import { describe, expect, it } from 'vitest' /** @@ -16,7 +17,6 @@ import { describe, expect, it } from 'vitest' * mac runner and 11547 (= 11229 + 318 lines) from the Windows one. */ const projectDir = resolve(import.meta.dirname, '../..') -const ASSET_DIRECTORY = 'config/relay-assets' function git(args) { return execFileSync('git', args, { cwd: projectDir, encoding: 'utf8' }) @@ -32,13 +32,26 @@ function eolAttributes(paths) { return found } -function relayAssets() { - return git(['ls-files', '-z', '--', ASSET_DIRECTORY]).split('\0').filter(Boolean) +/** + * Keyed off the manifest, not a directory: build-relay refuses to emit an + * artifact absent from RELAY_ARTIFACTS, so relocating an asset cannot slip + * past this the way a path glob would. esbuild bundles have no tracked + * source and contribute no hits, so they need no classifying. + */ +function trackedManifestSources() { + const paths = new Set() + for (const { filename } of RELAY_ARTIFACTS) { + const hits = git(['ls-files', '-z', '--', `*/${filename}`]).split('\0').filter(Boolean) + for (const path of hits) { + paths.add(path) + } + } + return [...paths] } describe('config/relay-assets line-ending pin', () => { - it('pins every relay asset to LF', () => { - const assets = relayAssets() + it('pins every tracked relay artifact source to LF', () => { + const assets = trackedManifestSources() expect(assets.length).toBeGreaterThan(0) const attributes = eolAttributes(assets)