Skip to content

Initialize sbomSet when nil instead of error#306

Merged
matthyx merged 1 commit intomainfrom
fix-304
Apr 1, 2026
Merged

Initialize sbomSet when nil instead of error#306
matthyx merged 1 commit intomainfrom
fix-304

Conversation

@matthyx
Copy link
Copy Markdown
Contributor

@matthyx matthyx commented Apr 1, 2026

Fixes #304
This is safe to do after ensuring kubescape/kubevuln#339

Summary by CodeRabbit

  • Bug Fixes
    • Improved error resilience by gracefully initializing default values instead of returning errors in edge cases.

@matthyx matthyx added the release label Apr 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

The change modifies error handling in the dynamic path detector to proceed with an empty set when SBOM data is unavailable, instead of returning an error. This enables dynamic path compression to execute even without SBOM information.

Changes

Cohort / File(s) Summary
Dynamic Path Detector
pkg/registry/file/dynamicpathdetector/analyze_opens.go
Removed errors import and replaced nil-check error return with initialization of empty thread-unsafe set, allowing the detector to proceed when SBOM is missing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

Poem

🐰 No more heartbreak when SBOM's away,
Dynamic paths compress! Hip-hip-hooray!
Empty sets flow where errors once stood,
Millions collapse to thousands—so good! ✨
Lucene files bow down, compression's the way!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: initializing sbomSet when nil instead of returning an error, which is the core fix in the pull request.
Linked Issues check ✅ Passed The pull request implements the proposed fix from issue #304 by initializing sbomSet to an empty set when nil instead of returning an error, enabling dynamic path compression to run even without SBOM data.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing issue #304; the modification to analyze_opens.go only changes the nil-handling behavior as required by the issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-304

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Summary:

  • License scan: failure
  • Credentials scan: failure
  • Vulnerabilities scan: failure
  • Unit test: success
  • Go linting: failure

@matthyx matthyx merged commit 8bc5305 into main Apr 1, 2026
7 checks passed
@matthyx matthyx deleted the fix-304 branch April 1, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dynamic path compression bypassed when SBOM is missing

1 participant