You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "Oxidaner (via GitHub)" <gi...@apache.org> on 2026/04/03 05:25:47 UTC
[PR] fix: before hooks error handling [incubator-seata-go]
Oxidaner opened a new pull request, #1096:
URL: https://github.com/apache/incubator-seata-go/pull/1096
## What this PR does
This PR completes the concrete code-level bug fixes identified in #879.
The follow-up investigation items mentioned later in #879 are broader in scope and too large to reasonably combine into the same change, so this PR only focuses on the directly actionable bug fixes.
## What is included
- return `beforeCommit()` errors in XA/AT commit paths
- extend AT SQL AST traversal coverage
- harden `util/log` error logging
- clarify `SQLHook` error-handling behavior
- make AT executors consistently return `beforeHooks()` errors
- add targeted regression tests
## What is still left
The broader follow-up items from #879 still remain, mainly:
- Getty communication follow-up
- full future lifecycle validation
- reconnect behavior under network instability
- monitoring / alerting for abnormal session close paths
- broader stress and failure-path test coverage
These should be handled separately in follow-up work rather than bundled into this PR.
## Verification
Ran:
- `go test ./pkg/datasource/sql/exec/at ./pkg/datasource/sql/exec`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] fix: before hooks error handling [incubator-seata-go]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #1096:
URL: https://github.com/apache/incubator-seata-go/pull/1096#discussion_r3045249621
##########
pkg/datasource/sql/exec/at/at_executor_test.go:
##########
@@ -358,6 +358,91 @@ func TestATExecutor_ExecWithValue_ParserError(t *testing.T) {
assert.Nil(t, result, "result should be nil on error")
}
+func TestATExecutors_ExecContext_BeforeHookError(t *testing.T) {
+ beforeErr := fmt.Errorf("before hook error")
+
+ tests := []struct {
+ name string
+ newExecutor func(hooks []exec.SQLHook) executor
+ }{
+ {
+ name: "insert",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &insertExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "insert on update",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &insertOnUpdateExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "delete",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return deleteExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "multi delete",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &multiDeleteExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "multi",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &multiExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "multi update",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &multiUpdateExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "select for update",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &selectForUpdateExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "update",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &updateExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ {
+ name: "update join",
+ newExecutor: func(hooks []exec.SQLHook) executor {
+ return &updateJoinExecutor{baseExecutor: baseExecutor{hooks: hooks}, execContext: &types.ExecContext{}}
+ },
+ },
+ }
+
+ for _, tt := range tests {
Review Comment:
This subtest loop captures the range variable `tt` in a closure. Since the module targets Go 1.20 (go.mod), this will cause all subtests to use the last test case value, reducing coverage and potentially hiding failures. Shadow `tt` inside the loop (e.g., `tt := tt`) before calling `t.Run` to make the test correct on Go <1.22.
```suggestion
for _, tt := range tests {
tt := tt
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] fix: before hooks error handling [incubator-seata-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #1096:
URL: https://github.com/apache/incubator-seata-go/pull/1096#issuecomment-4181963348
## [Codecov](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1096?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 57.28%. Comparing base ([`e085c9b`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/e085c9b1292ef4b81c08c0fea6aae7588df53e20?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a1f77d5`](https://app.codecov.io/gh/apache/incubator-seata-go/commit/a1f77d5fffa04ec0a1e83da632e7cf0de421d119?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #1096 +/- ##
==========================================
+ Coverage 57.12% 57.28% +0.15%
==========================================
Files 266 266
Lines 17488 17497 +9
==========================================
+ Hits 9990 10023 +33
+ Misses 6677 6654 -23
+ Partials 821 820 -1
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/incubator-seata-go/pull/1096?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [PR] fix: before hooks error handling [incubator-seata-go]
Posted by "thunguo (via GitHub)" <gi...@apache.org>.
thunguo merged PR #1096:
URL: https://github.com/apache/incubator-seata-go/pull/1096
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org