[PR #2566] [MERGED] fix: prevent HTTP 500 on task position conflicts and SQLite expression depth limit #8369

Closed
opened 2026-04-20 18:10:41 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2566
Author: @tink-bot
Created: 4/8/2026
Status: Merged
Merged: 4/9/2026
Merged by: @kolaente

Base: mainHead: fix-position-repair-error


📝 Commits (3)

  • e690e25 fix: catch ErrNeedsFullRecalculation in task creation position conflict resolution
  • 8812c17 fix: batch delete conditions in filter view cron to avoid SQLite expression depth limit
  • b747cf4 refactor: use per-view IN clause for filter task deletion instead of batching

📊 Changes

3 files changed (+90 additions, -21 deletions)

View changed files

📝 pkg/models/saved_filters.go (+27 -21)
📝 pkg/models/task_position.go (+17 -0)
📝 pkg/models/task_position_test.go (+46 -0)

📄 Description

Two independent bugs caused errors during task creation and in the filter view cron job when position data grew large enough to trigger edge cases.

  1. resolvePositionConflictsAfterInsert() now catches ErrNeedsFullRecalculation and falls back to a full position recalculation (mirroring the existing CLI repair command pattern) instead of bubbling up as HTTP 500.
  2. upsertRelatedTaskProperties() now batches builder.Or(deleteCond...) into chunks of 500 to stay under SQLite's 1000-node expression depth limit.

Fixes #2550


🔄 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/2566 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 4/8/2026 **Status:** ✅ Merged **Merged:** 4/9/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-position-repair-error` --- ### 📝 Commits (3) - [`e690e25`](https://github.com/go-vikunja/vikunja/commit/e690e25ffa1b4cbe54c310ee5c8d8bf1294aef7e) fix: catch ErrNeedsFullRecalculation in task creation position conflict resolution - [`8812c17`](https://github.com/go-vikunja/vikunja/commit/8812c1768495de14297abc06614e57e7ffc1a9b0) fix: batch delete conditions in filter view cron to avoid SQLite expression depth limit - [`b747cf4`](https://github.com/go-vikunja/vikunja/commit/b747cf4a7c2e0af5b6976b1b40858be4af9850e3) refactor: use per-view IN clause for filter task deletion instead of batching ### 📊 Changes **3 files changed** (+90 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `pkg/models/saved_filters.go` (+27 -21) 📝 `pkg/models/task_position.go` (+17 -0) 📝 `pkg/models/task_position_test.go` (+46 -0) </details> ### 📄 Description Two independent bugs caused errors during task creation and in the filter view cron job when position data grew large enough to trigger edge cases. 1. `resolvePositionConflictsAfterInsert()` now catches `ErrNeedsFullRecalculation` and falls back to a full position recalculation (mirroring the existing CLI repair command pattern) instead of bubbling up as HTTP 500. 2. `upsertRelatedTaskProperties()` now batches `builder.Or(deleteCond...)` into chunks of 500 to stay under SQLite's 1000-node expression depth limit. Fixes #2550 --- <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-20 18:10:41 -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#8369