Repository navigation
fix(sbom): stable component order independent of filesystem walk - #424
Merged
Merged
Conversation
Direct scan rows were emitted ahead of the sorted lockfile-only list, so CycloneDX components, dependency entries, and SPDX packages followed scan and filesystem order. Sort the full list by Package URL when one is written, otherwise by name, then version, then ecosystem, and apply the same order to graph CycloneDX and SPDX export. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
Sort SBOM components by Package URL when one is written, otherwise by package name, then by version. Rows that share a purl and a version are ordered by name. CycloneDX components, dependency entries, and SPDX packages, including SPDXRef-Package-N, follow that order. Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: vibgrate-team <vibgrate-team@users.noreply.github.com>
vibgrate-team
marked this pull request as ready for review
October 9, 2026 13:23
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
vg sbom exportused to emit direct scan rows in scan order, which follows the filesystem walk, and sorted only the lockfile-only rows after them. The same tree could therefore produce a differentcomponentsorder, differentSPDXRef-Package-Nids, and a different order of dependency entries.SBOM component and dependency arrays are now sorted before serialization:
Rows that share a purl and version are ordered by name. CycloneDX
dependenciesstill starts withvibgrate-root, followed by the components in that order. Directory walk order and map iteration no longer changecomponents, SPDXpackages, or those dependency entries. Document ids stay content-derived.vg exportCycloneDX and SPDX use the same order.A fixture test runs the export twice, reversing the lockfile component list and the edge map and moving a package with no purl inside the same project. Both runs emit identical CycloneDX and SPDX documents, serial number included.
Related issues
Closes #286
Checklist
pnpm testpassespnpm lintis cleanpnpm typecheckis cleanHow to verify
pnpm test pnpm lint pnpm typecheck