Skip to content

Commit f57e775

Browse files
fix(tags): handle list input in _sync_inheritance_for_qs + recalibrate Stage 3 pins
After Stage 2's location precompute landed under Stage 3, the `locations` list passed by `propagate_tags_on_product_sync` reached `_sync_inheritance_for_qs` which tried to call `.only(...)` on it. Accept either a list or a queryset. Recalibrate V3 pins for the Stage 2 + Stage 3 compound effect: - product_tag_add (100 locations): 123 -> 75 - product_tag_remove (100 locations): 73 -> 49 - ZAP scan import: 698 -> 661 - ZAP scan reimport, no change: 136 -> 99
1 parent 15f1303 commit f57e775

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

dojo/product/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _sync_inheritance_for_qs(queryset, *, target_names_per_child):
129129
- bulk add/remove on `tags` based on the diff
130130
- bulk UPDATE of `_inherited_tag_names`
131131
"""
132-
children = list(queryset.only("pk", "_inherited_tag_names"))
132+
children = queryset if isinstance(queryset, list) else list(queryset.only("pk", "_inherited_tag_names"))
133133
if not children:
134134
return
135135

unittests/test_tag_inheritance_perf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ def test_baseline_product_tag_remove_propagates_to_100_locations_v3(self):
385385

386386
# V3 location paths. Pre-Phase-A: 4532 add, 4307 remove.
387387
# Phase B Stage 2 + location precompute: bulk-built target-name map.
388-
# Stage 3 may further drop these once JSON column replaces M2M reads.
389-
EXPECTED_PRODUCT_TAG_ADD_100_LOCATIONS = 123
390-
EXPECTED_PRODUCT_TAG_REMOVE_100_LOCATIONS = 73
388+
# Stage 3 (JSON column) collapsed inherited_tags M2M reads further.
389+
EXPECTED_PRODUCT_TAG_ADD_100_LOCATIONS = 75
390+
EXPECTED_PRODUCT_TAG_REMOVE_100_LOCATIONS = 49
391391

392392

393393
@override_settings(
@@ -509,6 +509,6 @@ def test_baseline_zap_scan_reimport_no_change_v3(self):
509509
# when there's no work. Stages 3+4+5 (drop duplicate inherited_tags M2M)
510510
# will collapse the reimport cost.
511511
EXPECTED_ZAP_IMPORT_V2 = 700
512-
EXPECTED_ZAP_IMPORT_V3 = 698
512+
EXPECTED_ZAP_IMPORT_V3 = 661
513513
EXPECTED_ZAP_REIMPORT_NO_CHANGE_V2 = 78
514-
EXPECTED_ZAP_REIMPORT_NO_CHANGE_V3 = 136
514+
EXPECTED_ZAP_REIMPORT_NO_CHANGE_V3 = 99

0 commit comments

Comments
 (0)