@@ -1325,8 +1325,7 @@ def get_license_text_via_purl(self, packages: dict[str, Package], batch_size: in
13251325 def get_diff_scan_artifacts (
13261326 self ,
13271327 head_full_scan_id : str ,
1328- new_full_scan_id : str ,
1329- include_license_details : bool = False
1328+ new_full_scan_id : str
13301329 ) -> DiffArtifacts :
13311330 """Compare two full scans via the diff-scans endpoints, polling for the result.
13321331
@@ -1341,12 +1340,14 @@ def get_diff_scan_artifacts(
13411340 and ``full-scans:list`` scopes; callers are expected to catch failures and
13421341 fall back to the legacy streaming comparison.
13431342
1343+ Note that cached diff-scan responses always embed per-package license
1344+ details (the API ignores ``omit_license_details`` when ``cached=true``),
1345+ so unlike the legacy streaming comparison there is no lean-response
1346+ option here; see the comment on ``poll_params`` below.
1347+
13441348 Args:
13451349 head_full_scan_id: The before/base full scan ID
13461350 new_full_scan_id: The after/head full scan ID
1347- include_license_details: Whether to keep embedded per-package license
1348- details in the response (see get_added_and_removed_packages for
1349- why this defaults to False)
13501351
13511352 Returns:
13521353 DiffArtifacts with the added/removed/unchanged/replaced/updated lists
@@ -1368,10 +1369,15 @@ def get_diff_scan_artifacts(
13681369 # which case the create response already carries the artifacts.
13691370 artifacts_dict = diff_scan .get ("artifacts" )
13701371
1371- poll_params = {
1372- "cached" : "true" ,
1373- "omit_license_details" : "false" if include_license_details else "true" ,
1374- }
1372+ # cached=true is the polling contract (202 while computing, 200 when
1373+ # ready). The API ignores omit_license_details when cached=true - cached
1374+ # results always embed license details - so there is no lean-response
1375+ # option on this path (unlike stream_diff with
1376+ # include_license_details=false, the CE-224 mitigation). If that extra
1377+ # payload ever gets a response truncated on a huge dependency tree,
1378+ # response.json() fails and the caller falls back to the legacy
1379+ # streaming comparison, which still requests the lean payload.
1380+ poll_params = {"cached" : "true" }
13751381 deadline = time .monotonic () + DIFF_SCAN_POLL_TIMEOUT_SECONDS
13761382 interval = DIFF_SCAN_POLL_INITIAL_INTERVAL_SECONDS
13771383 while artifacts_dict is None :
@@ -1421,8 +1427,12 @@ def get_added_and_removed_packages(
14211427 Args:
14221428 head_full_scan_id: Previous scan (maybe None if first scan)
14231429 new_full_scan_id: New scan just created
1424- include_license_details: Whether to ask the diff endpoint to embed
1425- per-package license attribution/details in the response.
1430+ include_license_details: Whether to ask the *legacy streaming* diff
1431+ endpoint to embed per-package license attribution/details in the
1432+ response. Only consulted on the fallback path: the primary
1433+ diff-scans path always receives embedded license details, since
1434+ the API ignores ``omit_license_details`` for cached reads (see
1435+ get_diff_scan_artifacts).
14261436
14271437 Defaults to ``False`` on purpose. The diff endpoint exists to
14281438 compare alerts between two scans; the license fields it can embed
@@ -1453,8 +1463,7 @@ def get_added_and_removed_packages(
14531463 try :
14541464 diff_artifacts = self .get_diff_scan_artifacts (
14551465 head_full_scan_id ,
1456- new_full_scan_id ,
1457- include_license_details = include_license_details
1466+ new_full_scan_id
14581467 )
14591468 except Exception as error :
14601469 # SDK error messages can span many lines (path + response headers); the
0 commit comments