fix(cleanup): compare live-paused statuses with IN, not ANY over a row constructor - #6004
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview All nine predicates that gated deletion/pruning on “live” paused executions used Those sites now use Adds Reviewed by Cursor Bugbot for commit f8df6e7. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryFixes Postgres binding of live-paused statuses used in cleanup/prune SQL.
Confidence Score: 5/5Safe to merge; the SQL array-binding fix matches the failure mode and all prior broken ANY() sites are covered. Shared fragment produces ARRAY[...]::text[] with one bind per status; remaining LIVE_PAUSED_REFERENCE_STATUSES use is notInArray, which expects a JS array; tests pin the render shape against the real dialect.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/execution/payloads/large-value-metadata.ts | Introduces correctly rendered text[] fragment and updates all ANY() guards that previously cast a row constructor. |
| apps/sim/background/cleanup-logs.ts | Switches four ANY() predicates to livePausedStatusArray; notInArray still uses the JS status list appropriately. |
| apps/sim/lib/execution/payloads/live-paused-status-array.test.ts | Unmocks drizzle and asserts ARRAY rendering, param count, and rejection of the broken row-constructor form. |
| apps/sim/background/cleanup-logs.test.ts | Mocks the new livePausedStatusArray export so cleanup-logs unit tests keep loading. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[LIVE_PAUSED_REFERENCE_STATUSES JS array] --> B[livePausedStatusArray sql fragment]
B --> C["ANY(ARRAY[$1,$2,$3]::text[])"]
C --> D[cleanup-logs legacy large values]
C --> E[unreferencedLargeValuePredicate]
C --> F[pruneStaleReferences]
Reviews (1): Last reviewed commit: "fix(cleanup): bind live-paused statuses ..." | Re-trigger Greptile
dfeac7b to
f8df6e7
Compare
Summary
unreferencedLargeValuePredicate()and the legacy/prune queries wrotepe.status = ANY(${LIVE_PAUSED_REFERENCE_STATUSES}::text[]). Drizzle expands a JS array to($1, $2, $3)— correct forIN, but asANY((...)::text[])Postgres rejects it outright:cannot cast type record to text[]pe.status IN ${LIVE_PAUSED_REFERENCE_STATUSES}, which uses drizzle's native expansion as intended — no cast, no helpercleanup-logsfailed on every run since. The throw landed at step 2 of 6, which also silently disabled legacy large-value cleanup, large-value metadata pruning,job_execution_logsretention, and orphaned-snapshot cleanupType of Change
Testing
live-paused-statuses-sql.test.tsrenders the realunreferencedLargeValuePredicate()against the real drizzle dialect and schema (the global drizzle/schema mocks hide rendering bugs). Verified it fails on both the originalANY()form and on astatus = IN (...)typo, and passes only on the correct formlib/execution/payloads,background/cleanup-*,lib/cleanuppass;tsc --noEmitclean;bun run lintand the full audit suite passChecklist