[AAP-86051] Document serializer persistence context for bulk bypass dedupe

Point bulk host/job launch create() and workflow bulk audit at DAB
validation_bypass_observability guidance for is_valid() + audit_bulk_*.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vidya Nambiar
2026-09-25 13:18:30 -04:00
co-authored by Cursor
parent 9295bf2243
commit b64b11c9ac
2 changed files with 7 additions and 0 deletions
+2
View File
@@ -2274,6 +2274,7 @@ class BulkHostCreateSerializer(serializers.Serializer):
return attrs
def create(self, validated_data):
# DAB: dedupe Validation rejected (child BulkHostSerializer is_valid) vs ORM bypass bulk_create.
with serializer_mediated_persistence_context():
return self._create_bulk_hosts(validated_data)
@@ -5282,6 +5283,7 @@ class BulkJobLaunchSerializer(PromptFieldCleanTextMixin, serializers.Serializer)
)
def create(self, validated_data):
# DAB: dedupe Validation rejected (is_valid) vs audit_workflow_job_nodes / bulk_create bypass logs.
with serializer_mediated_persistence_context():
return self._create_bulk_job_launch(validated_data)
@@ -61,6 +61,11 @@ def audit_workflow_job_nodes_for_bulk_create(nodes: Iterable[Model]) -> None:
columns. Node prompt values (limit, job_tags, etc.) live in ``char_prompts`` via
``NullablePromptPseudoField`` and must be read with ``getattr`` after deferred
attrs are applied on the in-memory instances.
When called from a DRF ``create()`` after ``is_valid()``, the caller must run
inside DAB ``serializer_mediated_persistence_context`` so duplicate
``Validation rejected`` / ``ORM bypass`` lines are not emitted (see DAB
``docs/lib/validation_bypass_observability.md``).
"""
materialized = list(nodes)
if not materialized: