Commit 6efb6a9
authored
fix(db): avoid unreadable run timestamp (#147)
## Summary
- stop reading `v2_agent_runs.finished_at` from the active
artifact-upload ownership query
- rely on the baseline check constraint that already makes active status
and a null terminal timestamp equivalent
- retain the narrow `FOR UPDATE OF v2_agent_runs` concurrency fence
without broadening the agent role
## Why
Production Postgres logs showed every media attempt failing with
`permission denied for table v2_agent_runs`. The agent role
intentionally has update-only access to `finished_at`; the redundant
read violated that least-privilege contract. Granting more access would
weaken the clean baseline for no additional invariant.
## Verification
- exact production-role ownership query succeeds after removing the
timestamp predicate
- the former query reproduces `permission denied for table
v2_agent_runs`
- `pnpm turbo lint`
- `pnpm turbo typecheck --filter=@cheatcode/db
--filter=@cheatcode/agent-worker`
- `pnpm turbo build --filter=@cheatcode/agent-worker`
- `pnpm db:migrate -- --dry-run`1 parent 49b57c6 commit 6efb6a9
1 file changed
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
| |||
0 commit comments