Repository navigation
fix(native): name numeric Mach-O build-version platforms and tools - #2065
Conversation
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. |
NIU-123370
left a comment
There was a problem hiding this comment.
Local review completed. The numeric-to-symbolic Mach-O mapping preserves unknown values and raw load-command fields. Focused native golden suite passed: 13 tests.
|
Checked the CI failures locally. The failing cases do not fail with this diff applied, so I don't read them as a regression from this PR. What CI reported (the only run visible for this head
This diff is Local reproduction (macOS, Node v22.12.0, dependencies from this repo's lockfile;
Where that leaves it: no observed net regression from this change. I can't go further than that — I have no rights to re-run a workflow on this repo, and the failing signature exists only in this one run, so "environment/load" versus "something real" is not settled yet. For reference, the last completed Nothing in the change itself needs my review to be different: unknown platform/tool codes keep their printed value, raw |
Non-verbose otool prints LC_BUILD_VERSION platform and tool codes as numbers, so inspect_macho build metadata reported platform "1" and tool "3" while LC_VERSION_MIN_* commands report symbolic platforms such as "MACOSX". Name the codes declared in the SDK's <mach-o/loader.h> and keep unknown codes as printed. Raw load-command fields are unchanged.
5deaf25 to
cdc0ad2
Compare
|
@greptileai review |
|
|
Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open. The producer no longer derives platform codes from array positions: every platform is bound to its explicit numeric code. Added independent table cases for all 24 platforms and all 11 declared tool codes, while retaining the existing unknown-code and already-symbolic cases. This removes the positional brittleness and covers the requested complete mapping; the added tests were not run at the user's request. Source inspected at 49f7765; git diff --check passed. Tests, builds, source checks and CI reruns were skipped at the user's explicit request. No passing runtime/provider verification is claimed for this update. |
…orluto#2065) Squash merge of morluto#2065. Co-authored-by: TonyWu <[email protected]>
Summary
inspect_machoreportsbuild_metadatafromotool -h -l. Non-verbose otool printsLC_BUILD_VERSIONplatform and tool codes as numbers, so a modern Mach-O reportsplatform: "1"and toolname: "3".LC_VERSION_MIN_*commands in the same field report symbolic platforms ("MACOSX","IPHONEOS"). Callers have to know<mach-o/loader.h>to read the build platform, and the values from the two command kinds cannot be compared directly.No linked issue: I found this while running
inspect-machoagainst system binaries on macOS 26.5.1.Problem and expected behavior
Before, for
/bin/ls(arm64e slice):{"platform":"1","minimum_os":"11.0","sdk":"26.5","tools":[{"name":"3","version":"1267.0"}]}otool -lvandvtool -show-buildprint the same command asplatform MACOS/tool LD. The normalized result should use the symbolic names too.Change and scope
parseOtoolLoadCommandsmaps the platform and tool codes declared in the SDK's<mach-o/loader.h>(PLATFORM_MACOS1 …PLATFORM_VISIONOS_EXCLAVEKIT24,TOOL_CLANG…TOOL_METAL_FRAMEWORK) to their names without the prefix. These matchotool -lvoutput, except that otool printsTOOL_METALfor 1024 where this usesMETAL.load_commands[].fieldsstill carry otool's numeric values. Only normalizedbuild_metadatachanges.Contract and boundary impact
src/native/parsers/otool.ts(collectBuild,parseBuildTools)build_metadata[].platformandtools[].nameremain strings; their values for known codes change from numeric to symbolic.Evidence and regression coverage
Tests added or updated:
tests/boundary/providers/native/nativeLoadKinds.golden.test.ts: "names numeric build-version platforms and tools". It covers known and unknown platform codes, known and unknown tool codes, already-symbolic input, and unchanged raw fields.Base reproduction or other evidence: the new test fails on
3bdc873and passes with this change. I took the name table from the macOS 26.5 SDKloader.hand checked it againstotool -lv(cctools-1040) on binaries rewritten withvtool -set-build-versionfor platforms 1–24 and each declared tool.User-visible CLI/MCP output:
rea inspect-macho /bin/ls --format jsonnow reports{"platform":"MACOS","minimum_os":"11.0","sdk":"26.5","tools":[{"name":"LD","version":"1267.0"}]}Remaining proof gaps: none known
Observed, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run test:focused -- tests/boundary/providers/native/nativeLoadKinds.golden.test.ts tests/boundary/providers/native/nativeMachoHeader.golden.test.ts tests/boundary/providers/native/nativeSelectedArchitecture.test.ts tests/boundary/providers/native/nativeReexport.golden.test.ts: 37 passednpm run check:fast: passedrea inspect-machoon/bin/ls,/usr/bin/ssh,/usr/libexec/sharingd,Calculator.app(macOS 26.5.1, Apple silicon): symbolic build metadataCompatibility, safety, and release
"1","3") inbuild_metadatanow see"MACOS"/"LD". The raw numeric values remain inload_commands[].fields.Review checklist
type(scope): outcome.