Repository navigation
Conversation
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
Tick the box to add this pull request to the merge queue (same as
|
Confidence Score: 1/5
[Medium impact] The changes affect project-flag scan history and results in the moderation workflow. Fix the workflow recovery and compatibility failures before merging.
|
| let status = lock_run(&mut transaction, id).await?; | ||
| if ctx.is_cancelled() || status != Some(RunStatus::Running) { | ||
| return Err(ActivityError::from(anyhow!( | ||
| "project flag run is no longer running" | ||
| ))); |
There was a problem hiding this comment.
If Postgres commits but the worker stops before Temporal records success, the next finalize attempt reads Completed and returns an error. The activity can no longer succeed even though its work finished. Return success for an already-completed run without changing its frozen summary.
Knowledge Base Used: Backend data storage
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/workflow/project_flag/run.rs
Line: 327-331
Comment:
**Finished runs fail on retry**
If Postgres commits but the worker stops before Temporal records success, the next `finalize` attempt reads `Completed` and returns an error. The activity can no longer succeed even though its work finished. Return success for an already-completed run without changing its frozen summary.
**Knowledge Base Used:** [Backend data storage](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Fbackend-data-storage.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| let _ = sqlx::query!( | ||
| r#"DELETE FROM project_flag_runs WHERE id = $1"#, | ||
| id.0 as i64 | ||
| ) | ||
| .execute(pool) | ||
| .await; |
There was a problem hiding this comment.
If Temporal accepts the workflow but the response times out or the connection drops, start still deletes the saved run. That also deletes any saved results, and the running workflow skips further writes because its run row is missing. Keep the row when the outcome is unknown, and confirm that the workflow did not start before deleting it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/workflow/project_flag/run.rs
Line: 183-188
Comment:
**Accepted scans can disappear**
If Temporal accepts the workflow but the response times out or the connection drops, `start` still deletes the saved run. That also deletes any saved results, and the running workflow skips further writes because its run row is missing. Keep the row when the outcome is unknown, and confirm that the workflow did not start before deleting it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if matches!( | ||
| &termination, | ||
| temporalio_sdk::WorkflowTermination::Failed(_) | ||
| ) { |
There was a problem hiding this comment.
If a run is canceled, terminated, or timed out through Temporal, its Postgres row can remain Running forever. This branch only saves a failure for WorkflowTermination::Failed, while describe and list now read Postgres alone. Cancellation skips the update, and termination cannot run workflow cleanup at all. Copy these final states into Postgres so stopped runs no longer appear active or add queued projects to num_scanning.
Knowledge Base Used: Backend data storage
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/workflow/project_flag/run.rs
Line: 209-212
Comment:
**Stopped scans stay active**
If a run is canceled, terminated, or timed out through Temporal, its Postgres row can remain `Running` forever. This branch only saves a failure for `WorkflowTermination::Failed`, while `describe` and `list` now read Postgres alone. Cancellation skips the update, and termination cannot run workflow cleanup at all. Copy these final states into Postgres so stopped runs no longer appear active or add queued projects to `num_scanning`.
**Knowledge Base Used:** [Backend data storage](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Fbackend-data-storage.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| base62_id!(PasskeyId); | ||
|
|
||
| base62_id!(ProjectFlagRuleId); | ||
| base62_id!(ProjectFlagRunId); |
There was a problem hiding this comment.
If any scans are queued or running during deployment, their saved RunInput and BatchInput still contain UUID strings. Changing ProjectFlagRunId to base62 makes those inputs unreadable by the new worker. The workflow name and task queue stay the same, so the worker still receives those executions but cannot resume them. Keep the old input type available until existing runs drain, or put the new workflow on a separate version.
Knowledge Base Used: Labrinth backend platform
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/models/v3/ids.rs
Line: 49
Comment:
**Existing scans cannot resume**
If any scans are queued or running during deployment, their saved `RunInput` and `BatchInput` still contain UUID strings. Changing `ProjectFlagRunId` to base62 makes those inputs unreadable by the new worker. The workflow name and task queue stay the same, so the worker still receives those executions but cannot resume them. Keep the old input type available until existing runs drain, or put the new workflow on a separate version.
**Knowledge Base Used:** [Labrinth backend platform](https://app.greptile.com/-/switch-tenant?tenant=modrinth&next=%2Fcustom-context%2Fknowledge-base%2Fmodrinth%2Fcode%2F-%2Fdocs%2Flabrinth-backend.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
No description provided.