Skip to content

Commit 96da6a9

Browse files
committed
chore: add comment to clarify the deduplication of PURLs in the policy engine result
Signed-off-by: Nathan Nguyen <[email protected]>
1 parent 263414b commit 96da6a9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/macaron/vsa/vsa.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,12 @@ def get_components_passing_policy(policy_result: dict) -> dict[str, int] | None:
298298
logger.info("Encountered software component failing the policy. No VSA is generated.")
299299
return None
300300

301-
# key: PURL; value: result with the highest component id
301+
# This dictionary deduplicates multiple occurrences of the same PURL in the
302+
# ``component_satisfies_policy_facts`` result, which may occur because the same PURL
303+
# may appear multiple times in the ``_component`` table of the database.
304+
# Here, we are only taking the latest result into consideration.
305+
# Each key is a PURL and each value is the the highest component id of the
306+
# corresponding PURL, taking advantage of the component id column being auto-incremented.
302307
passed_components: dict[str, int] = {}
303308

304309
for component_id_string, purl, _ in component_satisfies_policy_facts:

0 commit comments

Comments
 (0)