Skip to content

SBOM: validate --max-depth, and say when a closure skipped every edge - #178

Merged
villelaitila merged 1 commit into
softagram:mainfrom
villelaitila:feature/sbom-closure-followups
Aug 21, 2026
Merged

SBOM: validate --max-depth, and say when a closure skipped every edge#178
villelaitila merged 1 commit into
softagram:mainfrom
villelaitila:feature/sbom-closure-followups

Conversation

@villelaitila

Copy link
Copy Markdown
Contributor

Follow-ups to #176, split out because 1.11.0 released before they landed. #176 carried the three correctness fixes (closure tests retargeted onto the deptypes that actually carry data, depth agreeing with the dependency graph, the finding guard made to discriminate); these three did not make it in.

--max-depth accepted 0 and negative values and silently behaved as 1, contradicting its own meaning — a cap below the shallowest level excludes every component the walk could emit, so it is now refused rather than rounded up. Both public entry points validate it, and the CLI reports the flag as typed. The existing requirement that it accompany --transitive-externals had no test; removing that guard previously survived the whole suite.

An unrecognised deptype was skipped silently, so a model whose closure the converter could not read produced the same document as one with no closure at all. When a document follows no package-to-package edge while such edges were skipped, one line naming those deptypes goes to stderr.

Deliberately not one line per edge: code-level edges between externals are the ordinary case the allow-list exists to skip, so per-edge reporting would fire on nearly every model and train readers to ignore it.

docs/data-formats.md catches up with behaviour already released in 1.11.0: the depth a component publishes agrees with the dependency graph of the same document, including across inlined internal elements; the recognised deptypes are listed, so "inert" is qualified as "holds no edges the converter recognises"; and the lower bound on --max-depth is stated.

Verification

311 passed. Each new test was checked by mutation — breaking the implementation deliberately to confirm the test notices:

mutation result
drop the CLI --max-depth bound 1 failed
drop the library-side bound 1 failed
remove the --max-depth requires-closure guard 1 failed (previously survived)
report unconditionally 1 failed
remove the reporting call 1 failed
remove the default-mode early return 4 failed

Follow-ups to the transitive closure, split out because 1.11.0 released before
they landed.

--max-depth accepted 0 and negative values and silently behaved as 1, which
contradicts its own meaning: a cap below the shallowest level excludes every
component the walk could emit, so it is refused rather than rounded up. Both
public entry points validate it, and the CLI reports the flag as typed. The
existing requirement that it accompany --transitive-externals had no test and
now has one.

An edge whose deptype the converter does not recognise was skipped silently, so
a model whose closure the converter could not read produced the same document as
one with no closure at all. When a document follows no package-to-package edge
while such edges were skipped, one line naming those deptypes goes to stderr.
Deliberately not one line per edge: code-level edges between externals are the
ordinary case the allow-list exists to skip, and reporting those would fire on
nearly every model and train readers to ignore the message.

docs/data-formats.md catches up with the behaviour already released: the depth a
component publishes agrees with the dependency graph of the same document,
including across inlined internal elements; the recognised deptypes are listed,
so "inert" is qualified as "holds no edges the converter recognises"; and the
lower bound on --max-depth is stated.
@softagram-bot

Copy link
Copy Markdown

Softagram Impact Report for pull/178 (head commit: e6b28ca)

TL;DR Arch. Impact: -3 | Changed code files: 2 | Directly impacted code files: 1

⭐ Change Overview

Showing the changed files, dependency changes and the impact - click for full size
(Open in Softagram Desktop for full details)

⭐ Details of Dependency Changes (diagram)

details of dependency changes - click for full size
(Open in Softagram Desktop for full details)

🤖 AGENTS - machine-readable impact data (2 files changed, 1 impacted, +6/-0 deps)

Change overview

Head e6b28ca1d6cc vs base d82eff2d0cdb. 2 code files changed. 1 unchanged files directly depend on the changed files (see Impacted files). Dependencies: 6 added, 0 removed. New external components: 0. Removed external components: 0.

Added dependencies (6)

from to type roles signal
sgraph/tests/converters/sbom_cyclonedx_generator_test.py External/Python/Usual dependencies import test→external external dependency
sgraph/tests/converters/sbom_cyclonedx_generator_test.py/test_a_max_depth_below_one_is_rejected_rather_than_silently_treated_as_one External/Python/Usual dependencies import test→external external dependency
sgraph/tests/converters/sbom_cyclonedx_generator_test.py/test_a_max_depth_below_one_is_rejected_rather_than_silently_treated_as_one External/Python/sgraph/converters> sbom_cyclonedx_generator/generate_multi_from_sgraph import test→external external dependency
sgraph/src> sgraph/converters/sbom_cyclonedx_generator.py/generate_for_element_from_sgraph sgraph/src> sgraph/converters/sbom_cyclonedx_generator.py/_validated_max_depth func_ref prod→prod regular
sgraph/src> sgraph/converters/sbom_cyclonedx_generator.py/generate_multi_from_sgraph sgraph/src> sgraph/converters/sbom_cyclonedx_generator.py/_validated_max_depth func_ref prod→prod regular
sgraph/tests/converters/sbom_cyclonedx_generator_test.py/test_a_max_depth_below_one_is_rejected_rather_than_silently_treated_as_one sgraph/tests/converters/sbom_cyclonedx_generator_test.py/npm_chain_model func_ref test→test regular

Removed dependencies (0)

None.

Impacted files (1)

Unchanged files that directly depend on files changed in this PR - check them for behavioral impact. Grouped by changed file:

changed file directly impacted dependents
sgraph/src/sgraph/converters/sbom_cyclonedx_generator.py 1: sgraph/src/sgraph/graphdataservice.py

Complete data

[]

📄 Full report

Impact Report explained. Give feedback on this report to support@softagram.com

@villelaitila
villelaitila merged commit 5a33a29 into softagram:main Aug 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants