fix: pre-check reads now inherit options.session; read-your-own-write…#85
Closed
nikuniku74 wants to merge 1 commit into
Closed
fix: pre-check reads now inherit options.session; read-your-own-write…#85nikuniku74 wants to merge 1 commit into
nikuniku74 wants to merge 1 commit into
Conversation
… in transaction works.
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.
Cosa c'era da fare:
Il pre-check RBAC nelle operazioni di scrittura legge il documento target senza passare la session della transazione, mentre la scrittura successiva la passa. Asimmetria → il pre-check legge fuori dalla transazione e non vede i documenti creati prima nella stessa transazione → fallisce con "Update not permitted" fuorviante.
Cosa è stato fatto:
Fix puntuale: aggiunto { session: options?.session } ai 4 read di pre-check in index.ts:
Tutti i tipi di options estendono già le opzioni mongo con session, quindi nessun cambio di firma. Aggiunto un test in findOneAndUpdate.test.ts che verifica che il findOne di pre-check riceva la session. tsc pulito, tutti i test verdi.