-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: explicitly set machineConfig to null when task machine is removed #3056
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,7 +276,7 @@ async function createWorkerTask( | |
| exportName: task.exportName, | ||
| retryConfig: task.retry, | ||
| queueConfig: task.queue, | ||
| machineConfig: task.machine, | ||
| machineConfig: task.machine ?? null, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 Prisma create() should already set NULL for omitted undefined fields The PR description states that "Prisma's Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| triggerSource: task.triggerSource === "schedule" ? "SCHEDULED" : "STANDARD", | ||
| fileId: tasksToBackgroundFiles?.get(task.id) ?? null, | ||
| maxDurationInSeconds: task.maxDuration ? clampMaxDuration(task.maxDuration) : null, | ||
|
|
||
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.
🚩 Inconsistent undefined-to-null handling for sibling Json? fields
The fix applies
?? nullonly tomachineConfig, but the samecreate()call passes two otherJson?fields —retryConfig: task.retry(line 277) andqueueConfig: task.queue(line 278) — that are also optional onTaskResource(packages/core/src/v3/schemas/resources.ts:10-11) and map toJson?columns in the Prisma schema (internal-packages/database/prisma/schema.prisma:559-561). If the rationale for this fix is that Prisma'screate()silently skipsundefinedforJson?columns, the same issue would apply toretryConfigandqueueConfig. However, in practice removing retry/queue config may be far less common or impactful than removing machine config, which is likely why onlymachineConfigwas addressed. Still, for consistency and defense-in-depth, the same?? nullpattern should arguably be applied to the other two fields.Was this helpful? React with 👍 or 👎 to provide feedback.