Fix an issue with missing ancestor entries#2118
Closed
ctron wants to merge 8 commits intoguacsec:mainfrom
Closed
Conversation
Contributor
Reviewer's GuideThis PR streamlines endpoint tests with a unified request builder, refactors core SBOM collection and resolution routines to return Results (with improved error propagation, logging, and helper extraction), updates service loading to handle external SBOMs declaratively, and adds a deep subset test alongside minor ingestion tweaks. Sequence diagram for improved SBOM external resolution and graph loadingsequenceDiagram
participant Service as AnalysisService
participant Loader as InnerService
participant DB as Database
participant Collector
Service->>Loader: load_graphs_inner(connection, sbom_ids, seen)
loop for each sbom_id
Loader->>DB: Query SBOM by ID
DB-->>Loader: SBOM data
Loader->>DB: Query external nodes for SBOM
DB-->>Loader: External node list
loop for each external node
Loader->>DB: resolve_external_sbom(node_id, connection)
DB-->>Loader: Option<ResolvedSbom>
alt ResolvedSbom found
Loader->>Loader: Recursively load_graphs_inner for resolved SBOM
else Not found
Loader->>Loader: Log warning, skip
end
end
end
Loader-->>Service: Vec<(String, Arc<PackageGraph>)>
Class diagram for refactored Collector and related helper methodsclassDiagram
class Collector {
+collect() Result<Option<Vec<Node>>, Error>
+collect_graph() Result<Vec<Node>, Error>
-collect_external(external_node: &ExternalNode) Result<Option<Vec<Node>>, Error>
-collect_package(current_node: &PackageNode) Result<Option<Vec<Node>>, Error>
}
class Node
class Error
class ExternalNode
class PackageNode
Collector --> Node
Collector --> Error
Collector --> ExternalNode
Collector --> PackageNode
Class diagram for refactored SBOM resolution helpersclassDiagram
class ResolvedSbom {
+sbom_id: Uuid
+node_id: String
}
class AnalysisService {
+load_graphs_inner(connection, sbom_ids, seen) Result<Vec<(String, Arc<PackageGraph>)>, Error>
}
class Error
class sbom_external_node_Entity
class sbom_node_checksum_Entity
class sbom_Entity
class source_document_Entity
AnalysisService --> ResolvedSbom
AnalysisService --> Error
ResolvedSbom --> sbom_external_node_Entity
ResolvedSbom --> sbom_node_checksum_Entity
ResolvedSbom --> sbom_Entity
ResolvedSbom --> source_document_Entity
Class diagram for Graph ingestion tweak (CreateOutcome)classDiagram
class Graph {
+create_source_document(digests, connection, f) Result<CreateOutcome, Error>
}
class CreateOutcome {
+Created(id: Uuid)
}
class Error
Graph --> CreateOutcome
Graph --> Error
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
2332839 to
80db4d4
Compare
Assisted-By: Cursor
The lookup/load part does an `eq` comparison and so the in-memory filter must do the same.
80db4d4 to
64333f1
Compare
|
@ctron - Is this PR obsolete now? PR 2149 seems to be the fix for TC-3170. |
Contributor
Author
True, that was merged in via the other PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Performing a query on the analysis endpoints is omitting ancestor elements in some cases.
Ref: https://issues.redhat.com/browse/TC-3170