fix: include pipeline_slug in MinimalJobSerializer#1148
Conversation
The ADC worker fetches jobs with ids_only=1 and expects pipeline_slug in the response to know which pipeline to run. Without it, Pydantic validation fails and the worker skips the job. Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for antenna-ssec canceled.
|
✅ Deploy Preview for antenna-preview canceled.
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request adds pipeline_slug to the MinimalJobSerializer to enable ADC (Antenna Data Collection) workers to identify which pipeline to run when fetching jobs with the ids_only=1 parameter. The workers were experiencing Pydantic validation failures because this field was missing from the minimal response.
Changes:
- Adds
pipeline_slugfield toMinimalJobSerializer(sourced frompipeline.slug) - Updates the serializer's
Meta.fieldsto include the new field - Removes an outdated comment about adding fields when needed
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ami/jobs/serializers.py`:
- Line 161: The pipeline_slug CharField (source="pipeline.slug", read_only=True)
is being skipped when pipeline is null because DRF raises SkipField during
dotted attribute traversal; update the field to accept nulls so the key is
emitted (e.g., add allow_null=True, and optionally set default=None) on the
pipeline_slug serializers.CharField to ensure jobs with no pipeline return
"pipeline_slug": null instead of omitting the key.
Summary
MinimalJobSerializer(used forids_only=1job list responses) was returning only["id"]ids_only=1and expectpipeline_slugin the response to know which pipeline to runAdds
pipeline_slug(sourced frompipeline.slug) to the minimal response.Test plan
GET /api/v2/jobs/?ids_only=1&project_id=84returnspipeline_slugfor each jobSummary by CodeRabbit