Skip to content

fix: fail fast on unwritable Docker DB path#28

Merged
prakersh merged 1 commit intomainfrom
fix/docker-db-path-preflight
Mar 11, 2026
Merged

fix: fail fast on unwritable Docker DB path#28
prakersh merged 1 commit intomainfrom
fix/docker-db-path-preflight

Conversation

@prakersh
Copy link
Contributor

Summary

  • add preflightDatabasePath() before SQLite init to detect unwritable DB paths with actionable guidance instead of opaque SQLite OOM/pragma errors
  • handle both failure classes: unwritable DB directory and existing read-only/root-owned onwatch.db
  • preserve valid SQLite DSNs (file:/...?. and mode=memory) and add regression tests for URI-based paths
  • restore recursive bind-mount ownership guidance in Docker docs/comments (chown -R 65532:65532)

Follow-up to #22.

Test plan

  • go test -race ./internal/store/... -run "PreflightDatabasePath|StoreNew_SQLiteFileURI" -v
  • go test -race ./... -count=1
  • go vet ./...
  • Docker writable bind mount: container starts and opens /data/onwatch.db
  • Docker existing read-only /data/onwatch.db (0444): fails fast with database file is not writable + remediation hint
  • Docker named volume: container starts successfully

Fail fast with actionable diagnostics when the SQLite DB path is not writable,
including existing read-only database files. Preserve valid SQLite file: URIs
and memory DSNs, and update Docker bind-mount guidance to use recursive chown.

Follow-up to #22.
@prakersh prakersh merged commit 915a85d into main Mar 11, 2026
4 checks passed
@prakersh prakersh deleted the fix/docker-db-path-preflight branch March 11, 2026 13:50
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 53.70370% with 25 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/store/store.go 53.70% 16 Missing and 9 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant