Conversation
This branch has not been deployed
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.
What?
Propagate a failed search-index write when the search plugin shares the parent document's MongoDB transaction. Keep the existing
onSyncErrorcallback and logging, and make the reindex handler surface the same failure.Why?
Publishing a document can write its search record with the same
reqand transaction. If that search write fails, MongoDB rolls back the transaction. PreviouslysyncDocAsSearchIndexlogged and swallowed the error, so the publish call could resolve successfully even though its document never persisted. A nested write can also clearreq.transactionID, so the fix captures whether the shared transaction existed before attempting the write.How?
Before/after proof: On current
main(5448061ac5bbb3d2bd656a329f129596dc1ecdba), the unit tests resolve instead of rejecting, and the MongoDB integration test observes a successful second publish despite its rolled-back document. On this PR commit198737ab7818996a6acf146b78ae0e3ad57d31cf, the publish rejects and only the first document remains.Validation: 2 focused unit tests and 21 plugin-search integration tests passed on the pushed commit. ESLint on changed source/integration files reported 0 errors (one config default-export warning), Prettier and
git diff --checkpassed. The plugin declaration build is blocked by unbuilt workspace declarations (TS6305in Payload/UI), so no full monorepo build is claimed.Fixes #17699