Skip to content

feat(api): add unknown severity field and enum value#110

Merged
ruromero merged 2 commits into
guacsec:mainfrom
ruromero:TC-4723
Jun 8, 2026
Merged

feat(api): add unknown severity field and enum value#110
ruromero merged 2 commits into
guacsec:mainfrom
ruromero:TC-4723

Conversation

@ruromero

@ruromero ruromero commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add unknown integer property (default 0) to the SourceSummary schema in the v5 OpenAPI spec, positioned after low and before remediations, to count vulnerabilities with no CVSS score or severity classification
  • Add UNKNOWN value to the Severity enum after LOW
  • Update SeverityUtilsTest to validate UNKNOWN as a valid severity value instead of rejecting it

Test plan

  • OpenAPI spec passes npx @redocly/cli lint api/v5/openapi.yaml validation
  • mvn package succeeds with all tests passing (25 tests)
  • Generated SourceSummary.java has getUnknown()/setUnknown() methods
  • Generated SourceSummary.ts has unknown?: number field
  • Generated Severity.java has UNKNOWN enum constant
  • Generated Severity.ts has Unknown = 'UNKNOWN' entry

Implements TC-4723

Summary by Sourcery

Add support for an UNKNOWN severity level and an unknown vulnerability count in the v5 API schema and utilities.

New Features:

  • Expose an unknown integer field on SourceSummary in the v5 OpenAPI schema to count vulnerabilities without a known severity.
  • Introduce an UNKNOWN value in the Severity enum to represent vulnerabilities with unspecified severity.

Tests:

  • Update SeverityUtils tests to treat UNKNOWN as a valid severity and to ensure invalid severities still throw errors.

Add `unknown` integer property to SourceSummary schema and `UNKNOWN`
value to the Severity enum. This enables counting vulnerabilities with
no CVSS score or severity classification. Update SeverityUtilsTest to
reflect that "unknown" is now a valid severity value.

Implements TC-4723

Assisted-by: Claude Code
@sourcery-ai

sourcery-ai Bot commented Jun 8, 2026

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

Reviewer's Guide

Adds an unknown severity bucket to the v5 API schema and severity model, and updates severity parsing/tests to treat UNKNOWN as a valid enum value instead of an error.

File-Level Changes

Change Details Files
Add unknown severity bucket to SourceSummary in v5 OpenAPI spec.
  • Extend SourceSummary schema with integer unknown field (default 0) placed after low and before remediations.
  • Ensure unknown is included in generated API models (Java/TypeScript) via OpenAPI generation.
api/v5/openapi.yaml
Introduce UNKNOWN severity enum value and accept it in parsing utilities.
  • Add UNKNOWN value to Severity enum definition in the OpenAPI spec.
  • Update SeverityUtilsTest to assert that fromValue() parses unknown/UNKNOWN into Severity.UNKNOWN and still rejects invalid severities.
api/v5/openapi.yaml
src/test/java/io/github/guacsec/trustifyda/api/v5/SeverityUtilsTest.java

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-commenter

codecov-commenter commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.00%. Comparing base (ea9aaad) to head (75dbb13).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #110      +/-   ##
============================================
+ Coverage     94.89%   95.00%   +0.10%     
- Complexity       34       35       +1     
============================================
  Files             4        4              
  Lines            98      100       +2     
  Branches          8        9       +1     
============================================
+ Hits             93       95       +2     
  Misses            4        4              
  Partials          1        1              
Flag Coverage Δ
unit-tests 95.00% <100.00%> (+0.10%) ⬆️

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

Files with missing lines Coverage Δ
...ithub/guacsec/trustifyda/api/v5/SeverityUtils.java 92.30% <100.00%> (+1.39%) ⬆️
🚀 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

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.

Change fromScore parameter from primitive float to boxed Float so
callers can pass null when no CVSS score is available, returning
Severity.UNKNOWN instead of forcing a default numeric value.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ruromero
ruromero requested a review from a-oren June 8, 2026 10:00
@ruromero

ruromero commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator Author

Verification Report for TC-4723 (commit 75dbb13)

Check Result Details
Review Feedback N/A No code change requests on the PR
Root-Cause Investigation N/A No sub-tasks created
Scope Containment WARN 2 out-of-scope files (SeverityUtils.java, SeverityUtilsTest.java); justified — utility and test changes are necessary to support the new UNKNOWN severity
Diff Size PASS +26/-8 across 3 files, proportionate to task scope
Commit Traceability PASS TC-4723 referenced in commit 196e242
Sensitive Patterns PASS No secrets detected
CI Status PASS All 4 checks passed (OpenAPI Linter, Sourcery, Tests 17, Tests 21)
Acceptance Criteria PASS 4 of 4 criteria met
Test Quality PASS Eval Quality: N/A
Test Change Classification ADDITIVE 2 new tests added, 1 test replaced with stronger coverage
Verification Commands PASS Lint valid, mvn package succeeds, all generated models verified

Overall: WARN

Scope Containment flagged 2 files not listed in the task's "Files to Modify" section (SeverityUtils.java and SeverityUtilsTest.java). These are justified: the utility class needed a floatFloat signature change to handle null CVSS scores, and the test updates verify the new behavior. All task-required files are present and all acceptance criteria are met.


This comment was AI-generated by sdlc-workflow/verify-pr v0.9.2.

@a-oren a-oren 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.

LGTM

@ruromero
ruromero merged commit d384dec into guacsec:main Jun 8, 2026
4 checks passed
@ruromero
ruromero deleted the TC-4723 branch June 8, 2026 12:05
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.

3 participants