Skip to content

feat: conditionally show Models tab only for AIBOM SBOMs#1095

Open
ikanias wants to merge 1 commit into
mainfrom
TC-4794
Open

feat: conditionally show Models tab only for AIBOM SBOMs#1095
ikanias wants to merge 1 commit into
mainfrom
TC-4794

Conversation

@ikanias

@ikanias ikanias commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Show the Models tab in the SBOM details page only when the SBOM has the label kind=aibom
  • Non-AIBOM SBOMs no longer display an irrelevant Models tab

Resolves: TC-4794

Test plan

  • Navigate to an AIBOM SBOM details page — verify the Models tab is visible
  • Click the Models tab and verify models are listed with clickable names that open the detail drawer
  • Navigate to a non-AIBOM SBOM details page — verify the Models tab is not visible
  • Verify Info, Packages, and Vulnerabilities tabs still work on both AIBOM and non-AIBOM SBOMs

🤖 Generated with Claude Code

Summary by Sourcery

Enhancements:

  • Hide the Models tab and its content for SBOMs that are not labeled with kind=aibom to avoid showing irrelevant AI model information.

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>
@sourcery-ai

sourcery-ai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This 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

Change Details Files
Conditionally render the Models tab and its content only for AIBOM SBOMs based on the sbom labels.
  • Introduce an isAibom boolean derived from sbom.labels['kind'] to detect AIBOM SBOMs.
  • Wrap the Models element in a conditional so it is rendered only when isAibom is true.
  • Wrap the Models element in a conditional so it is rendered only when isAibom is true, still wiring it to ModelsBySbom when an sbomId exists.
client/src/app/pages/sbom-details/sbom-details.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.74%. Comparing base (310ec61) to head (d07e587).

Files with missing lines Patch % Lines
client/src/app/pages/sbom-details/sbom-details.tsx 66.66% 2 Missing ⚠️
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     
Flag Coverage Δ
e2e 69.87% <100.00%> (+0.36%) ⬆️
unit 2.82% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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").
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant