Repository navigation
feat: add If-Match support and fix stack ETag synchronization - #8291
desperateCoder wants to merge 1 commit into
Conversation
- 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>
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
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