Skip to content

Conversation

@gildub
Copy link
Contributor

@gildub gildub commented Jun 4, 2025

Along with #1749, this PR is partially fixing https://issues.redhat.com/browse/TC-2564 which is about using full text search to find information about version.

To be able to search versions data requires to have a versions column added to sbom table.
That's the main purpose of this PR.
This will also allow to specifically search versions which is different than full text search across the sbom.

Summary by Sourcery

Add a new "versions" field to SBOM entities and enable version-specific filtering

New Features:

  • Persist a versions column in the SBOM database table with a migration
  • Expose SBOM.versions in GraphQL queries and vulnerability advisory summaries

Enhancements:

  • Populate the new versions field when ingesting SPDX, CycloneDX, and ClearlyDefined SBOMs
  • Extend the SBOM search translator to support exact and substring matches on versions

Build:

  • Add migration m0001080_sbom_add_versions to add and remove the versions column

Tests:

  • Add integration tests for querying SBOMs by version filters

@gildub gildub requested a review from jcrossley3 June 4, 2025 15:57
@gildub
Copy link
Contributor Author

gildub commented Jun 4, 2025

@jcrossley3 , is that test error expected ?
2025-06-04T16:12:49.457923Z ERROR trustify_common::db::query::columns::tests: Query syntax error: 'missing' is an invalid field. Try [authors, id, location, name, published, purl, score, severity, title, type, version]

@jcrossley3
Copy link
Contributor

jcrossley3 commented Jun 4, 2025

@jcrossley3 , is that test error expected ? 2025-06-04T16:12:49.457923Z ERROR trustify_common::db::query::columns::tests: Query syntax error: 'missing' is an invalid field. Try [authors, id, location, name, published, purl, score, severity, title, type, version]

Yes. Per our chat, many of our unit tests invoke code branches that may result in error messages logged to stdout. It's the failures, not the errors, you want to focus on.

@ctron
Copy link
Contributor

ctron commented Jun 5, 2025

/scale-test

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

🛠️ Scale test has started! Follow the progress here: Workflow Run

@ctron
Copy link
Contributor

ctron commented Jun 5, 2025

To my understanding, this will join and expand searching for SBOMs with all packages. Which can be huge! Just for the case when the user might want to search for this information. And not even all information, just for the packages describing the SBOM, right?

I think we should only add a join like this in cases where the user actually wants to search for this information.

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

Goose Report

Goose Attack Report

Plan Overview

Action Started Stopped Elapsed Users
Increasing 25-06-05 07:27:02 25-06-05 07:27:07 00:00:05 0 → 5
Maintaining 25-06-05 07:27:07 25-06-05 07:32:07 00:05:00 5
Decreasing 25-06-05 07:32:07 25-06-05 07:32:08 00:00:01 0 ← 5

Request Metrics

Method Name # Requests # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
GET get_advisory_by_doc_id 79 (-26) 0 18.33 (+6.75) 4 (+1) 73 (+8) 0.26 (-0.09) 0.00 (+0.00)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 80 (-24) 0 1222.26 (+136.21) 433 (+7) 2679 (+172) 0.27 (-0.08) 0.00 (+0.00)
GET list_advisory 81 (-23) 0 2663.12 (-71.40) 1805 (+101) 3514 (+7) 0.27 (-0.08) 0.00 (+0.00)
GET list_advisory_paginated 80 (-25) 0 2644.77 (+99.88) 1584 (+230) 3669 (-8) 0.27 (-0.08) 0.00 (+0.00)
GET list_importer 78 (-28) 0 7.72 (+3.84) 1 (0) 64 (+13) 0.26 (-0.09) 0.00 (+0.00)
GET list_organizations 80 (-23) 0 19.46 (+4.98) 1 (0) 61 (+6) 0.27 (-0.08) 0.00 (+0.00)
GET list_packages 78 (-28) 0 363.54 (+17.10) 71 (+1) 680 (-92) 0.26 (-0.09) 0.00 (+0.00)
GET list_packages_paginated 78 (-28) 0 336.94 (-0.42) 90 (-21) 487 (-283) 0.26 (-0.09) 0.00 (+0.00)
GET list_products 80 (-25) 0 13.15 (+2.56) 3 (0) 63 (+4) 0.27 (-0.08) 0.00 (+0.00)
GET list_sboms 80 (-25) 0 2957.71 (+1671.14) 2168 (+1478) 3638 (+1731) 0.27 (-0.08) 0.00 (+0.00)
GET list_sboms_paginated 80 (-24) 0 2260.20 (+1356.94) 1675 (+1293) 2866 (+786) 0.27 (-0.08) 0.00 (+0.00)
GET list_vulnerabilities 78 (-28) 0 278.37 (+23.64) 41 (-33) 610 (+70) 0.26 (-0.09) 0.00 (+0.00)
GET list_vulnerabilities_paginated 78 (-28) 0 203.60 (+7.10) 31 (-2) 352 (-28) 0.26 (-0.09) 0.00 (+0.00)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 80 (-23) 0 67.31 (-9.63) 12 (-3) 205 (+6) 0.27 (-0.08) 0.00 (+0.00)
GET search_advisory 79 (-27) 0 1271.37 (+104.09) 278 (-130) 2090 (+472) 0.26 (-0.09) 0.00 (+0.00)
GET search_exact_purl 80 (-25) 0 10.79 (-2.24) 3 (+1) 60 (-10) 0.27 (-0.08) 0.00 (+0.00)
GET search_purls 80 (-28) 0 4526.11 (+1233.58) 1729 (+601) 14485 (-923) 0.27 (-0.09) 0.00 (+0.00)
Aggregated 1349 (-438) 0 1117.99 (+274.83) 1 (0) 14485 (-923) 4.50 (-1.46) 0.00 (+0.00)

Response Time Metrics

Method Name 50%ile (ms) 60%ile (ms) 70%ile (ms) 80%ile (ms) 90%ile (ms) 95%ile (ms) 99%ile (ms) 100%ile (ms)
GET get_advisory_by_doc_id 9 (+3) 11 (+3) 12 (+3) 22 (+11) 59 (+42) 61 (+5) 68 (+7) 73 (+8)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 1,000 (0) 1,000 (0) 1,000 (0) 2,000 (+1,000) 2,000 (0) 2,000 (0) 2,000 (0) 2,679 (+172)
GET list_advisory 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,514 (+7)
GET list_advisory_paginated 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,669 (-8)
GET list_importer 3 (+1) 3 (0) 5 (+2) 7 (+3) 18 (+13) 50 (+42) 55 (+6) 64 (+13)
GET list_organizations 6 (+1) 9 (+4) 44 (+37) 46 (+4) 49 (+2) 53 (+3) 56 (+2) 61 (+6)
GET list_packages 380 (+50) 390 (+20) 390 (+10) 410 (+20) 460 (+40) 480 (+20) 600 (+100) 680 (-92)
GET list_packages_paginated 370 (+50) 390 (+30) 400 (+20) 410 (+20) 420 (+10) 470 (+50) 480 (-20) 487 (-283)
GET list_products 8 (+2) 9 (+3) 11 (+4) 12 (+3) 22 (+2) 59 (+5) 63 (+4) 63 (+4)
GET list_sboms 3,000 (+2,000) 3,000 (+2,000) 3,000 (+2,000) 3,000 (+2,000) 3,000 (+1,093) 3,000 (+1,093) 3,638 (+1,731) 3,638 (+1,731)
GET list_sboms_paginated 2,000 (+1,200) 2,000 (+1,100) 2,000 (+1,000) 2,866 (+1,866) 2,866 (+1,866) 2,866 (+866) 2,866 (+866) 2,866 (+866)
GET list_vulnerabilities 270 (+40) 290 (+20) 290 (+10) 310 (+10) 400 (+80) 480 (+50) 600 (+100) 600 (+100)
GET list_vulnerabilities_paginated 200 (+10) 210 (+10) 220 (+10) 240 (+20) 280 (+10) 290 (+10) 320 (+30) 350 (-30)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 60 (-11) 69 (-6) 78 (-2) 120 (0) 160 (-10) 180 (0) 190 (-9) 205 (+6)
GET search_advisory 1,000 (0) 1,000 (0) 1,000 (0) 1,000 (0) 2,000 (+1,000) 2,000 (+1,000) 2,000 (+382) 2,000 (+382)
GET search_exact_purl 6 (0) 7 (0) 8 (0) 9 (-2) 13 (-35) 50 (-4) 58 (-8) 60 (-10)
GET search_purls 2,000 (0) 3,000 (+1,000) 6,000 (+4,000) 7,000 (+4,000) 10,000 (+3,000) 10,000 (0) 13,000 (-1,000) 14,000 (-1,000)
Aggregated 320 (+10) 700 (+200) 2,000 (+1,000) 2,000 (0) 3,000 (+1,000) 3,000 (0) 9,000 (+5,000) 14,000 (-1,000)

Status Code Metrics

Method Name Status Codes
GET get_advisory_by_doc_id 79 [200]
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 80 [200]
GET list_advisory 81 [200]
GET list_advisory_paginated 80 [200]
GET list_importer 78 [200]
GET list_organizations 80 [200]
GET list_packages 78 [200]
GET list_packages_paginated 78 [200]
GET list_products 80 [200]
GET list_sboms 80 [200]
GET list_sboms_paginated 80 [200]
GET list_vulnerabilities 78 [200]
GET list_vulnerabilities_paginated 78 [200]
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 80 [200]
GET search_advisory 79 [200]
GET search_exact_purl 80 [200]
GET search_purls 80 [200]
Aggregated 1,349 [200]

Transaction Metrics

Transaction # Times Run # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
WebsiteUser
0.0 logon 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.1 website_index 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.2 website_openapi 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.3 website_sboms 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.4 website_packages 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.5 website_advisories 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.6 website_importers 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser
1.0 logon 80 (-23) 0 (0) 13.99 (-0.20) 7 (0) 25 (-1) 0.27 (-0.08) 0.00 (+0.00)
1.1 list_organizations 80 (-23) 0 (0) 19.64 (+4.94) 2 (+1) 61 (+6) 0.27 (-0.08) 0.00 (+0.00)
1.2 list_advisory 81 (-23) 0 (0) 2663.21 (-71.37) 1805 (+101) 3514 (+7) 0.27 (-0.08) 0.00 (+0.00)
1.3 list_advisory_paginated 80 (-25) 0 (0) 2644.85 (+99.90) 1584 (+230) 3669 (-8) 0.27 (-0.08) 0.00 (+0.00)
1.4 get_advisory_by_doc_id 79 (-26) 0 (0) 18.35 (+6.73) 4 (+1) 73 (+8) 0.26 (-0.09) 0.00 (+0.00)
1.5 search_advisory 79 (-27) 0 (0) 1271.47 (+104.05) 278 (-130) 2090 (+472) 0.26 (-0.09) 0.00 (+0.00)
1.6 list_vulnerabilities 78 (-28) 0 (0) 278.47 (+23.64) 41 (-33) 610 (+70) 0.26 (-0.09) 0.00 (+0.00)
1.7 list_vulnerabilities_paginated 78 (-28) 0 (0) 203.64 (+7.07) 31 (-2) 352 (-28) 0.26 (-0.09) 0.00 (+0.00)
1.8 list_importer 78 (-28) 0 (0) 7.76 (+3.85) 1 (0) 64 (+13) 0.26 (-0.09) 0.00 (+0.00)
1.9 list_packages 78 (-28) 0 (0) 363.58 (+17.07) 71 (+1) 681 (-91) 0.26 (-0.09) 0.00 (+0.00)
1.10 list_packages_paginated 78 (-28) 0 (0) 337.05 (-0.38) 90 (-21) 487 (-283) 0.26 (-0.09) 0.00 (+0.00)
1.11 search_purls 80 (-28) 0 (0) 4526.15 (+1233.57) 1729 (+600) 14485 (-923) 0.27 (-0.09) 0.00 (+0.00)
1.12 search_exact_purl 80 (-25) 0 (0) 10.80 (-2.30) 3 (+1) 60 (-10) 0.27 (-0.08) 0.00 (+0.00)
1.13 list_products 80 (-25) 0 (0) 13.16 (+2.51) 3 (0) 63 (+4) 0.27 (-0.08) 0.00 (+0.00)
1.14 list_sboms 80 (-25) 0 (0) 2957.84 (+1671.18) 2169 (+1479) 3638 (+1731) 0.27 (-0.08) 0.00 (+0.00)
1.15 list_sboms_paginated 80 (-24) 0 (0) 2260.27 (+1356.97) 1675 (+1293) 2866 (+786) 0.27 (-0.08) 0.00 (+0.00)
1.16 get_sbom[sha256:f293eb89…6720f692ec5f3081] 80 (-24) 0 (0) 1222.39 (+136.28) 433 (+7) 2679 (+172) 0.27 (-0.08) 0.00 (+0.00)
1.17 sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 80 (-23) 0 (0) 67.45 (-9.62) 12 (-3) 205 (+6) 0.27 (-0.08) 0.00 (+0.00)
Aggregated 1429 (-461) 0 (0) 1055.41 (+258.19) 1 (0) 14485 (-923) 4.76 (-1.54) 0.00 (+0.00)

Scenario Metrics

Transaction # Users # Times Run Average (ms) Min (ms) Max (ms) Scenarios/s Iterations
WebsiteUser 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser 5 (0) 80 (-23) 18775.19 (+4536.03) 15216 (+3608) 25392 (+3087) 0.27 (-0.08) 16.00 (-4.60)
Aggregated 5 (0) 80 (-23) 18775.19 (+4536.03) 15216 (+3608) 25392 (+3087) 0.27 (-0.08) 16.00 (-4.60)

📄 Full Report (Go to "Artifacts" and download report)

@ctron
Copy link
Contributor

ctron commented Jun 5, 2025

To me it looks like a hit on the sbom search performance. We should investigate this.

@gildub
Copy link
Contributor Author

gildub commented Jun 5, 2025

@ctron, to be able to search on the version column we have to join with sbom_package, I can't see another way.

Regarding the performance hit, a view seems to be a good alternative. BTW although views aren't managed directly in migrations they can be managed using raw SQL during migrations with manager.exec_stmt().

@ctron
Copy link
Contributor

ctron commented Jun 5, 2025

@ctron, to be able to search on the version column we have to join with sbom_package, I can't see another way.

True, but those tests don't search for that information. So having that, not using it, seems to have an impact anyway.

Maybe we require a PoC of a views then. Proving that they do increase performance and seeing the complexity they add.

@gildub
Copy link
Contributor Author

gildub commented Jun 5, 2025

@ctron, shall we create a separate issue for the tests to be investigated ?

+1 regarding the views POC.

@jcrossley3
Copy link
Contributor

I don't think a view PoC is a good use of resources, so I'm -1 on that.

I question the current structure of the response. What does described_by even mean? And what user story requires that a single SBOM should have anything other than one and only one version?

I suggest we add a version: String field to our SBOM table, or if we must, a version: Vec<String> and address the issue at ingestion.

@ctron
Copy link
Contributor

ctron commented Jun 6, 2025

SPDX SBOMs can have 0..* describing packages. Each having 0..1 versions. So we'd definitely need a Vec<String>. However, the version on it's own isn't really a version of the SBOM. It's the version of the component/package describing the SBOM. Still, it might make sense to cache this information in the sbom record in order to speed things up.

I also don't believe that a view will do us any good. But following the idea of "don't guess, measure", maybe it's worth finding out and learning something from it.

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

❌ Patch coverage is 92.30769% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.29%. Comparing base (9c03149) to head (597160c).
⚠️ Report is 152 commits behind head on main.

Files with missing lines Patch % Lines
modules/fundamental/src/sbom/service/sbom.rs 66.66% 1 Missing ⚠️
...nerability/model/details/vulnerability_advisory.rs 0.00% 1 Missing ⚠️
modules/ingestor/src/graph/sbom/cyclonedx.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1700      +/-   ##
==========================================
+ Coverage   65.09%   65.29%   +0.19%     
==========================================
  Files         355      356       +1     
  Lines       14733    14721      -12     
==========================================
+ Hits         9591     9612      +21     
+ Misses       5142     5109      -33     

☔ View full report in Codecov by Sentry.
📢 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.

@gildub
Copy link
Contributor Author

gildub commented Jun 6, 2025

@ctron . @jcrossley3, the tests are all [GREEN] now.

I initially used an Inner Join instead of a Left Join, the latter preserves all the records of the left table (sbom) even when there are no matches with the right table (sbom_package).

Also I had to change the test for query_sboms_by_ingested_time because the order of the items changed due to the necessary order_by.
Altogether, a distinct_on() followed by a order_by_desc() seems to be less efficient than using group_by.
I'm working out to have a stabilized version with the latter.

@ctron
Copy link
Contributor

ctron commented Jun 6, 2025

/scale-test

@github-actions
Copy link

github-actions bot commented Jun 6, 2025

🛠️ Scale test has started! Follow the progress here: Workflow Run

@github-actions
Copy link

github-actions bot commented Jun 6, 2025

Goose Report

Goose Attack Report

Plan Overview

Action Started Stopped Elapsed Users
Increasing 25-06-06 14:01:42 25-06-06 14:01:47 00:00:05 0 → 5
Maintaining 25-06-06 14:01:47 25-06-06 14:06:48 00:05:01 5
Decreasing 25-06-06 14:06:48 25-06-06 14:06:48 00:00:00 0 ← 5

Request Metrics

Method Name # Requests # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
GET get_advisory_by_doc_id 93 (-10) 0 15.00 (+0.67) 4 (0) 64 (-2) 0.31 (-0.03) 0.00 (+0.00)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 93 (-10) 93 9.17 (+2.88) 1 (0) 57 (+5) 0.31 (-0.03) 0.31 (-0.03)
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 93 (-10) 93 2.28 (-3.11) 1 (0) 25 (-27) 0.31 (-0.03) 0.31 (+0.31)
GET list_advisory 95 (-10) 0 3136.79 (+186.20) 2517 (+733) 4508 (+326) 0.32 (-0.03) 0.00 (+0.00)
GET list_advisory_paginated 94 (-9) 0 3259.35 (+167.16) 2139 (+245) 4658 (+570) 0.31 (-0.03) 0.00 (+0.00)
GET list_importer 94 (-9) 0 5.60 (+1.67) 1 (0) 58 (0) 0.31 (-0.03) 0.00 (+0.00)
GET list_organizations 93 (-10) 0 16.77 (+7.63) 1 (0) 55 (+6) 0.31 (-0.03) 0.00 (+0.00)
GET list_packages 94 (-10) 0 376.84 (+8.16) 112 (+20) 694 (-165) 0.31 (-0.03) 0.00 (+0.00)
GET list_packages_paginated 94 (-10) 0 364.53 (+28.73) 110 (+3) 606 (+54) 0.31 (-0.03) 0.00 (+0.00)
GET list_products 95 (-9) 0 10.61 (+1.58) 3 (0) 64 (+2) 0.32 (-0.03) 0.00 (+0.00)
GET list_sboms 95 (-9) 0 2286.55 (+1575.79) 1929 (+1451) 3105 (+2154) 0.32 (-0.03) 0.00 (+0.00)
GET list_sboms_paginated 95 (-9) 0 2502.47 (+1891.77) 1448 (+1015) 3212 (+2345) 0.32 (-0.03) 0.00 (+0.00)
GET list_vulnerabilities 94 (-9) 0 248.83 (-13.22) 52 (-16) 395 (-140) 0.31 (-0.03) 0.00 (+0.00)
GET list_vulnerabilities_paginated 94 (-9) 0 199.53 (+3.61) 42 (+1) 322 (+2) 0.31 (-0.03) 0.00 (+0.00)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 93 (-10) 0 33.20 (-1.62) 10 (-2) 82 (+4) 0.31 (-0.03) 0.00 (+0.00)
GET search_advisory 94 (-10) 0 1946.83 (+83.18) 1000 (+373) 2490 (-12) 0.31 (-0.03) 0.00 (+0.00)
GET search_exact_purl 95 (-9) 0 10.57 (+1.60) 2 (0) 59 (-5) 0.32 (-0.03) 0.00 (+0.00)
GET search_purls 95 (-9) 0 1502.51 (-2528.20) 589 (-979) 8735 (-10766) 0.32 (-0.03) 0.00 (+0.00)
Aggregated 1693 (-171) 186 889.87 (+80.50) 1 (0) 8735 (-10766) 5.64 (-0.57) 0.62 (+0.28)

Response Time Metrics

Method Name 50%ile (ms) 60%ile (ms) 70%ile (ms) 80%ile (ms) 90%ile (ms) 95%ile (ms) 99%ile (ms) 100%ile (ms)
GET get_advisory_by_doc_id 9 (+1) 9 (+1) 11 (+1) 12 (-1) 53 (-1) 58 (+1) 62 (-1) 64 (-2)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 4 (+1) 4 (+1) 5 (+1) 6 (+1) 49 (+41) 51 (+8) 56 (+5) 57 (+5)
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 1 (-2) 2 (-1) 2 (-2) 3 (-2) 4 (-4) 4 (-8) 16 (-33) 25 (-27)
GET list_advisory 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 4,000 (+1,000) 4,000 (0) 4,000 (0) 4,508 (+508)
GET list_advisory_paginated 3,000 (0) 3,000 (0) 4,000 (+1,000) 4,000 (+1,000) 4,000 (0) 4,000 (0) 4,658 (+658) 4,658 (+658)
GET list_importer 2 (0) 3 (+1) 4 (+1) 5 (+1) 8 (+2) 21 (+13) 53 (+2) 58 (0)
GET list_organizations 6 (+2) 8 (+4) 21 (+15) 43 (+36) 47 (+7) 48 (+5) 50 (+2) 55 (+6)
GET list_packages 390 (+10) 400 (+10) 410 (0) 460 (0) 490 (+10) 500 (0) 600 (0) 694 (-165)
GET list_packages_paginated 380 (+50) 390 (+30) 400 (+10) 420 (+20) 470 (0) 500 (+20) 600 (+110) 600 (+48)
GET list_products 7 (0) 7 (0) 9 (+1) 11 (+2) 17 (+6) 47 (+25) 57 (0) 64 (+2)
GET list_sboms 2,000 (+1,300) 2,000 (+1,200) 2,000 (+1,200) 2,000 (+1,200) 3,000 (+2,100) 3,000 (+2,100) 3,000 (+2,100) 3,000 (+2,049)
GET list_sboms_paginated 2,000 (+1,400) 3,000 (+2,400) 3,000 (+2,300) 3,000 (+2,300) 3,000 (+2,200) 3,000 (+2,200) 3,000 (+2,200) 3,000 (+2,133)
GET list_vulnerabilities 240 (-10) 270 (0) 280 (0) 300 (+10) 320 (-60) 330 (-90) 380 (-120) 395 (-105)
GET list_vulnerabilities_paginated 200 (+10) 210 (+10) 210 (+10) 220 (0) 270 (+10) 270 (-10) 320 (+20) 320 (0)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 19 (-2) 23 (-2) 56 (+2) 64 (0) 69 (-1) 71 (-3) 75 (-1) 82 (+4)
GET search_advisory 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (-502)
GET search_exact_purl 5 (-1) 6 (-1) 6 (-1) 8 (0) 33 (+22) 55 (+4) 59 (+1) 59 (-5)
GET search_purls 1,000 (-2,000) 1,000 (-2,000) 1,000 (-3,000) 2,000 (-3,000) 3,000 (-5,000) 3,000 (-8,000) 6,000 (-13,000) 8,735 (-10,766)
Aggregated 210 (0) 370 (+40) 1,000 (+400) 2,000 (0) 3,000 (0) 3,000 (0) 4,000 (-1,000) 8,735 (-10,766)

Status Code Metrics

Method Name Status Codes
GET get_advisory_by_doc_id 93 [200]
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 93 [404]
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 93 [404]
GET list_advisory 95 [200]
GET list_advisory_paginated 94 [200]
GET list_importer 94 [200]
GET list_organizations 93 [200]
GET list_packages 94 [200]
GET list_packages_paginated 94 [200]
GET list_products 95 [200]
GET list_sboms 95 [200]
GET list_sboms_paginated 95 [200]
GET list_vulnerabilities 94 [200]
GET list_vulnerabilities_paginated 94 [200]
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 93 [200]
GET search_advisory 94 [200]
GET search_exact_purl 95 [200]
GET search_purls 95 [200]
Aggregated 186 [404], 1,507 [200]

Transaction Metrics

Transaction # Times Run # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
WebsiteUser
0.0 logon 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.1 website_index 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.2 website_openapi 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.3 website_sboms 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.4 website_packages 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.5 website_advisories 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.6 website_importers 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser
1.0 logon 93 (-10) 0 (0) 12.98 (-0.16) 6 (0) 21 (-7) 0.31 (-0.03) 0.00 (+0.00)
1.1 list_organizations 93 (-10) 0 (0) 16.92 (+7.63) 2 (+1) 56 (+7) 0.31 (-0.03) 0.00 (+0.00)
1.2 list_advisory 95 (-10) 0 (0) 3136.94 (+186.26) 2517 (+733) 4508 (+326) 0.32 (-0.03) 0.00 (+0.00)
1.3 list_advisory_paginated 94 (-9) 0 (0) 3259.50 (+167.21) 2139 (+245) 4658 (+570) 0.31 (-0.03) 0.00 (+0.00)
1.4 get_advisory_by_doc_id 93 (-10) 0 (0) 15.03 (+0.67) 4 (0) 64 (-2) 0.31 (-0.03) 0.00 (+0.00)
1.5 search_advisory 94 (-10) 0 (0) 1946.94 (+83.21) 1000 (+373) 2490 (-12) 0.31 (-0.03) 0.00 (+0.00)
1.6 list_vulnerabilities 94 (-9) 0 (0) 248.88 (-13.18) 52 (-16) 395 (-140) 0.31 (-0.03) 0.00 (+0.00)
1.7 list_vulnerabilities_paginated 94 (-9) 0 (0) 199.57 (+3.53) 42 (+1) 322 (+2) 0.31 (-0.03) 0.00 (+0.00)
1.8 list_importer 94 (-9) 0 (0) 5.61 (+1.66) 1 (0) 58 (0) 0.31 (-0.03) 0.00 (+0.00)
1.9 list_packages 94 (-10) 0 (0) 376.93 (+8.20) 112 (+20) 694 (-165) 0.31 (-0.03) 0.00 (+0.00)
1.10 list_packages_paginated 94 (-10) 0 (0) 364.59 (+28.71) 110 (+3) 606 (+53) 0.31 (-0.03) 0.00 (+0.00)
1.11 search_purls 95 (-9) 0 (0) 1502.55 (-2528.24) 589 (-979) 8735 (-10766) 0.32 (-0.03) 0.00 (+0.00)
1.12 search_exact_purl 95 (-9) 0 (0) 10.64 (+1.61) 2 (0) 59 (-5) 0.32 (-0.03) 0.00 (+0.00)
1.13 list_products 95 (-9) 0 (0) 10.64 (+1.59) 3 (0) 64 (+2) 0.32 (-0.03) 0.00 (+0.00)
1.14 list_sboms 95 (-9) 0 (0) 2286.58 (+1575.72) 1929 (+1451) 3105 (+2154) 0.32 (-0.03) 0.00 (+0.00)
1.15 list_sboms_paginated 95 (-9) 0 (0) 2502.53 (+1891.75) 1448 (+1015) 3212 (+2345) 0.32 (-0.03) 0.00 (+0.00)
1.16 get_sbom[sha256:f293eb89…6720f692ec5f3081] 93 (-10) 0 (0) 9.22 (+2.86) 1 (0) 57 (+5) 0.31 (-0.03) 0.00 (+0.00)
1.17 sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 93 (-10) 0 (0) 33.31 (-1.58) 10 (-2) 82 (+4) 0.31 (-0.03) 0.00 (+0.00)
1.18 get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 93 (-10) 0 (0) 2.30 (-3.12) 1 (0) 25 (-27) 0.31 (-0.03) 0.00 (+0.00)
Aggregated 1786 (-181) 0 (0) 843.53 (+76.54) 1 (0) 8735 (-10766) 5.95 (-0.60) 0.00 (+0.00)

Scenario Metrics

Transaction # Users # Times Run Average (ms) Min (ms) Max (ms) Scenarios/s Iterations
WebsiteUser 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser 5 (0) 93 (-10) 15891.67 (+1385.51) 13881 (+2202) 18472 (-7876) 0.31 (-0.03) 18.60 (-2.00)
Aggregated 5 (0) 93 (-10) 15891.67 (+1385.51) 13881 (+2202) 18472 (-7876) 0.31 (-0.03) 18.60 (-2.00)

Error Metrics

Method Name # Error
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 93 (-10) 404 Not Found: get_sbom[sha256:f293eb89…6720f692ec5f3081]
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 93 404 Not Found: get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954]

📄 Full Report (Go to "Artifacts" and download report)

@gildub
Copy link
Contributor Author

gildub commented Jun 6, 2025

@ctron. @jcrossley3, following-up some of your earlier comments.

Effectively a more efficient approach would be a dedicated search only when columns of related tables are involved.
But the search "anything" is not helping identify fields from related tables to trigger a tailored search.

For me this goes back to the discussion about removing the search "anything" feature in the GUI and offer the search/filter feature for explicit fields where we can have search capacity adapted for them.

BTW the scale test seems to be [GREEN]

@ctron
Copy link
Contributor

ctron commented Jun 10, 2025

BTW the scale test seems to be [GREEN]

I see a massive decrease in SBOM search performance.

@gildub
Copy link
Contributor Author

gildub commented Jun 10, 2025

@ctron,

I see a massive decrease in SBOM search performance.

I initially thought that would leaves us with either :

  • Dedicated search requests only to be used when filtering is required by user so we have a clear demarcation line when fetching default SBOM (or CVEs, etc).
  • Use DBMS Views

But as @jcrossley3, who's been through this, suggested in related Jira, the best way would be to add versions` column to the SBOM table and populate it during ingestion. This seems to be the best way because it's already done for other fields so this will be quickly implemented and pretty impact less and also will keep the performance unchanged.

Let me add a patch using that latter approach...

@ctron
Copy link
Contributor

ctron commented Jun 10, 2025

Let me add a patch using that latter approach...

Please ensure that there's a migration as part of the patch filling the entry for existing entries.

@gildub gildub changed the title TC-2564 : Add sbom_package to jointure to search those xtra columns TC-2564 : Add versions column to sbom to allow to search Jun 11, 2025
@gildub
Copy link
Contributor Author

gildub commented Jun 12, 2025

@jcrossley3, with latest commit the version search works only for a full text (the entire version string) but it doesn't work for a sub-string of the version (the "like" case).

@jcrossley3
Copy link
Contributor

@jcrossley3, with latest commit the version search works only for a full text (the entire version string) but it doesn't work for a sub-string of the version (the "like" case).

I'm surprised any of it works! But I'm curious how you know. Can you add a test to this PR that demonstrates what works and what doesn't so that I can replicate locally? Thanks!

@gildub
Copy link
Contributor Author

gildub commented Jun 13, 2025

/scale-test

@github-actions
Copy link

🛠️ Scale test has started! Follow the progress here: Workflow Run

@github-actions
Copy link

Goose Report

Goose Attack Report

Plan Overview

Action Started Stopped Elapsed Users
Increasing 25-06-13 17:28:55 25-06-13 17:29:00 00:00:05 0 → 5
Maintaining 25-06-13 17:29:00 25-06-13 17:34:00 00:05:00 5
Decreasing 25-06-13 17:34:00 25-06-13 17:34:01 00:00:01 0 ← 5

Request Metrics

Method Name # Requests # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
GET get_advisory_by_doc_id 125 (+22) 0 13.27 (-1.16) 4 (+1) 70 (+4) 0.42 (+0.07) 0.00 (+0.00)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 124 (+20) 124 3.23 (-4.31) 1 (0) 50 (-9) 0.41 (+0.07) 0.41 (+0.07)
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 124 (+20) 124 1.25 (-0.57) 1 (0) 13 (-2) 0.41 (+0.07) 0.41 (+0.07)
GET list_advisory 126 (+20) 0 2993.35 (+59.72) 2220 (-190) 4032 (+245) 0.42 (+0.07) 0.00 (+0.00)
GET list_advisory_paginated 126 (+20) 0 2959.25 (+27.61) 1893 (+68) 4471 (+403) 0.42 (+0.07) 0.00 (+0.00)
GET list_importer 122 (+18) 0 4.66 (-0.08) 1 (0) 55 (-3) 0.41 (+0.06) 0.00 (+0.00)
GET list_organizations 124 (+20) 0 12.56 (+2.26) 1 (0) 57 (+3) 0.41 (+0.07) 0.00 (+0.00)
GET list_packages 123 (+18) 0 360.89 (-4.16) 65 (-23) 844 (+263) 0.41 (+0.06) 0.00 (+0.00)
GET list_packages_paginated 123 (+18) 0 338.36 (-0.78) 103 (+9) 507 (+14) 0.41 (+0.06) 0.00 (+0.00)
GET list_products 124 (+20) 0 10.43 (-1.21) 2 (0) 63 (-2) 0.41 (+0.07) 0.00 (+0.00)
GET list_sboms 124 (+20) 124 3.15 (-686.92) 1 (-381) 54 (-834) 0.41 (+0.07) 0.41 (+0.41)
GET list_sboms_paginated 124 (+20) 124 3.23 (-614.75) 1 (-315) 49 (-763) 0.41 (+0.07) 0.41 (+0.41)
GET list_vulnerabilities 122 (+19) 0 255.26 (-4.22) 51 (-3) 593 (-19) 0.41 (+0.06) 0.00 (+0.00)
GET list_vulnerabilities_paginated 122 (+18) 0 200.38 (+3.14) 29 (-3) 299 (+5) 0.41 (+0.06) 0.00 (+0.00)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 124 (+20) 124 3.60 (-37.04) 1 (-10) 52 (-26) 0.41 (+0.07) 0.41 (+0.41)
GET search_advisory 125 (+22) 0 1911.61 (+120.48) 814 (+68) 2491 (-82) 0.42 (+0.07) 0.00 (+0.00)
GET search_exact_purl 124 (+20) 0 11.91 (+0.48) 3 (+1) 63 (-1) 0.41 (+0.07) 0.00 (+0.00)
GET search_purls 124 (+20) 0 2970.45 (-1215.52) 615 (-873) 11566 (-10196) 0.41 (+0.07) 0.00 (+0.00)
Aggregated 2230 (+355) 620 675.90 (-129.12) 1 (0) 11566 (-10196) 7.43 (+1.18) 2.07 (+1.37)

Response Time Metrics

Method Name 50%ile (ms) 60%ile (ms) 70%ile (ms) 80%ile (ms) 90%ile (ms) 95%ile (ms) 99%ile (ms) 100%ile (ms)
GET get_advisory_by_doc_id 7 (0) 8 (0) 10 (0) 12 (0) 52 (0) 56 (-3) 63 (-1) 70 (+4)
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 2 (-1) 2 (-1) 2 (-2) 3 (-2) 5 (-10) 9 (-41) 23 (-32) 50 (-9)
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 1 (0) 1 (0) 1 (0) 2 (0) 2 (-1) 3 (-2) 7 (-6) 13 (-2)
GET list_advisory 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 4,000 (+213) 4,000 (+213) 4,000 (+213)
GET list_advisory_paginated 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (0) 3,000 (-1,000) 4,000 (0) 4,000 (0) 4,000 (0)
GET list_importer 2 (0) 3 (+1) 3 (0) 4 (0) 6 (0) 9 (-9) 53 (+3) 55 (-3)
GET list_organizations 5 (+2) 6 (+2) 9 (+2) 29 (+19) 40 (-3) 44 (-4) 51 (-1) 57 (+3)
GET list_packages 380 (+10) 390 (0) 400 (0) 420 (+10) 470 (-10) 500 (+10) 700 (+119) 800 (+219)
GET list_packages_paginated 370 (+30) 380 (0) 400 (+10) 400 (0) 430 (-20) 470 (0) 500 (+10) 500 (+10)
GET list_products 6 (0) 7 (-1) 9 (0) 11 (0) 17 (-10) 48 (-6) 61 (+2) 63 (-2)
GET list_sboms 2 (-698) 2 (-698) 3 (-697) 3 (-797) 4 (-796) 5 (-795) 54 (-834) 54 (-834)
GET list_sboms_paginated 2 (-598) 2 (-598) 3 (-597) 3 (-697) 4 (-796) 9 (-791) 48 (-752) 49 (-751)
GET list_vulnerabilities 240 (+10) 270 (0) 290 (0) 310 (+10) 330 (-30) 390 (-10) 490 (-110) 593 (-7)
GET list_vulnerabilities_paginated 200 (0) 200 (0) 210 (-10) 230 (-10) 270 (+10) 280 (+10) 290 (0) 299 (+9)
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 2 (-25) 3 (-53) 3 (-59) 4 (-64) 6 (-65) 10 (-63) 36 (-41) 52 (-26)
GET search_advisory 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (0) 2,000 (-573)
GET search_exact_purl 5 (-1) 6 (-1) 7 (-1) 9 (-1) 51 (+2) 54 (0) 60 (0) 63 (-1)
GET search_purls 1,000 (-1,000) 2,000 (0) 3,000 (0) 6,000 (+3,000) 8,000 (-2,000) 8,000 (-7,000) 10,000 (-11,000) 11,566 (-10,196)
Aggregated 12 (-198) 200 (-150) 330 (-270) 1,000 (-1,000) 3,000 (0) 3,000 (0) 7,000 (+2,000) 11,566 (-10,196)

Status Code Metrics

Method Name Status Codes
GET get_advisory_by_doc_id 125 [200]
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 124 [500]
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 124 [404]
GET list_advisory 126 [200]
GET list_advisory_paginated 126 [200]
GET list_importer 122 [200]
GET list_organizations 124 [200]
GET list_packages 123 [200]
GET list_packages_paginated 123 [200]
GET list_products 124 [200]
GET list_sboms 124 [500]
GET list_sboms_paginated 124 [500]
GET list_vulnerabilities 122 [200]
GET list_vulnerabilities_paginated 122 [200]
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 124 [500]
GET search_advisory 125 [200]
GET search_exact_purl 124 [200]
GET search_purls 124 [200]
Aggregated 496 [500], 124 [404], 1,610 [200]

Transaction Metrics

Transaction # Times Run # Fails Average (ms) Min (ms) Max (ms) RPS Failures/s
WebsiteUser
0.0 logon 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.1 website_index 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.2 website_openapi 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.3 website_sboms 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.4 website_packages 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.5 website_advisories 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
0.6 website_importers 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser
1.0 logon 124 (+20) 0 (0) 12.98 (+0.37) 6 (-2) 23 (+2) 0.41 (+0.07) 0.00 (+0.00)
1.1 list_organizations 124 (+20) 0 (0) 12.70 (+2.21) 2 (+1) 57 (+3) 0.41 (+0.07) 0.00 (+0.00)
1.2 list_advisory 126 (+20) 0 (0) 2993.41 (+59.71) 2220 (-190) 4032 (+245) 0.42 (+0.07) 0.00 (+0.00)
1.3 list_advisory_paginated 126 (+20) 0 (0) 2959.34 (+27.64) 1893 (+68) 4471 (+403) 0.42 (+0.07) 0.00 (+0.00)
1.4 get_advisory_by_doc_id 125 (+22) 0 (0) 13.35 (-1.11) 4 (+1) 70 (+4) 0.42 (+0.07) 0.00 (+0.00)
1.5 search_advisory 125 (+22) 0 (0) 1911.63 (+120.47) 814 (+68) 2491 (-82) 0.42 (+0.07) 0.00 (+0.00)
1.6 list_vulnerabilities 122 (+19) 0 (0) 255.40 (-4.17) 51 (-3) 593 (-19) 0.41 (+0.06) 0.00 (+0.00)
1.7 list_vulnerabilities_paginated 122 (+18) 0 (0) 200.42 (+3.09) 30 (-2) 299 (+5) 0.41 (+0.06) 0.00 (+0.00)
1.8 list_importer 122 (+18) 0 (0) 4.74 (-0.03) 1 (0) 55 (-3) 0.41 (+0.06) 0.00 (+0.00)
1.9 list_packages 123 (+18) 0 (0) 360.93 (-4.24) 65 (-23) 844 (+263) 0.41 (+0.06) 0.00 (+0.00)
1.10 list_packages_paginated 123 (+18) 0 (0) 338.43 (-0.74) 103 (+9) 507 (+14) 0.41 (+0.06) 0.00 (+0.00)
1.11 search_purls 124 (+20) 0 (0) 2970.52 (-1215.45) 615 (-873) 11566 (-10196) 0.41 (+0.07) 0.00 (+0.00)
1.12 search_exact_purl 124 (+20) 0 (0) 12.02 (+0.52) 3 (+1) 63 (-1) 0.41 (+0.07) 0.00 (+0.00)
1.13 list_products 124 (+20) 0 (0) 10.51 (-1.17) 3 (+1) 63 (-2) 0.41 (+0.07) 0.00 (+0.00)
1.14 list_sboms 124 (+20) 0 (0) 3.22 (-686.88) 1 (-381) 54 (-834) 0.41 (+0.07) 0.00 (+0.00)
1.15 list_sboms_paginated 124 (+20) 0 (0) 3.27 (-614.76) 1 (-315) 49 (-764) 0.41 (+0.07) 0.00 (+0.00)
1.16 get_sbom[sha256:f293eb89…6720f692ec5f3081] 124 (+20) 0 (0) 3.29 (-4.29) 1 (0) 50 (-9) 0.41 (+0.07) 0.00 (+0.00)
1.17 sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 124 (+20) 0 (0) 3.66 (-37.06) 1 (-10) 52 (-28) 0.41 (+0.07) 0.00 (+0.00)
1.18 get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 124 (+20) 0 (0) 1.31 (-0.53) 1 (0) 13 (-2) 0.41 (+0.07) 0.00 (+0.00)
Aggregated 2354 (+375) 0 (0) 640.30 (-122.42) 1 (0) 11566 (-10196) 7.85 (+1.25) 0.00 (+0.00)

Scenario Metrics

Transaction # Users # Times Run Average (ms) Min (ms) Max (ms) Scenarios/s Iterations
WebsiteUser 0 (0) 0 (0) 0.00 (+0.00) 0 (0) 0 (0) 0.00 (+0.00) 0.00 (+0.00)
RestAPIUser 5 (0) 124 (+20) 12001.02 (-2373.01) 9175 (-2262) 17447 (-11106) 0.41 (+0.07) 24.80 (+4.00)
Aggregated 5 (0) 124 (+20) 12001.02 (-2373.01) 9175 (-2262) 17447 (-11106) 0.41 (+0.07) 24.80 (+4.00)

Error Metrics

Method Name # Error
GET get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954] 124 (+20) 404 Not Found: get_sbom_license_ids[0195baea-42e3-7…0e3-4c7874263954]
GET get_sbom[sha256:f293eb89…6720f692ec5f3081] 124 500 Internal Server Error: get_sbom[sha256:f293eb89…6720f692ec5f3081]
GET list_sboms 124 500 Internal Server Error: list_sboms
GET list_sboms_paginated 124 500 Internal Server Error: list_sboms_paginated
GET sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f] 124 500 Internal Server Error: sbom_by_package[pkg:maven/io.qu…dhat.com%2fga%2f]

📄 Full Report (Go to "Artifacts" and download report)

Copy link
Contributor

@ctron ctron left a comment

Choose a reason for hiding this comment

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

LGTM. I'd appreciate a test for covering one more case. But not a blocker.

.alias("sbom_node", "r0")
.translator(|f, op, v| match f.split_once(':') {
Some(("label", key)) => Some(format!("labels:{key}{op}{v}")),
None => match f {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be possible adding a test for this as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ctron, I've changed to avoid an unnecessary case, please let me know what you think.

/// Extract versions for a SPDX SBOM by collecting versions of describing packages
fn versions(sbom: &SPDX) -> Vec<String> {
// packages describing the SBOM
let describing = describing_packages(sbom);
Copy link
Contributor

Choose a reason for hiding this comment

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

Initially I'd prefer to have packages (or their versions) returned right away. Taking a look at the implementation of describing_packages that's however not really possible, as one source of this information only holds the string, not the full package information.

I think the compromise (searching through everything once again) it ok, but we should document this here.

Copy link
Contributor Author

@gildub gildub Jun 16, 2025

Choose a reason for hiding this comment

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

@ctron, I understand what you're saying but I'm not sure what comment you're expecting here.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're having a two step process: 1) find describing packages 2) iterate through all the packages once again and check with contains. Why is that necessary? And that "why" should be in the source code as a comment.

if !describing.contains(p.package_spdx_identifier.as_str()) {
continue;
}
if let Some(version) = &p.package_version {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's ok as it is. There's another way this should work, just that you know, and maybe you already do:

result.extend(p.package_version.clone());

Option<T> is an iterable (zero or one item), and extend can accept any iterable.

Copy link
Contributor

@mrizzi mrizzi left a comment

Choose a reason for hiding this comment

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

The DB migration isn't executed and it requires a further enhancement to really fix the issue and let the user search by version for the already ingested SBOMs.

.add_column(
ColumnDef::new(Sbom::Versions)
.array(ColumnType::Text)
.not_null(),
Copy link
Contributor

Choose a reason for hiding this comment

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

If this migration would be executed (which is not at the moment based on my above comment), it would fail because all the already ingested SBOMs won't have a value for the versions column.

As @ctron reported in his previous comment, there must be "a migration as part of the patch filling the entry for existing entries"

Copy link
Contributor Author

@gildub gildub Jun 17, 2025

Choose a reason for hiding this comment

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

@mrizzi, thanks, I missed the lib.rs reference which is why the migration wasn't working and why I kept it in the init-up.

Copy link
Contributor

Choose a reason for hiding this comment

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

@gildub sorry but this issue hasn't be addressed. The already ingested SBOMs will have no value for the versions column so Search it with "78775b9de88el4fdb43cc47b2db6ff3747b46df323e" will still return nothing after this PR will be merged and released because the SBOM expected to be in the result list won't have any value in the versions column to match the query.

There must be a filling of data for the new versions column for the existing entries in the sbom table to really solve the issue, that's what the second part of my comment above (and @ctron as well) was referring to.

@gildub
Copy link
Contributor Author

gildub commented Jun 17, 2025

@ctron, @jcrossley3 and @mrizzi, I've got all issues addressed, please revisit.

@gildub gildub requested a review from mrizzi June 17, 2025 15:17
Copy link
Contributor

@jcrossley3 jcrossley3 left a comment

Choose a reason for hiding this comment

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

Let's add one more tiny test, please.

@gildub gildub force-pushed the tc-2564 branch 2 times, most recently from 53f38d6 to 0a10f7b Compare June 17, 2025 15:49
@gildub gildub requested a review from jcrossley3 June 17, 2025 15:51
Copy link
Contributor

@mrizzi mrizzi left a comment

Choose a reason for hiding this comment

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

There's still a need for a data filling for already ingested rows into the sbom table.

.add_column(
ColumnDef::new(Sbom::Versions)
.array(ColumnType::Text)
.not_null(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@gildub sorry but this issue hasn't be addressed. The already ingested SBOMs will have no value for the versions column so Search it with "78775b9de88el4fdb43cc47b2db6ff3747b46df323e" will still return nothing after this PR will be merged and released because the SBOM expected to be in the result list won't have any value in the versions column to match the query.

There must be a filling of data for the new versions column for the existing entries in the sbom table to really solve the issue, that's what the second part of my comment above (and @ctron as well) was referring to.

@gildub
Copy link
Contributor Author

gildub commented Jun 18, 2025

@mrizzi, my understanding of the the missing part is a default value (empty array) for the versions column, right ?

@mrizzi
Copy link
Contributor

mrizzi commented Jun 18, 2025

@mrizzi, my understanding of the the missing part is a default value (empty array) for the versions column, right ?

As mentioned in the previous comment, this PR, as reported in the description, is meant to provide an SBOM in the response for the query Search it with "78775b9de88el4fdb43cc47b2db6ff3747b46df323e".
For this to happen it means the expected SBOM must have the sha256:78775b9de88el4fdb43cc47b2db6ff3747b46df323e value in the new versions column in the sbom table.
Hence that value must be provided during the migration in order to guarantee the version column is properly populated for all the entries already existing in the sbom table at the migration time.

Does this better clarify the need for a data filling during the migration?

@gildub
Copy link
Contributor Author

gildub commented Jun 18, 2025

@mrizzi, I understand the need to migrate existing data so the versions column is populated. Is there any precedent code handling similar scenarios ? Sounds like re-ingesting SBOMs.

@mrizzi
Copy link
Contributor

mrizzi commented Jun 18, 2025

@mrizzi, I understand the need to migrate existing data so the versions column is populated. Is there any precedent code handling similar scenarios ? Sounds like re-ingesting SBOMs.

Not that I'm aware of but please double check the existing migrations.
The action to be taken to add the needed values depends on where the version information can be read from.

@mrizzi
Copy link
Contributor

mrizzi commented Jul 29, 2025

@sourcery-ai summary

@mrizzi
Copy link
Contributor

mrizzi commented Jul 29, 2025

@sourcery-ai review

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jul 29, 2025

Reviewer's Guide

Introduce a dedicated ‘versions’ column in the SBOM table, populate it during ingest for SPDX, CycloneDX, and ClearlyDefined formats, extend query translators and GraphQL API to support exact and fuzzy version filtering, and validate the new functionality with integration tests.

Class diagram for updated GraphQL SbomQuery and VulnerabilityAdvisorySummary

classDiagram
    class SbomQuery {
        +sbom: SbomInformation
        +sboms: [SbomInformation]
    }
    class VulnerabilityAdvisorySummary {
        +sbom: SbomInformation
        ...
    }
    SbomQuery --> SbomInformation
    VulnerabilityAdvisorySummary --> SbomInformation
Loading

File-Level Changes

Change Details Files
Add and persist the new versions column in the SBOM schema
  • Create migration to alter sbom table with a non-null text array versions column and default to empty
  • Extend SBOM entity and ActiveModel to include versions field
  • Set versions when inserting SBOM nodes in the graph
migration/src/m0001080_sbom_add_versions.rs
entity/src/sbom.rs
modules/ingestor/src/graph/sbom/mod.rs
Extract and populate versions during SBOM ingest
  • Implement versions() extractor for SPDX packages
  • Extract component.version from CycloneDX metadata
  • Default to empty versions vector for ClearlyDefined SBOMs
modules/ingestor/src/graph/sbom/spdx.rs
modules/ingestor/src/graph/sbom/cyclonedx.rs
modules/ingestor/src/graph/sbom/clearly_defined.rs
modules/ingestor/src/service/sbom/clearly_defined.rs
Enable version-based filtering and API exposure
  • Map text-search field “version” to the versions column in the SBOM query translator
  • Expose versions in GraphQL SbomQuery and collection resolvers
  • Include SBOM.versions in vulnerability advisory SQL projections
modules/fundamental/src/sbom/service/sbom.rs
modules/graphql/src/sbom.rs
modules/fundamental/src/vulnerability/model/details/vulnerability_advisory.rs
Validate version filtering with integration tests
  • Add SBOM ingest of a CycloneDX test document
  • Add queries for exact, partial, and fuzzy version matches
  • Assert correct hit counts for multiple version search patterns
modules/fundamental/src/sbom/endpoints/test.rs

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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @gildub - 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.

@gildub
Copy link
Contributor Author

gildub commented Sep 25, 2025

@ctron, could you please provide an update or the link regarding the migration work issue ?

@ctron
Copy link
Contributor

ctron commented Sep 25, 2025

@ctron, could you please provide an update or the link regarding the migration work issue ?

Sure: #1913

It might be a good idea adding your use case the approach in this PR. Just to see it would cover this use case.

@gildub
Copy link
Contributor Author

gildub commented Sep 25, 2025

@mrizzi, a fully supported migration with re-processing of documents is going to take time if accepted.

In the meantime this PR and more importantly the bug behind is not progressing.

Until we have such re-processing feature in place then we must accept there will be a breaking version at some point.

Could we please consider that ?

@gildub gildub closed this by deleting the head repository Sep 30, 2025
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.

4 participants