Skip to content

feat(import): add SPDX import dry-run mode with impact analysis#3785

Open
ADITYA-CODE-SOURCE wants to merge 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:feature/spdx-dry-run-import
Open

feat(import): add SPDX import dry-run mode with impact analysis#3785
ADITYA-CODE-SOURCE wants to merge 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:feature/spdx-dry-run-import

Conversation

@ADITYA-CODE-SOURCE
Copy link
Contributor

Summary

This PR adds a new dry-run mode for SPDX/SBOM imports that allows users to preview the expected impact before data is persisted to the database, addressing issue #3629.

Changes

  • Add new Thrift structures: SpdxImportDryRunResult, SpdxComponentInfo, and LicenseConflictInfo for structured impact analysis response
  • Add dryRunImportBom method to ComponentService thrift interface
  • Implement dry-run logic in SpdxBOMImporter that:
    • Parses SPDX file without writing to database
    • Detects new vs existing components
    • Identifies license conflicts between proposed and existing licenses
    • Returns detailed impact analysis report
  • Add handler method in ComponentHandler
  • Add service method in Sw360ComponentService
  • Add REST endpoint: POST /components/import/SBOM/dryRun
  • Add Jackson mixins for new response types

Impact Report

The dry-run endpoint returns:

  • newComponents: components that would be created
  • existingComponents: components that already exist
  • licenseConflicts: mismatches between proposed and existing licenses
  • warnings: any validation issues

This feature provides transparency and confidence in SPDX imports before they are executed.

Testing

The implementation follows the existing patterns for SBOM import and can be tested by:

  1. Uploading an SPDX file to the new /components/import/SBOM/dryRun endpoint
  2. Verifying the response contains correct new/existing component detection
  3. Verifying license conflicts are properly identified

Related Issue

Fixes #3629

This commit adds a new dry-run mode for SPDX/SBOM imports that allows
users to preview the expected impact before data is persisted to the
database.

Changes:
- Add new Thrift structures: SpdxImportDryRunResult, SpdxComponentInfo,
  and LicenseConflictInfo for structured impact analysis response
- Add dryRunImportBom method to ComponentService thrift interface
- Implement dry-run logic in SpdxBOMImporter that:
  - Parses SPDX file without writing to database
  - Detects new vs existing components
  - Identifies license conflicts between proposed and existing licenses
  - Returns detailed impact analysis report
- Add handler method in ComponentHandler
- Add service method in Sw360ComponentService
- Add REST endpoint: POST /components/import/SBOM/dryRun
- Add Jackson mixins for new response types

The dry-run endpoint returns:
- newComponents: components that would be created
- existingComponents: components that already exist
- licenseConflicts: mismatches between proposed and existing licenses
- warnings: any validation issues

This feature addresses issue eclipse-sw360#3629 by providing transparency and
confidence in SPDX imports before they are executed.
@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SPDX Import Dry-Run Mode with Impact Analysis and Conflict Detection

2 participants