Skip to content

feat: use PATCH endpoint for SBOM group assignment#1144

Open
ctron wants to merge 1 commit into
guacsec:mainfrom
ctron:fix/sbom-group-patch-assignment
Open

feat: use PATCH endpoint for SBOM group assignment#1144
ctron wants to merge 1 commit into
guacsec:mainfrom
ctron:fix/sbom-group-patch-assignment

Conversation

@ctron

@ctron ctron commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switch useAddSBOMsToGroupsMutation from the PUT bulk assignment endpoint to the new PATCH endpoint
  • The PUT endpoint replaces all group assignments, so adding an SBOM to a new group removes it from previous groups
  • The PATCH endpoint preserves existing assignments, only adding/removing the specified groups

Depends on: guacsec/trustify#2450
Fixes: TC-5036

Test plan

  • Regenerate OpenAPI client after backend PR is merged
  • Verify "Add to group" preserves existing group assignments
  • Verify adding an SBOM to multiple groups works correctly

🤖 Generated with Claude Code

Summary by Sourcery

Enhancements:

  • Update SBOM group assignment client hook to call the PATCH endpoint with additive group IDs instead of the bulk replacement PUT endpoint.

@sourcery-ai

sourcery-ai Bot commented Jul 6, 2026

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

Reviewer's Guide

Switches the SBOM group assignment mutation from a bulk PUT-style replacement to a PATCH-style additive update so existing group memberships are preserved while adding SBOMs to groups.

Sequence diagram for PATCH-based SBOM group assignment

sequenceDiagram
  actor User
  participant Frontend as useAddSBOMsToGroupsMutation
  participant ApiClient as client
  participant Backend

  User->>Frontend: select group and SBOMs
  Frontend->>ApiClient: patchSbomGroupAssignments(client, body)
  note over ApiClient: body: sbom_ids, add
  ApiClient->>Backend: patchSbomGroupAssignments
  Backend-->>ApiClient: updated group assignments (existing preserved)
  ApiClient-->>Frontend: response.data
  Frontend-->>User: SBOMs shown in new group without losing prior groups
Loading

File-Level Changes

Change Details Files
Update SBOM group assignment mutation to use the new PATCH API that adds groups without replacing existing assignments.
  • Replace usage of the bulk group assignment client function with the PATCH-based client function in the SBOM queries module.
  • Adjust the mutation request payload to send SBOM IDs and an add list of group IDs instead of group_ids, aligning with the new PATCH endpoint contract.
client/src/app/queries/sboms.ts

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

@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 reviewed your changes and they look great!


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.

Switch useAddSBOMsToGroupsMutation from the PUT bulk assignment endpoint
(which replaces all assignments) to the new PATCH endpoint that
preserves existing group assignments when adding an SBOM to a new group.

Depends on: guacsec/trustify#2450

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ctron ctron force-pushed the fix/sbom-group-patch-assignment branch from aa92796 to 8a3e360 Compare July 6, 2026 11:37
@ctron ctron added the backport release/0.5.z This PR should be backported to release/0.5.z branch. label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/0.5.z This PR should be backported to release/0.5.z branch.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant