Repository navigation
fix(artifacts): mark Windows launchable files as host executables - #1824
Merged
Merged
Conversation
Host-file occurrences derived `executable` from POSIX execute bits, which Windows never reports, so every Windows host file (including PE .exe images classified as executable) reported `executable: false`. Derive the fact once through hostExecutable: POSIX hosts keep the execute bits; Windows marks regular files with the extensions it launches directly (.exe, .com, .bat, .cmd), without reading the ambient PATHEXT. Fixes morluto#1819
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merge main and reuse its hostExecutableMarking helper from morluto#1823. Remove the duplicate helper and consolidate the additional Windows filename cases into the existing regression suite. Validation: 20 focused artifact tests passed; npm run check passed; all 854 test files discovered exactly once. Windows-specific helper cases ran on macOS; no native Windows run.
3 tasks done
Owner
|
This makes Windows artifact inventories internally consistent, @dollarsmoney. Deriving host-file executability from the fixed launchable extensions on Windows, while retaining mode bits on POSIX, fixes PE entries otherwise labeled as executable artifacts with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1819.
On a Windows host, every occurrence built from a host file reported
executable: false, including real PE images. The same occurrence also reportedartifact_kind: executableandartifact_format: pe, so the record contradicted itself. Host-file occurrences now reportexecutable: truefor files Windows launches directly. POSIX hosts behave as before.Problem and expected behavior
DirectoryArtifactReader(every directory entry) andscanCanonical(the root occurrence) both derived the fact as(metadata.mode & 0o111) !== 0. Windows has no execute permission bit. libuv fillsstat.modefrom file attributes only (0o666, or0o444when read-only), so the test can never be true on Windows.Expected:
executablestates whether the file carries the host's executable marking. On POSIX that is the execute bits, as before. On Windows it is the file extension that the shell andCreateProcesslaunch directly.Change and scope
src/artifacts/hostExecutable.ts,hostExecutable(path, metadata, platform = process.platform):(mode & 0o111) !== 0(unchanged).win32: a regular file whose case-insensitive extension is.exe,.com,.bator.cmd. These are the extensions proposed in the issue.PATHEXTis deliberately not read, because it is ambient environment configuration.PATHEXTscript-host extensions (.vbs,.js,.wsf, …) are not launched directly and are out of scope.Contract and boundary impact
src/artifacts/).executableoccurrence fact on Windows-hosted inventories.compare_artifactscan now report permission differences for Windows-hosted inventories (src/domain/artifactComparison.ts).Evidence and regression coverage
src/artifacts/hostExecutable.test.ts, which exercises the derivation with an explicit platform so the Windows branch runs on any CI host:.exewithout execute bits stayingfalse..exe/.EXE/.Cmd/.bat/.comwith mode0o666and read-only0o444→true..dll,.txt, extensionless,archive.exe.bakand a directory namedbundle.exe→false.falsebecause the mode carries no execute bits.rea inspect-artifactstill reports the root occurrence as"executable":truefor a0755copy of/bin/lsand"executable":falsefor a0644copy namedplain.exe. The POSIX behavior is unchanged.windows-curatedCI lane would provide that coverage.For evidence-bearing changes:
Validation performed
All on macOS 15 (Darwin 24.3.0, arm64), Node 26.9.0:
npm run test:local -- src/artifacts/hostExecutable.test.ts— 3 tests passednpm run test:focused -- tests/boundary/filesystem/artifactInventorySnapshot.test.ts tests/boundary/filesystem/directoryArtifactReaderOpen.test.ts tests/boundary/filesystem/directoryArtifactReaderOwnership.test.ts tests/boundary/filesystem/artifactMzInventory.test.ts— 17 tests passednpm run verify:test-discovery— discovered all 835 test files exactly oncenpm run check:fast— typecheck and lint passed (also ran as the pre-push hook)npm run build:cached, thennode scripts/rea.mjs inspect-artifact <file> --jsonon the two macOS copies above — results as listedCompatibility, safety, and release
lstatmetadata and path; no new filesystem access or environment reads.Review checklist
type(scope): outcome.