Skip to content

[quality] test: unit coverage for .github/scripts/sbom_diff.py - #1430

Open
kubestellar-hive[bot] wants to merge 1 commit into
testingfrom
quality/test-sbom-diff
Open

[quality] test: unit coverage for .github/scripts/sbom_diff.py#1430
kubestellar-hive[bot] wants to merge 1 commit into
testingfrom
quality/test-sbom-diff

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/test_sbom_diff.py — 37 stdlib unittest cases for .github/scripts/sbom_diff.py, the SBOM delta module that feeds release-card versions.json and release notes. It had zero assertions.

Exact ground claimed

  • New file: scripts/test_sbom_diff.py
  • Module under test: .github/scripts/sbom_diff.py (unmodified)
  • Functions covered: clean_version, short_sha, best_version, load_pkg_map, extract_notable, diff_sboms, main
  • Justfile: new test-sbom-diff recipe + one call added to validate (no edit to check-publish-workflow)

Coverage detail

  • version normalisation: semver, git-describe suffix stripping, bare 40-char SHA → short SHA, long content hashes, empty input
  • load_pkg_map: duplicate-name dedup preferring semver over SHA, linux kernel resolution via components-linux.bst SPDXID with fallback when no SPDXID matches
  • extract_notable: NOTABLE table ordering, (unknown) placeholder, changed/prev chip marking, kernel chip retained when SPDXID drifts
  • diff_sboms: added/changed/removed classification, name sorting, counts, missing-version edge cases
  • main(): versions.json shape with and without a previous SBOM, nonexistent --previous tolerated, missing --current exits 1

Disjointness

Verification

python3 -m unittest scripts.test_sbom_diff
Ran 37 tests in 0.086s — OK

Related Issue

Part of #1421


Filed by quality agent (hold-gated mode). Human review required.

— hive: agent=quality backend=copilot model=claude-opus-5

Adds scripts/test_sbom_diff.py (37 stdlib unittest cases) covering
clean_version, short_sha, best_version, load_pkg_map (including linux
kernel SPDXID resolution and duplicate-name dedup), extract_notable,
diff_sboms and the main() CLI contract.

Wires the suite into a new 'just test-sbom-diff' recipe called from
'just validate' so it gates PRs via validate.yml.

Part of #1421

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: hive-quality <hive-quality@users.noreply.github.com>
@kubestellar-hive
kubestellar-hive Bot requested a review from a team as a code owner August 28, 2026 14:14
@kubestellar-hive kubestellar-hive Bot added the hold Work is intentionally paused. label Aug 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR targets main — please retarget it to testing. All content PRs (features, fixes, BST changes) land on testing. The main branch is a release bookmark only.

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

Labels

agent/quality Approved by a Hive merger/owner for auto-merge on green CI hive/hosted-projectbluefin-knuckle-gjvq Approved by a Hive merger/owner for auto-merge on green CI hold Work is intentionally paused.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants