Persist a PATCH to the partnerships file for the XML store - #611
Merged
uhurusurfa merged 1 commit intoSep 16, 2026
Merged
Conversation
The REST layer stores the partnerships XML after a successful add or delete but the PATCH endpoint added in the previous release runs the update command, which was not in that list. For the XML store an update therefore only changed the in memory document: it was lost on restart and silently reverted by the next partnerships refresh, with the caller having been told the update succeeded. Storing after an update is correct for both stores. The store command already recognises the database store and reports that it has nothing to do, because that store persists each change in its own transaction, so this only changes behaviour for the XML store. A failed update does not store, since the trigger requires an OK result.
JakeHuneau
force-pushed
the
fix/patch-persist-xml-store
branch
from
September 16, 2026 10:26
527db6e to
0e1df02
Compare
uhurusurfa
approved these changes
Sep 16, 2026
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.
A PATCH against the XML partnership store reports success but never writes the file, so the change is lost.
Cause
ApiResource.processRequeststores the partnerships XML after a successful change, but the trigger only lists two of the three actions:The PATCH endpoint added in 4.12.0 runs the
updatecommand, which is not in that list. For the XML store an update therefore only changes the in-memory document. The caller is told the update succeeded, then the change is lost on restart and silently reverted by the next partnerships refresh.The database store is unaffected: it persists each change in its own transaction.
Fix
Add
updateto the trigger. This is correct for both stores, becauseStorePartnershipsCommandalready recognises the database store and returns "The database partnership store persists changes immediately so there is nothing to do", so only the XML store changes behaviour. A failed update still does not store, since the trigger requires an OK result.Testing
176 tests pass, 3 new in
PatchApiTest, which exercises the XML store over real HTTP. Reverting the one line fails the first two.patchIsPersistedToThePartnershipsFileNotJustMemorypatches a partner then readspartnerships.xmlback off disk and requires the new value to be therepatchReportsThatItStoredThePartnershipsrequires the response to report the store, as it does for add and deleteaFailedPatchDoesNotRewriteThePartnershipsFilerequires a rejected update to leave the file byte identicalOne consequence worth noting:
storePartnershipwrites a numbered backup before each save, so a script that patches many partners in sequence now leaves one backup per call. That was already true for add and delete.