Commit eef33e5
committed
fix(run-engine): createCancelledRun normalises snapshot.tags
cjson encodes empty Lua tables as `{}`, not `[]`. When the drainer pops a
buffered run that was cancelled with no tags ever set, snapshot.tags is
an empty object, and `.length === 0` evaluates to undefined → the empty
object falls through into Prisma's `runTags:` field. Prisma interprets
a plain object on a scalar-list field as a relation update operation
(`{ set: [...] }`) and rejects with `Argument 'set' is missing`. The
drainer treats this as a terminal failure and marks the buffer entry
FAILED, so the PG row never lands.
Defensive normalisation: only pass `runTags: snapshot.tags` when it's
actually an array with content; pass undefined otherwise.
Found while running the Phase F challenge suite cancel scenario.1 parent fd89156 commit eef33e5
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
515 | 523 | | |
516 | 524 | | |
517 | 525 | | |
| |||
0 commit comments