Repository navigation
Tasks: keep the task status in step with its assignments - #44
Conversation
Task.status was never written, so every task showed PENDING. It is now worked out from the task's assignments whenever one is assigned, started, submitted or reviewed, with the task row locked: approved once all are approved, submitted while any awaits review, rework while any was sent back, in progress once anyone started, otherwise pending. Migration task_status_backfill applies the same rule once to existing tasks.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5785cf1c5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| data: { collegeId: context.collegeId, actorId: context.userId, action: 'TASK_SUBMITTED', entityType: 'TaskAssignment', entityId: assignmentId, metadata: { taskId: existing!.taskId, content: input.content } }, | ||
| }); | ||
| }); | ||
| await this.syncTaskStatus(existing!.taskId, context.collegeId); |
There was a problem hiding this comment.
Emit the recomputed task status in workflow events
When a submission changes the aggregate status, existing.task was fetched before the update and is not refreshed here; the event below therefore emits the previous status even though syncTaskStatus has stored the new one. The same pattern affects start and review events. Listeners that use the documented TaskEventPayload.status field will receive stale state; refetch the task after synchronization before building the payload.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8f79403. syncTaskStatus now returns the status it stored, and the assign, start, submit and review events build their payload with that status instead of the task read before the change.
Assign, start, submit and review events built their payload from the task as read before the change, so they carried the old status. syncTaskStatus now returns the status it stored, and the events use it.
Follow-up to the audit's M-13. #14 fixed the stats half; this is the remaining half:
Task.statuswas never written, so every task's badge said PENDING.Summary
task_status_backfillapplies the same rule to every task with assignments, so tasks that already had approved or submitted work stop showing PENDING.Rules used
Validation
pnpm test(373 passed, 2 new),pnpm lint,pnpm typecheck,pnpm build,git diff --check,prisma migrate status.