Repository navigation
Conversation
… list GOPATH-mode builds, such as Debian dh-golang packages, embed build information with a path line and build settings but no mod or dep records. inspect_go_binary parsed that completely and returned dependencies: [] with complete: true and no limitation, so readers took the empty list as proof of no third-party modules. The provider now adds a limitation whenever no main-module record was decoded, stating that the main module and dependency list are unknown rather than empty. The limitations list moved into a helper so inspect stays within the lint complexity budget. Fixes morluto#4191 Co-Authored-By: Claude Fable 5.1 <[email protected]>
morluto
added a commit
that referenced
this pull request
Oct 15, 2026
Explain unknown dependency coverage when embedded metadata has no main-module record. Preserve decoded dependencies and distinguish GOPATH-style omissions from observed module-mode empty lists. Refs #4191, #4267 Co-authored-by: Y0UW1SH <[email protected]>
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.
Status: incorporated upstream
The maintainer incorporated this fix into
mainin a05092726f1283d32b2afe761f430abd2de18386. That commit explicitly references #4191 and #4267 and credits @Y0UW1SH as co-author.The upstream version retains the same missing-main-module condition, improves the wording to distinguish unknown dependency coverage from successfully decoded dependency records, documents parse completeness separately, and adds public CLI Evidence coverage. This draft is superseded; its original implementation does not need another submission.
Verification of the incorporated change
Executed against upstream
d52a488476e7c41f573f23a1965d3f32d4e6a7f2on Linux x64 with the pinned Node 24.18.0/npm 11.16.0 and locked dependencies:npm run test:focused -- tests/boundary/go/goBinaryProvider.test.ts tests/boundary/go/goBinaryMappings.test.ts tests/boundary/go/goBinaryImage.test.ts tests/boundary/go/goModuleText.test.ts tests/boundary/mcp/goBinaryMcp.test.ts tests/acceptance/goBinaryCli.test.ts: runtime build succeeded; all 160 tests passed across six files.npm run checkdid not pass: it stopped on an existing formatting issue insrc/adb/AdbProvider.tson this unchanged upstream checkout. This is unrelated to the Go fix; later check stages are not claimed as passing.Original draft proposal and earlier validation
Summary
inspect_go_binary/inspect-go-binaryreturnedmodule.dependencies: []withmodule.complete: trueand no limitation for Go binaries whose embedded build information has nomodrecord, which is how Debian's dh-golang GOPATH-mode builds (gh,hugo,rclone,restic, …) embed their metadata. An agent or SBOM workflow reads that as "no third-party modules", although those binaries carry dozens of dependencies that the record simply does not list. Evidence for such binaries now carries a limitation stating that the main module and dependency list are unknown, not empty. Fixes #4191.Problem and expected behavior
Trigger: a build-info record whose module text holds a
pathline andbuildsettings but nomod/deplines (GOPATH mode), or an empty module string (moduleless Go 1.12–1.17 builds).GoModuleTextparses both completely, socompleteistrue, andGoBinaryProvideronly added limitations for a missing build-info record, non-UTF-8 strings and incomplete parsing. Nothing marked the dependency list as unknown.Violated invariant: explicit unknowns must stay visible.
docs/go-binaries.mdpromises that unfamiliar, malformed or undecodable records "do not disappear behind a complete result", andAGENTS.mdrequires preserving omission and explicit unknowns across boundaries.Expected:
module.main: nullandmodule.dependencies: []stay as observed, and the result and Evidencelimitationsstate that the main module and dependency list are unknown rather than empty. A module-mode build with amodrecord and nodeplines keeps its genuinely empty list without that limitation.Change and scope
src/go/GoBinaryProvider.ts: the limitations list now comes from alimitationsFor(info, module)helper. It addsNo main-module record was decoded from the embedded module information, as in GOPATH-mode builds; the main module and dependency list are unknown, not empty.whenever parsed module metadata hasmain === null. The existing limitation strings and their conditions are unchanged; moving them into the helper keepsinspectwithin the lint complexity budget it already exceeded (thecomplexitywarning oninspectis gone, the pre-existing one onfailureForPrimaryis untouched).docs/go-binaries.md: documents the behavior.tests/boundary/go/goBinaryProvider.test.ts: regression coverage (below).Intentionally not included: the optional
module_modefield suggested in #4191. It would change theinspect_go_binaryoutput contract and generated catalog, while the limitation delivers the same information within the existing contract.completekeeps its meaning (every module-text line was parsed).GoModuleText.tsis untouched: it reports what the record contains, and the provider owns the statement of what remains unknown, as for the other limitations.Maintainer scope decision: not applicable (ordinary fix within an existing read-only inspection).
Contract and boundary impact
GoBinaryProvider.inspectlimitation assembly, after module-text parsing and before output-schema validation.limitationsarray of the normalized result and of the Evidence.limitationsgain the conditional entry; observed fields, digests and source ranges unchanged.docs/public/product-catalog.json), package, or installation impact: none; limitation strings are not catalog content (metadata:checkpassed insidenpm run check).Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Tests added or updated:
tests/boundary/go/goBinaryProvider.test.tsgains three cases on authored ELF fixtures fromtests/fixtures/go/image.ts: (1) GOPATH-mode module text (path+buildlines only) and (2) a moduleless legacy pointer-encoded image whose module string header holds a nil pointer and zero length both returnmain: null,dependencies: [],complete: trueand the new limitation; (3) control: a module-mode record withmodand nodeplines keepsdependencies: []with no such limitation.Base reproduction or other evidence: executed. On the base revision
2202e3f0bthe GOPATH-mode case fails with exactly the three fixed limitations and nothing about the dependency list:User-visible CLI/MCP output: built CLI (
node scripts/rea.mjs inspect-go-binary <file> --json, isolatedHOME/XDG_*) on three authored fixtures, exit 0 and empty stderr each time. Printed fields arego_version, themodulerecord (settingsabbreviated to its count) and thelimitationsarray of the returned Evidence.GOPATH-mode fixture (
path+ fivebuildsettings, nomod/dep):{"go_version":"go1.19.6","module":{"path":"example.com/tool/cmd/tool","main":null,"dependencies":[],"settings":5,"complete":true}}Moduleless Go 1.17 fixture (pointer encoding, empty module string):
{"go_version":"go1.17","module":{"path":null,"main":null,"dependencies":[],"settings":0,"complete":true}}Control, module mode with no dependencies:
{"go_version":"go1.26.0","module":{"path":"example.com/tool","main":{"path":"example.com/tool","version":"(devel)","sum":"","replacement":null},"dependencies":[],"settings":1,"complete":true}}The MCP route shares the provider, and
GoBinaryServicepasses the limitations into the Evidence unchanged;tests/boundary/mcp/goBinaryMcp.test.tskeeps covering that propagation.Remaining proof gaps: no real GOPATH-built binary (the Debian
gh/hugopackages from the issue) was run; the fixtures are authored images from the repository's Go fixture builder that reproduce the record shapego version -mshows for them.npm run verify:go:binaryneeds a Go toolchain and was not run; it compares build information againstdebug/buildinfoand does not assert limitations.For evidence-bearing changes:
Validation performed
Windows 11 x64, Node 24.21.0, npm 11.19.0, locked dependencies (
npm ci), basemainat2202e3f0b.node node_modules/vitest/vitest.mjs run tests/boundary/go/goBinaryProvider.test.tsbefore the fix — 2 new tests failed as shown above, 5 passed, 1 skipped.node node_modules/vitest/vitest.mjs run tests/boundary/go/ tests/boundary/mcp/goBinaryMcp.test.ts— 5 files, 131 passed, 2 skipped.npm run build:cached— passed.node node_modules/vitest/vitest.mjs run tests/acceptance/goBinaryCli.test.tsagainst the rebuilt runtime — 26 passed, 1 skipped.npm run check(typecheck, lint, format, knip, metadata, architecture guards) — passed, 0 lint errors.npx tsc --noEmit— passed.node scripts/verify-test-discovery.mjs—Discovered all 1368 test files exactly once.node scripts/check-doc-facts.mjs— passed.npx oxlint src/go/GoBinaryProvider.ts tests/boundary/go/goBinaryProvider.test.ts— no errors; one pre-existingcomplexitywarning onfailureForPrimary(also present onmain), none oninspectany more.npx oxfmt --check src/go/GoBinaryProvider.ts tests/boundary/go/goBinaryProvider.test.ts docs/go-binaries.md— formatted.npm run verify:go:binary(no Go toolchain), Linux/macOS.Compatibility, safety, and release
verify:go:binarynot run.Author readiness
Human owner: @Y0UW1SH
Before merge
type(scope): outcome.