Skip to content

Enhancement: stable merge + clear warnings when vg sbom consumes multiple input SBOMs #261

Closed

Description

@vibgrate-team

Context

Adjacent SBOM ecosystems often struggle with BOM-of-BOM / multi-BOM upload semantics (duplicate components, dropped namespaces, unstable order). If vg sbom can accept or merge more than one input document, merges must stay deterministic and emit clear, actionable warnings when identities collide — never silent drops.

What to do

  1. Define/confirm merge precedence (first-wins vs severity vs explicit flag) and stable component ordering.
  2. When duplicate PURLs/versions collide, emit a machine-readable warning/finding rather than omitting quietly.
  3. Add a small fixture with two overlapping SBOMs and assert stable output + warning presence.

Acceptance

  • Multi-input merge is deterministic across runs
  • Collisions are visible (warning/finding), not silent
  • Tests + DCO; local-first (no registry auth required for the fixture)

Activity

  1. added
    enhancement
    on Sep 23, 2026
  2. vibgrate-team commented on Oct 5, 2026

    @vibgrate-team
    ContributorAuthor

    Current behaviour, so this can be scoped: vg sbom doesn't accept SBOMs as input. vg sbom export reads one scan artifact (--in, default .vibgrate/scan_result.json) and writes one CycloneDX or SPDX document. Merging external SBOMs would be a new command or flag, not a fix to existing behaviour.

    The merge that does exist is collectLockfileGraph in src/reporting/commands/sbom.ts, which folds each scanned project's lockfile into one component list:

    • Components are keyed name@version in a Map. A later lockfile silently replaces an earlier entry, and the merged components don't record which project they came from.
    • edges, rootDependsOn and ecosystem are taken from the root project's lockfile (or the first one found) and applied to every merged component. A sub-project lockfile from a different ecosystem gets the root's purl type. That part overlaps Bug: emit ecosystem-correct PURLs in SBOM exports #167.

    Proposed spec for the existing merge:

    1. Identity is (ecosystem, name, version), not name@version.
    2. Precedence: direct manifest rows first (as flattenDependencies already does), then lockfile components in sorted project-path order, first wins.
    3. Same identity from two projects is not an error. Keep one component and record every contributing project in sorted order, rather than warning.
    4. Warn only when something is dropped or guessed. That means a component whose ecosystem can't be determined, or a collision that loses information. Use the same pattern as vibgrate:purlWarning / SPDX annotations plus stderr.
    5. Fixture: two sub-projects whose lockfiles share one name@version and split another package across versions. Assert byte-identical output across two runs and the expected properties/annotations.

    If accepting external SBOMs is still wanted after that, propose it as a separate command with its own precedence rules, so this issue stays about the merge that ships today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions