Conversation
The Models tab in the SBOM details page is now only visible when the SBOM has the label kind=aibom, preventing irrelevant tab display for non-AIBOM SBOMs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR conditionally renders the Models tab and its content in the SBOM details page so that they only appear for SBOMs labeled as AI BOMs (kind=aibom), keeping the rest of the tabs unchanged. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1095 +/- ##
==========================================
+ Coverage 51.48% 51.74% +0.25%
==========================================
Files 275 275
Lines 5988 5993 +5
Branches 1853 1857 +4
==========================================
+ Hits 3083 3101 +18
+ Misses 2593 2573 -20
- Partials 312 319 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
tabKeysarray still unconditionally includes "models" even whenisAibomis false, which can lead to inconsistent tab state (e.g., selection/keyboard navigation) since a key is registered without a correspondingTab/TabContent; consider derivingtabKeysbased onisAibomor having the tab hook handle conditional tabs explicitly. - Accessing
sbom?.labels["kind"]assumeslabelsis always defined; to avoid potential runtime errors whenlabelsis missing, use optional chaining onlabelsas well (e.g.,sbom?.labels?.kind === "aibom").
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `tabKeys` array still unconditionally includes "models" even when `isAibom` is false, which can lead to inconsistent tab state (e.g., selection/keyboard navigation) since a key is registered without a corresponding `Tab`/`TabContent`; consider deriving `tabKeys` based on `isAibom` or having the tab hook handle conditional tabs explicitly.
- Accessing `sbom?.labels["kind"]` assumes `labels` is always defined; to avoid potential runtime errors when `labels` is missing, use optional chaining on `labels` as well (e.g., `sbom?.labels?.kind === "aibom"`).
## Individual Comments
### Comment 1
<location path="client/src/app/pages/sbom-details/sbom-details.tsx" line_range="103" />
<code_context>
tabKeys: ["info", "packages", "vulnerabilities", "models"],
});
+ const isAibom = sbom?.labels["kind"] === "aibom";
+
const infoTabRef = React.useRef<HTMLElement>();
</code_context>
<issue_to_address>
**issue (bug_risk):** Accessing `sbom.labels["kind"]` can throw when `labels` is undefined.
The optional chaining only guards `sbom`, not `labels`. If `labels` is `undefined` or `null`, this will still throw. Use `sbom?.labels?.['kind'] === 'aibom'` (or `sbom?.labels?.kind`) so access is fully safe.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| tabKeys: ["info", "packages", "vulnerabilities", "models"], | ||
| }); | ||
|
|
||
| const isAibom = sbom?.labels["kind"] === "aibom"; |
There was a problem hiding this comment.
issue (bug_risk): Accessing sbom.labels["kind"] can throw when labels is undefined.
The optional chaining only guards sbom, not labels. If labels is undefined or null, this will still throw. Use sbom?.labels?.['kind'] === 'aibom' (or sbom?.labels?.kind) so access is fully safe.
Summary
kind=aibomResolves: TC-4794
Test plan
🤖 Generated with Claude Code
Summary by Sourcery
Enhancements: