Repository navigation
fix: Explain allowed, and Reachable and Holders listed, beside an error on a host's transaction - #164
Merged
Merged
Conversation
…or on a host's transaction
Michael McQuade (giraffesyo)
marked this pull request as ready for review
November 25, 2026 05:12
Michael McQuade (giraffesyo)
added a commit
that referenced
this pull request
Nov 25, 2026
2 tasks
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.
Summary
WithTx, or on a DB whoseBegingives a savepoint of the host's transaction, the read ran directly on the host's transaction and returned whatever it had read beside the error. With a host transaction at READ COMMITTED and a change replacing the subject's conditional grants as they were read, the reread from fix: a check denied, and Permissions and Holding left out, what every moment allowed where a conditional grant was replaced as it ran, as extending one does #160 gave up withrbac: conflict: a grant was revoked or replaced as its condition was read; try again. Explain still returnedDecision{Allowed: true}with the grant that allowed it, and Reachable returned the scopes it had reached. Holders, when its read of the holders' label values failed, returned the list before the label decided it. A host that logged the error and then readd.Allowedorreach.Scopeswould act on an answer the call had refused, though any error means no.AsOf. No caller used the partial value. The architecture notes now say that a failed read returns nothing.from, which its doc says. History returnsafter, and DeleteExpired and PruneHistory return the count from batches that had already committed, but their docs didn't say so.after, so a read goes on from where it was. DeleteExpired's and PruneHistory's docs now say that on an error they return how many the earlier batches removed. All three values are true and safe, so the behavior is unchanged.Testing
TestAReadOfOneSnapshotThatGivesUpOnTheHostsTransactionReturnsNothing(subtestsWithTxanda wrapper around the host's transaction, at READ COMMITTED): thereadingRoleshook replaces the subject's conditional grants on every read, so the reread gives up. Explain and Reachable must returnErrConflictwith the zero value.pgx.Txbranch, theWithTxsubtest fails:Explain after 6 reads = {Allowed:true Grants:[{Scope:{Type:cluster ID:c1} Binding:{... Role:cluster.admin Principal:{Kind:user ID:u} ...}}] ...}, rbac: conflict: a grant was revoked or replaced as its condition was read; try againandReachable after 6 reads = {All:false Scopes:[] Conditional:[{Type:cluster ID:c1}] ...}, rbac: conflict: ....TestHoldersWhoseReadFailsOnTheHostsTransactionReturnsNothing: apgx.Txwrapper given toWithTxfails the read of the holders' label values once their grants are read. Without the fix, it fails:Holders = [{Principal:{Kind:user ID:u} Grants:[...] Groups:[] Conditional:false MaybeDenied:false}], timeout: context already done: context canceled.ErrConflictunderWithTxat READ COMMITTED.golangci-lint: 0 issues.make tidy-check lint vulncheckandgo test -race -shuffle=on -cover ./...) withGODEBUG=fips140=onlyagainst PostgreSQL 18, on f96ff5e: passed (2850.175s, coverage: 95.0% of statements).Checklist
make checkpasses🤖 Generated with pw code