Repository navigation
fix(proxy): preserve the active SQL role during session migration - #33692
Conversation
|
This pull request is merged. |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: linked issue or PR description changed before publication |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: a670157a9ddace35f9955991e88b0ae0e99ea7b0
Assessment: request_changes
The role comparison appropriately extends the existing principal verifier and repeats the check before import. The new old-peer handshake conflicts with the pinned shutdown-upgrade policy, and the supplied evidence does not include a verifiable terminal result for the required two-CN role regression.
Model: gpt-6.1-terra / max
Session: 01a237df-a073-7910-ac2c-836d2d273b8a · slot 1 · generation 43
-
P2
proto/query.proto:666: Connection migration now requires a new export action and a newly numbered principal-verification acknowledgement to distinguish older Proxy and CN peers.
Impact: This adds permanent producer, consumer, and wire-contract distinctions for a mixed-version deployment that the pinned repository policy does not support. This is a policy and design finding, not an observed production failure.
Evidence: The pinned .agents/skills/mo-dev/references/upgrade-compatibility.md:3-6,94-109 specifies full-cluster shutdown upgrades and prohibits new older-peer capability or fallback mechanisms. The baseline used export action 0 and acknowledgement field 2; this change rejects action 0 in pkg/frontend/routine.go:826 and moves the acknowledgement to field 3 at proto/query.proto:786. Preserve the full role verification while reusing the existing action and acknowledgement for same-version peers; leave unrelated existing compatibility checks alone. -
P2
pkg/proxy/migration_principal_integration_test.go:124: A client changes its active role and then migrates through Proxy between authenticated CNs.
Impact: The required public-path evidence for both rejected and successful transfers, including the allowed and denied reads, cannot be verified from the supplied results. This is a validation gap, not a demonstrated product failure.
Evidence: The PR description reports exact-head race and two-CN passes, but local_validation is empty and the supplied evidence has no command or terminal output for that run; the relevant CI jobs were still in progress in the frozen snapshot. The local Go test could not compile with the installed toolchain. Make the already-reported exact-head command and terminal result accessible, or complete the focused TestRenameUserProxyMigrationPrincipal test in a supported environment.
Validation:
-
The isolation preflight, git diff --check, gofmt check, and generated protobuf descriptor check completed successfully on the assigned head. Their commands, source fingerprints, exits, and retained logs are mapped in validation-reconciliation.json.
-
The source review traced SET ROLE, the migration operation lease, source export, target preflight and final import, Proxy handoff, and the two-CN test assertions.
-
The complete discussion was assessed in discussion-assessment.json; its four entries are informational notices.
Limitations:
-
The focused Go wire test stopped before compilation because the installed Go 1.26.6 is older than the required Go 1.27.1. A bounded attempt to obtain the required toolchain timed out; neither result is a product-test failure or pass.
-
The author also reports exact-head frontend, Proxy, race, and Connector/J checks. Their terminal logs were not included in the supplied evidence, so they were not independently verified.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 586a9ae89ff47a62ca16400957b81038e436da24
Assessment: approve
The prior concerns are resolved: the change retains the existing export action and acknowledgement, and the supplied exact-head evidence covers authenticated two-CN migration. The fix extends the existing principal verifier and repeats the role check before import.
Model: gpt-6.1-terra / max
Session: 01a237df-a073-7910-ac2c-836d2d273b8a · slot 1 · generation 43
Validation:
-
The PR body supplies the exact-head command and terminal output for TestRenameUserProxyMigrationPrincipal: three passing race-detector runs through Proxy and two CNs, with backend, active-role, allowed-read, and denied-read assertions.
-
Independent bounded checks passed for diff whitespace, formatting, and the generated protobuf descriptor. The descriptor comparison found only the three intended principal fields changed from the base. Receipts and logs are mapped in validation-reconciliation.json.
-
The review traced authenticated role selection, operation leases, export, preflight, final import, failure handling, and the changed prepared-statement test oracles.
Limitations:
-
The additional package, prepared-statement, and lint runs are author-reported without detailed terminal output in the supplied evidence.
-
Relevant CI jobs were still in progress in the frozen snapshot.
|
mo-bot review · Commit: Review completed. Read the assessment. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 82ef44b94f8cd54dfd7a495529f1549c87104f7f
Assessment: approve
The change preserves the authenticated active role by extending the existing migration principal check. The earlier wire-format and two-CN validation concerns remain resolved.
Model: gpt-6.1-terra / max
Session: 01a237df-a073-7910-ac2c-836d2d273b8a · slot 1 · generation 43
Validation:
-
The PR supplies exact-head terminal output for three passing race-detector runs through Proxy and two CNs, covering matching roles, changed defaults, renamed roles, reused names, and allowed and denied reads.
-
Independent bounded checks passed for the generated protobuf descriptor, diff whitespace, formatting, and comparison with the previously reviewed PR patch. The patch is byte-for-byte identical across the rebase; the base update changes dependency files.
-
The review traced role selection, operation leases, source export, target preflight and final import, and the changed prepared-statement authorization tests. Receipts and logs are mapped in validation-reconciliation.json.
Limitations:
-
Relevant CI jobs were still in progress in the frozen snapshot.
-
Additional package and lint runs are author-reported without detailed terminal output in the supplied evidence.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 5dbde1d758062e2b0c8d57a4016a7640ef220ad2
Assessment: approve
The change preserves the active role by extending the existing migration principal check before replay and final import. The earlier handshake and public-path validation concerns are resolved; no actionable findings remain.
Model: gpt-6.1-terra / max
Session: 01a237df-a073-7910-ac2c-836d2d273b8a · slot 1 · generation 43
Validation:
-
The complete pkg/pb/query test package passed on the assigned head. An independent descriptor comparison found only the intended role fields and reserved tag; logs and receipts are recorded in validation-reconciliation.json.
-
Isolation preflight, diff whitespace and Go formatting checks passed.
-
The PR supplies three passing race-detector runs through Proxy and two CNs at 82ef44b, covering role matches, mismatches, renames and authorization. The later change in the affected migration code is a receiver rename.
Limitations:
-
The two-CN test was not repeated locally on the assigned head.
-
Relevant CI checks were pending in the supplied snapshot. Other exact-head race and lint results are author-reported without terminal logs.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #33696.
Related to #33377 (4.2-dev active-role enforcement) and #29148 (prepared-statement authorization).
What this PR does / why we need it:
Proxy opens a fresh authenticated connection on the destination CN. On main at
faafdf4fef03and on #33568 at89068bb76c96, a session that had runSET ROLEcould move under the login default role. The 4.2-dev fix in #33389 already kept the source connection when its active role differed from the target login.The source adds the active role ID and name to the existing account and user identity. The destination compares this identity at preflight and again before importing session state. A mismatch keeps the client on its source CN. Checking both role fields preserves
CURRENT_ROLE_ID()andCURRENT_ROLE()across a rename and prevents a different role from matching a reused name. Export action 0 andPrincipalVerifiedfield 2 retain their existing wire numbers.Main gives each session one active role.
SET SECONDARY ROLE ALL/NONEleaves that role unchanged. The main protocol carries the role ID in field 3 and its name in field 5. Tag 4 is reserved. The 4.2-dev role snapshot uses tag 4 for its enabled secondary-role mode. Main role semantics · 4.2-dev role selectionValidation on
5dbde1d75806Local PR SCA selected
./...because ofproto/query.proto. Bothmolintandgolangci-lintpassed with the repository configuration. All 11 targeted race tests across four packages passed, including authenticated session migration between two CNs. A separate arm64 check withGOEXPERIMENT=simdreproduced the samecheckunsafewarning indistance_func_narrow_arm64.go:40on clean main at4a3e5182a6e3and on this commit.Validation on
82ef44b94f8cThe full PR patch is identical before and after the rebase onto main at
c13851c20654(#33635). The tests below ran with the updated dependency.One authenticated client connected through Proxy to two CNs. Each of three race-detector runs checked four transfers. A different login default, a renamed role with the same ID, and a reused role name with a different ID kept the source connection. Matching role ID and name moved the same connection to the other CN. Every attempt checked the backend address, role ID, role name, one allowed table read and one denied table read. Two-CN assertions
Two-CN test command and terminal output
The checkout was clean, with the repository's CPU native libraries on Darwin/arm64. The sandbox isolates an unrelated local HAKeeper listener.
89068bb76c96(2c94a66d3aaf) passed six migration and routing tests three times each under the race detector.