feat: add If-Match support and fix stack ETag synchronization - #8291
Open
desperateCoder wants to merge 1 commit into
Open
feat: add If-Match support and fix stack ETag synchronization#8291desperateCoder wants to merge 1 commit into
desperateCoder wants to merge 1 commit into
Conversation
desperateCoder
requested review from
grnd-alt and
luka-nextcloud
as code owners
August 23, 2026 14:52
- Implement Optimistic Concurrency Control via If-Match header for Boards, Stacks, Cards, and Labels. - Fix ETag propagation when renaming or reordering stacks (Fixes nextcloud#2866). - Ensure automatic last_modified updates in BoardMapper and StackMapper. - Add unit and integration tests for OCC and ETag logic. Fixes nextcloud#2866 Signed-off-by: desperateCoder <a.dawtjan@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2866
Summary
Implementation of If-Match support and ETag synchronization fixes
This pull request introduces support for the HTTP
If-Matchheader to enable Optimistic Concurrency Control (OCC) and resolves several issues related to ETag propagation, specifically when updating lists (stacks).1. Support for If-Match (Optimistic Concurrency Control)
PreconditionFailedExceptionwhich returns HTTP 412 status code.ChangeHelperwith acheckIfMatchmethod. It validates the client-provided ETag against the server-side state (prioritizing cache with a database fallback).If-Match: *wildcard.PUTandDELETEendpoints for Boards, Stacks, Cards, and Labels.getandindexmethods to return the more precise ETag from the cache when available.2. ETag Synchronization Fixes (Fixes #861)
BoardMapperandStackMappernow automatically update thelast_modifiedtimestamp on everyinsertandupdateoperation.ChangeHelper->stackChanged. It now updates the stack-specific ETag and automatically triggers a parent board update viaboardChanged.StackServiceto ensure all modifying operations (update, reorder, setDoneStack) use the new ETag invalidation logic.cardChangedpropagation to avoid redundant database writes to the board while still ensuring ETag invalidation for the card, stack, and board.3. Refactoring and Consistency
TYPE_CARDfor stack operations).4. Quality Assurance
tests/unit/Db/ChangeHelperTest.phpto test theIf-Matchlogic in isolation.BoardApiControllerTest,CardApiControllerTest,StackApiControllerTest,LabelApiControllerTest) to mock the newChangeHelperdependency and verify ETag handling.tests/integration/features/api/boards.featurefor successful and failingIf-Matchrequests.DeckApiContextto support API requests that include both custom headers and a JSON body.5. Disclaimer
TODO
Checklist