-
Notifications
You must be signed in to change notification settings - Fork 2k
chore(array): remove workflows and workflow stages #39898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14 files reviewed, 1 comment
stage = params.get("stage") | ||
if stage: | ||
qs = qs.filter(runs__stage=stage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: filtering by runs__stage
will match ANY run with that stage, not just the latest run
this changes the behavior from the previous code which used a subquery to filter by the stage of the latest run only
potential issues:
- tasks with old runs in a stage will still appear even if their latest run is in a different stage
- duplicate tasks if multiple runs have the same stage value (needs
.distinct()
)
suggested fix:
stage = params.get("stage") | |
if stage: | |
qs = qs.filter(runs__stage=stage) | |
stage = params.get("stage") | |
if stage: | |
from django.db.models import OuterRef, Subquery | |
latest_run = TaskRun.objects.filter(task=OuterRef("pk")).order_by("-created_at").values("stage")[:1] | |
qs = qs.annotate(latest_stage=Subquery(latest_run)).filter(latest_stage=stage) |
Prompt To Fix With AI
This is a comment left during a code review.
Path: products/tasks/backend/api.py
Line: 69:71
Comment:
**logic:** filtering by `runs__stage` will match ANY run with that stage, not just the latest run
this changes the behavior from the previous code which used a subquery to filter by the stage of the **latest run only**
potential issues:
1. tasks with old runs in a stage will still appear even if their latest run is in a different stage
2. duplicate tasks if multiple runs have the same stage value (needs `.distinct()`)
suggested fix:
```suggestion
stage = params.get("stage")
if stage:
from django.db.models import OuterRef, Subquery
latest_run = TaskRun.objects.filter(task=OuterRef("pk")).order_by("-created_at").values("stage")[:1]
qs = qs.annotate(latest_stage=Subquery(latest_run)).filter(latest_stage=stage)
```
How can I resolve this? If you propose a fix, please make it concise.
3085234
to
e589bac
Compare
Migration SQL ChangesHey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
|
🔍 Migration Risk AnalysisWe've analyzed your migrations for potential risks. Summary: 0 Safe | 1 Needs Review | 0 Blocked
|
we want to get rid of these as a concept, and just have task runs and agent types