internal/database and the blob upload step still end the process on a rollback after Ctrl-C, a failed close of query results, or a failed temp file cleanup
#345
What is wrong:#301 stops WithTx from exiting the process when a cancelled transaction was already rolled back. The same pattern remains elsewhere in internal/database: the rollback in WithReadTx (so Ctrl-C during a read can still end in a fatal exit instead of the interrupted exit), and database.Fatalf when closing query results fails, in blobs.go, chunks.go and snapshots.go. A process exit skips deferred cleanup.
Definition of done
No call in internal/database ends the process; each of these paths returns an error, and a rollback that finds the transaction already rolled back (sql.ErrTxDone) after a cancel is not an error.
The same for cleanupBlobTempFile in internal/snapshot/scanner.go, which calls log.Fatal when closing or removing a blob's temp file fails, ending the process from inside the upload step (noticed while fixing #302).
A test covers a read transaction cancelled during its body, and each changed close path where it can be caused.
Model: opus-5-5
Found while fixing https://git.eeqj.de/sneak/vaultik/issues/301.
**What is wrong:** https://git.eeqj.de/sneak/vaultik/issues/301 stops `WithTx` from exiting the process when a cancelled transaction was already rolled back. The same pattern remains elsewhere in `internal/database`: the rollback in `WithReadTx` (so Ctrl-C during a read can still end in a fatal exit instead of the interrupted exit), and `database.Fatalf` when closing query results fails, in `blobs.go`, `chunks.go` and `snapshots.go`. A process exit skips deferred cleanup.
**Definition of done**
- No call in `internal/database` ends the process; each of these paths returns an error, and a rollback that finds the transaction already rolled back (`sql.ErrTxDone`) after a cancel is not an error.
- The same for `cleanupBlobTempFile` in `internal/snapshot/scanner.go`, which calls `log.Fatal` when closing or removing a blob's temp file fails, ending the process from inside the upload step (noticed while fixing https://git.eeqj.de/sneak/vaultik/issues/302).
- A test covers a read transaction cancelled during its body, and each changed close path where it can be caused.
Model: opus-5-5
clawbot
self-assigned this 2026-10-13 07:59:35 +02:00
clawbot
changed title from internal/database still ends the process on a read-transaction rollback after Ctrl-C and on a failed close of query results to internal/database and the blob upload step still end the process on a rollback after Ctrl-C, a failed close of query results, or a failed temp file cleanup2026-10-13 10:07:01 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found while fixing #301.
What is wrong: #301 stops
WithTxfrom exiting the process when a cancelled transaction was already rolled back. The same pattern remains elsewhere ininternal/database: the rollback inWithReadTx(so Ctrl-C during a read can still end in a fatal exit instead of the interrupted exit), anddatabase.Fatalfwhen closing query results fails, inblobs.go,chunks.goandsnapshots.go. A process exit skips deferred cleanup.Definition of done
internal/databaseends the process; each of these paths returns an error, and a rollback that finds the transaction already rolled back (sql.ErrTxDone) after a cancel is not an error.cleanupBlobTempFileininternal/snapshot/scanner.go, which callslog.Fatalwhen closing or removing a blob's temp file fails, ending the process from inside the upload step (noticed while fixing #302).Model: opus-5-5
internal/database still ends the process on a read-transaction rollback after Ctrl-C and on a failed close of query resultsto internal/database and the blob upload step still end the process on a rollback after Ctrl-C, a failed close of query results, or a failed temp file cleanup