[PR #2193] [MERGED] refactor(db): extract testable ResolveDatabasePath function #9824

Closed
opened 2026-04-23 09:14:03 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2193
Author: @kolaente
Created: 2/4/2026
Status: Merged
Merged: 2/8/2026
Merged by: @kolaente

Base: mainHead: fix-sqlite-absolute-path


📝 Commits (8)

  • 0b4255c refactor(db): extract testable ResolveDatabasePath function
  • 8ca3e8a refactor(db): make ResolveDatabasePath private
  • d54986e refactor(db): remove redundant comments from path tests
  • a9e630c refactor(db): remove duplicated memory check in initSqliteEngine
  • 2ea0f36 refactor(db): ensure resolveDatabasePath always returns absolute paths
  • 852075c fix(db): restore pre-existing comments removed during refactor
  • ed81523 fix(db): handle os.Executable failure in initSqliteEngine
  • 2adbc1d fix(db): restore warning log level for getUserDataDir fallback

📊 Changes

2 files changed (+292 additions, -61 deletions)

View changed files

📝 pkg/db/db.go (+59 -37)
📝 pkg/db/db_path_test.go (+233 -24)

📄 Description

Add DatabasePathConfig struct and ResolveDatabasePath function that takes all dependencies as parameters, making it easier to test path resolution logic in isolation. Should also fix the reported cases.

Resolves #2189


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2193 **Author:** [@kolaente](https://github.com/kolaente) **Created:** 2/4/2026 **Status:** ✅ Merged **Merged:** 2/8/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-sqlite-absolute-path` --- ### 📝 Commits (8) - [`0b4255c`](https://github.com/go-vikunja/vikunja/commit/0b4255c7f5e40cb4c7e82c566d25b20d2ca8fc42) refactor(db): extract testable ResolveDatabasePath function - [`8ca3e8a`](https://github.com/go-vikunja/vikunja/commit/8ca3e8aa0566f38959a158c2480ce846e30550cb) refactor(db): make ResolveDatabasePath private - [`d54986e`](https://github.com/go-vikunja/vikunja/commit/d54986e5f892039893d42f04abdbc2cebd46aaaa) refactor(db): remove redundant comments from path tests - [`a9e630c`](https://github.com/go-vikunja/vikunja/commit/a9e630c86db361fbc511c076c73ef5bc22105a98) refactor(db): remove duplicated memory check in initSqliteEngine - [`2ea0f36`](https://github.com/go-vikunja/vikunja/commit/2ea0f36cc64124bed3118ea54e9ac209a1a33b00) refactor(db): ensure resolveDatabasePath always returns absolute paths - [`852075c`](https://github.com/go-vikunja/vikunja/commit/852075c1749c8b359b9a3748cf3477cbcaca7f47) fix(db): restore pre-existing comments removed during refactor - [`ed81523`](https://github.com/go-vikunja/vikunja/commit/ed8152332eaf23ef4a434b56d7ab2c958ac2341d) fix(db): handle os.Executable failure in initSqliteEngine - [`2adbc1d`](https://github.com/go-vikunja/vikunja/commit/2adbc1d7a0c9d5ca2e6058d646ffd307dd64a1d6) fix(db): restore warning log level for getUserDataDir fallback ### 📊 Changes **2 files changed** (+292 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `pkg/db/db.go` (+59 -37) 📝 `pkg/db/db_path_test.go` (+233 -24) </details> ### 📄 Description Add DatabasePathConfig struct and ResolveDatabasePath function that takes all dependencies as parameters, making it easier to test path resolution logic in isolation. Should also fix the reported cases. Resolves #2189 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:14:03 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#9824