Skip to content

*: clean up low-risk lint issues#5049

Open
3AceShowHand wants to merge 4 commits into
pingcap:masterfrom
3AceShowHand:fix-more-lint-issue
Open

*: clean up low-risk lint issues#5049
3AceShowHand wants to merge 4 commits into
pingcap:masterfrom
3AceShowHand:fix-more-lint-issue

Conversation

@3AceShowHand
Copy link
Copy Markdown
Collaborator

@3AceShowHand 3AceShowHand commented May 14, 2026

What problem does this PR solve?

Issue Number: close #xxx

make check-static reports a batch of small lint issues. This PR intentionally keeps the scope to low-risk lint cleanup so the diff is easy to review and does not mix in broader refactors.

What is changed and how it works?

  • Normalize touched error imports to github.com/pingcap/ticdc/pkg/errors to follow the repository depguard rule.
  • Replace direct sentinel-error comparisons with errors.Is where touched by the lint cleanup, so wrapped errors are handled correctly.
  • Remove unnecessary conversions reported by unconvert, including redundant timestamp, byte slice, and integer conversions.
  • Remove unused assignments and return values in tests while keeping values that are still asserted.
  • Add a missing error assertion in a redo codec test and remove a no-op zap field construction.

Review notes:

  • This PR is intended to be behavior-preserving lint cleanup.
  • The only intentional semantic broadening is errors.Is matching wrapped sentinel errors, which matches Go error-handling expectations.
  • No generated files, protocol formats, config names, storage formats, or user-facing behavior are changed.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
    • go test --tags=intest $(git diff upstream/master --name-only -- '*.go' | xargs -n1 dirname | sort -u | grep -v '^tests/integration_tests/' | sed 's#^#./#')
    • tools/bin/golangci-lint run --new-from-rev upstream/master --timeout 10m0s
    • tools/bin/golangci-lint run --enable-only unconvert --max-issues-per-linter 0 --max-same-issues 0 --timeout 10m0s
    • git diff --check

Note: full make check-static still reports existing full-repo baseline lint issues, so --new-from-rev upstream/master is used to validate that this PR does not add new lint issues.

Questions

Will it cause performance regression or break compatibility?

No. The changes are lint cleanup only. No performance or compatibility impact is expected.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

None

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 14, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lidezhu for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

This PR systematically replaces the external PingCAP error package (github.com/pingcap/errors) with TiCDC's internal error package (github.com/pingcap/ticdc/pkg/errors) across 18 files. Import statements are updated, and all error construction, RFC code extraction, retryability checks, and error constant references are switched to the internal package.

Changes

Error Package Standardization

Layer / File(s) Summary
Changefeed coordinator error handling
coordinator/changefeed/backoff.go, coordinator/changefeed/etcd_backend.go
ShouldFailChangefeed fast-fail checks and etcd transaction failures in CreateChangefeed, UpdateChangefeed, PauseChangefeed, DeleteChangefeed, ResumeChangefeed, and SetChangefeedProgress now use errors.ErrMetaOpFailed and related TiCDC error helpers.
Log service and migration error handling
logservice/logpuller/priority_queue.go, logservice/logpuller/region_request_worker_test.go, pkg/migrate/migrate.go
Error construction in log puller and all error wrapping in migration flows (getMetaVersion, etcd campaign/read/write, marshal/unmarshal, and GC safepoint updates) switched to errors.WrapError(errors.ErrEtcdMigrateFailed, err) from the TiCDC package.
Etcd client retryability and health checks
pkg/etcd/client.go
Retry predicate in isRetryableError now uses errors.IsRetryableError and errors.IsRetryableEtcdError; permission-denied handling in IsHealthy switched from PingCAP error matcher to direct errors.Is comparison.
Orchestrator reactor state error handling
pkg/orchestrator/reactor_state.go, pkg/orchestrator/reactor_state_tester.go
Unmarshal, lease-expiration, changefeed-status, and patch-skipping errors updated to use errors.ErrUnmarshalFailed, errors.ErrLeaseExpired, errors.ErrEtcdTryAgain, errors.ErrEtcdIgnore; tester error comparisons switched to TiCDC constants.
API HTTP error handling
pkg/api/util.go
RFC code extraction via errors.RFCCode and bad-request error list populated from errors.Err* constants instead of aliased names.
Test updates and minor refactorings
maintainer/maintainer_controller_test.go, pkg/common/event/dml_event_test.go, pkg/redo/writer/blackhole/writer.go, pkg/sink/kafka/mock_factory.go, pkg/sink/mysql/mysql_writer_ddl_index_rewrite_test.go, pkg/sink/mysql/mysql_writer_dml_test.go, pkg/txnutil/gc/gc_manager_test.go, pkg/util/external_storage_test.go, pkg/util/test_helper_test.go
Test files updated to use errors.RFCCode() for RFC assertions; unused return values from generateBatchSQL* and assertRestoreAnonymousIndexToNamedIndex discarded in DML and DDL tests; mock Kafka Heartbeat() methods simplified to empty no-ops; import reordering for consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • pingcap/ticdc#3909: DML rowTypes metric propagation work; the main PR updates test expectations around the extra rowTypes return value handling.
  • pingcap/ticdc#5037: Concurrent etcd client permission-denied error classification refactoring that also touches pkg/etcd/client.go IsHealthy logic.

Suggested labels

refactoring, error-handling, internal-cleanup, size/XXL

Suggested reviewers

  • asddongmen
  • wk989898
  • lidezhu

🐰 Hop, hop, hooray! The errors now all speak TiCDC native,
No more PingCAP imports—our code's much more native!
From migrations to APIs, each package aligned,
One error handler family, perfectly unified. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title '*: clean up low-risk lint issues' is vague and generic, using non-descriptive terms that don't clearly convey the specific changes made to the codebase. Replace the generic title with a more specific summary of the main changes, such as 'Normalize error imports and clean up lint issues in multiple packages' or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description contains mostly complete and well-structured information that aligns with the repository template, including issue reference, detailed explanation of changes, test methodology, and answers to required questions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 14, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors error handling by replacing external and standard library error imports with a local package, alongside minor cleanups like removing unused variables and simplifying mock functions. The reviewer identified several critical issues where the local error package lacks required functions (e.g., New, Trace, Cause, Is) or shadows standard library imports, which will cause compilation errors across multiple files.

Comment thread coordinator/changefeed/backoff.go
Comment thread coordinator/changefeed/etcd_backend.go
Comment thread logservice/logpuller/region_request_worker_test.go
Comment thread pkg/api/util.go
Comment thread pkg/etcd/client.go
Comment thread pkg/migrate/migrate.go
Comment thread pkg/orchestrator/reactor_state.go
Comment thread pkg/orchestrator/reactor_state_tester.go
Comment thread pkg/util/external_storage_test.go
Comment thread pkg/util/test_helper_test.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pkg/sink/mysql/mysql_writer_ddl_index_rewrite_test.go (1)

473-480: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restore assignment to sourceTableInfo in this call.

Discarding this return value leaves sourceTableInfo nil, which makes the later require.NotNil(t, sourceTableInfo) fail deterministically.

Proposed fix
-	_ = assertRestoreAnonymousIndexToNamedIndex(
+	sourceTableInfo = assertRestoreAnonymousIndexToNamedIndex(
 		t,
 		helper,
 		"alter table t_anon_idx add column e int, add index (a)",
 		"ALTER TABLE `t_anon_idx` ADD COLUMN `e` INT, ADD INDEX (`a`)",
 		true,
 		timodel.ActionMultiSchemaChange,
 	)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/sink/mysql/mysql_writer_ddl_index_rewrite_test.go` around lines 473 -
480, The test call to assertRestoreAnonymousIndexToNamedIndex currently discards
its return so sourceTableInfo remains nil; change the invocation to capture and
assign its return to sourceTableInfo (e.g., sourceTableInfo :=
assertRestoreAnonymousIndexToNamedIndex(...)) so that the subsequent
require.NotNil(t, sourceTableInfo) has a valid value; update the call site where
assertRestoreAnonymousIndexToNamedIndex is invoked in
mysql_writer_ddl_index_rewrite_test.go to store its returned table info.
pkg/etcd/client.go (1)

607-615: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Call Cause() before checking with errors.Is() to unwrap the error properly.

client.Get() returns gRPC status errors that require unwrapping with Cause() before errors.Is() can reliably match against v3rpc.ErrPermissionDenied. The rest of the codebase follows this pattern correctly—see IsRetryableEtcdError() in pkg/errors/utils.go, which explicitly unwraps with Cause(err) before checking errors.Is(etcdErr, v3rpc.*). Without unwrapping, permission-denied responses may not match and the health check could incorrectly report unhealthy status.

Change line 614 to:

etcdErr := errors.Cause(err)
return err == nil || errors.Is(etcdErr, v3rpc.ErrPermissionDenied)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/etcd/client.go` around lines 607 - 615, IsHealthy currently compares the
raw error from client.Get against v3rpc.ErrPermissionDenied which fails for gRPC
status-wrapped errors; unwrap the returned error using errors.Cause before
calling errors.Is. In function IsHealthy, capture the result of
errors.Cause(err) (e.g., etcdErr := errors.Cause(err)) and use
errors.Is(etcdErr, v3rpc.ErrPermissionDenied) while still returning true when
err == nil, so permission-denied responses are recognized correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@coordinator/changefeed/backoff.go`:
- Line 184: The error string is built in the return statement in backoff.go
using e.Message + e.Code which yields reversed and unseparated values; update
the construction inside the call to errors.ShouldFailChangefeed to use the error
code first and a separator before the message (i.e., build the string as e.Code
+ ": " + e.Message) so the resulting error reads like "ErrXYZ: description"
instead of concatenated words.

In `@pkg/sink/mysql/mysql_writer_dml_test.go`:
- Around line 364-367: The test is asserting len(rowTypes) after calling
writer.generateBatchSQLInUnSafeMode but discards the returned rowTypes, causing
stale-data checks; update each unsafe-mode call to capture all three return
values (e.g. sql, args, rowTypes := writer.generateBatchSQLInUnSafeMode(...))
and then assert len(rowTypes) immediately for that invocation (apply the same
change to the other occurrences around lines indicated — the calls at 364-367,
415-418, and 457-460) so each test uses the fresh rowTypes returned by
generateBatchSQLInUnSafeMode.
- Around line 655-658: The test calls writer.generateBatchSQLInSafeMode but
ignores its returned rowTypes then asserts len(rowTypes) against stale data;
update the call to rebind rowTypes (e.g., sql, args, rowTypes, _ =
writer.generateBatchSQLInSafeMode(...)) so the variable rowTypes reflects the
invocation, then keep the require.Equal(t, 2, len(rowTypes)) assertion; locate
the call to generateBatchSQLInSafeMode and adjust the multiple-assignment to
include rowTypes.

---

Outside diff comments:
In `@pkg/etcd/client.go`:
- Around line 607-615: IsHealthy currently compares the raw error from
client.Get against v3rpc.ErrPermissionDenied which fails for gRPC status-wrapped
errors; unwrap the returned error using errors.Cause before calling errors.Is.
In function IsHealthy, capture the result of errors.Cause(err) (e.g., etcdErr :=
errors.Cause(err)) and use errors.Is(etcdErr, v3rpc.ErrPermissionDenied) while
still returning true when err == nil, so permission-denied responses are
recognized correctly.

In `@pkg/sink/mysql/mysql_writer_ddl_index_rewrite_test.go`:
- Around line 473-480: The test call to assertRestoreAnonymousIndexToNamedIndex
currently discards its return so sourceTableInfo remains nil; change the
invocation to capture and assign its return to sourceTableInfo (e.g.,
sourceTableInfo := assertRestoreAnonymousIndexToNamedIndex(...)) so that the
subsequent require.NotNil(t, sourceTableInfo) has a valid value; update the call
site where assertRestoreAnonymousIndexToNamedIndex is invoked in
mysql_writer_ddl_index_rewrite_test.go to store its returned table info.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d7458179-064b-4cbf-bd03-ee2c8564a29c

📥 Commits

Reviewing files that changed from the base of the PR and between 3714915 and ca269c2.

📒 Files selected for processing (18)
  • coordinator/changefeed/backoff.go
  • coordinator/changefeed/etcd_backend.go
  • logservice/logpuller/priority_queue.go
  • logservice/logpuller/region_request_worker_test.go
  • maintainer/maintainer_controller_test.go
  • pkg/api/util.go
  • pkg/common/event/dml_event_test.go
  • pkg/etcd/client.go
  • pkg/migrate/migrate.go
  • pkg/orchestrator/reactor_state.go
  • pkg/orchestrator/reactor_state_tester.go
  • pkg/redo/writer/blackhole/writer.go
  • pkg/sink/kafka/mock_factory.go
  • pkg/sink/mysql/mysql_writer_ddl_index_rewrite_test.go
  • pkg/sink/mysql/mysql_writer_dml_test.go
  • pkg/txnutil/gc/gc_manager_test.go
  • pkg/util/external_storage_test.go
  • pkg/util/test_helper_test.go

// ShouldFailChangefeed return true if a running error contains a changefeed not retry error.
func ShouldFailChangefeed(e *heartbeatpb.RunningError) bool {
return cerrors.ShouldFailChangefeed(errors.New(e.Message + e.Code))
return errors.ShouldFailChangefeed(errors.New(e.Message + e.Code))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for RunningError construction sites to verify Message/Code format.

# Find where RunningError structs are created
rg -nP --type=go -C3 'RunningError\s*\{' -g '!vendor/'

# Find where RunningError.Message or RunningError.Code are assigned
rg -nP --type=go -C3 '\.(Message|Code)\s*=' -g '!vendor/' -g '*heartbeatpb*'

Repository: pingcap/ticdc

Length of output: 20200


🏁 Script executed:

# Read the backoff.go file around line 184 to see the full function context
cat -n coordinator/changefeed/backoff.go | sed -n '170,200p'

Repository: pingcap/ticdc

Length of output: 1186


🏁 Script executed:

# Check the RunningError struct definition in protobuf
rg -n --type=go 'type RunningError struct' -A 10

Repository: pingcap/ticdc

Length of output: 2413


🏁 Script executed:

# Look for other usages of ShouldFailChangefeed to understand expected error message format
rg -n --type=go 'ShouldFailChangefeed' -B 3 -A 3

Repository: pingcap/ticdc

Length of output: 4109


🏁 Script executed:

# Check how e.Message is populated in the backoff code
rg -n --type=go 'e\.Message' coordinator/changefeed/backoff.go -B 2 -A 2

Repository: pingcap/ticdc

Length of output: 304


🏁 Script executed:

# Check how ShouldFailChangefeed in errors package actually works
cat -n pkg/errors/helper.go | sed -n '129,160p'

Repository: pingcap/ticdc

Length of output: 1053


🏁 Script executed:

# Check how ErrorCode function extracts the code from errors
rg -n --type=go 'func ErrorCode' -A 8

Repository: pingcap/ticdc

Length of output: 563


🏁 Script executed:

# Look for RFC or error code related helper functions
rg -n --type=go 'RFCErrorCode' -B 2 -A 5

Repository: pingcap/ticdc

Length of output: 3918


🏁 Script executed:

# Check what the ShouldFailChangefeed function at line 130 in helper.go actually checks
rg -n --type=go 'strings.Contains' pkg/errors/helper.go -B 2 -A 2

Repository: pingcap/ticdc

Length of output: 446


🏁 Script executed:

# Look for test cases that show how ShouldFailChangefeed is expected to work
cat -n pkg/errors/error_test.go | sed -n '23,100p'

Repository: pingcap/ticdc

Length of output: 3023


🏁 Script executed:

# Check the changefeedUnRetryableErrors list to understand what it contains
rg -n --type=go 'changefeedUnRetryableErrors' pkg/errors/helper.go -B 5 -A 5

Repository: pingcap/ticdc

Length of output: 1177


🏁 Script executed:

# Check if there are any other examples of how Message and Code are used together
rg -n --type=go 'Message.*Code' coordinator/changefeed/ -A 2 -B 2

Repository: pingcap/ticdc

Length of output: 474


🏁 Script executed:

# Look at how the error is supposed to be formatted by checking the comment or intent
rg -n --type=go 'RunningError' coordinator/changefeed/backoff.go -B 5 -A 5

Repository: pingcap/ticdc

Length of output: 1780


🏁 Script executed:

# Check if there's any documentation about how the Code field is structured
rg -n --type=go 'RFC.*Code\|error.*code' pkg/errors/helper.go | head -20

Repository: pingcap/ticdc

Length of output: 39


🏁 Script executed:

# Look at actual test cases to see what format is expected for e.Code and e.Message
cat -n coordinator/changefeed/backoff_test.go | sed -n '35,70p'

Repository: pingcap/ticdc

Length of output: 1308


🏁 Script executed:

# Check if there are any examples showing both Code and Message populated together
rg -n --type=go 'Code:.*Message:' coordinator/changefeed/ -B 1 -A 1

Repository: pingcap/ticdc

Length of output: 280


🏁 Script executed:

# Look for any formatter or helper that should be used for RunningError
rg -n --type=go 'func.*RunningError.*String\|func.*Format' -A 5

Repository: pingcap/ticdc

Length of output: 39


Fix error message formatting by adding separator and correcting order.

The concatenation e.Message + e.Code produces malformed error strings like "snapshot lost by goCDC:ErrSnapshotLostByGC" with no separator and reversed order. Use e.Code + ": " + e.Message to follow standard error formatting conventions (error code followed by message).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coordinator/changefeed/backoff.go` at line 184, The error string is built in
the return statement in backoff.go using e.Message + e.Code which yields
reversed and unseparated values; update the construction inside the call to
errors.ShouldFailChangefeed to use the error code first and a separator before
the message (i.e., build the string as e.Code + ": " + e.Message) so the
resulting error reads like "ErrXYZ: description" instead of concatenated words.

Comment on lines +364 to 367
sql, args, _ = writer.generateBatchSQLInUnSafeMode([]*commonEvent.DMLEvent{dmlDeleteEvent, dmlUpdateEvent})
require.Equal(t, 2, len(sql))
require.Equal(t, 2, len(args))
require.Equal(t, 2, len(rowTypes))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

rowTypes assertions are now reading stale data in unsafe-mode test cases.

These calls discard the returned rowTypes, but subsequent assertions still check len(rowTypes). Capture rowTypes for each case that asserts it.

Proposed fix pattern
-sql, args, _ = writer.generateBatchSQLInUnSafeMode(...)
+sql, args, rowTypes = writer.generateBatchSQLInUnSafeMode(...)
 require.Equal(t, 2, len(rowTypes))

Also applies to: 415-418, 457-460

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/sink/mysql/mysql_writer_dml_test.go` around lines 364 - 367, The test is
asserting len(rowTypes) after calling writer.generateBatchSQLInUnSafeMode but
discards the returned rowTypes, causing stale-data checks; update each
unsafe-mode call to capture all three return values (e.g. sql, args, rowTypes :=
writer.generateBatchSQLInUnSafeMode(...)) and then assert len(rowTypes)
immediately for that invocation (apply the same change to the other occurrences
around lines indicated — the calls at 364-367, 415-418, and 457-460) so each
test uses the fresh rowTypes returned by generateBatchSQLInUnSafeMode.

Comment on lines +655 to 658
sql, args, _ = writer.generateBatchSQLInSafeMode([]*commonEvent.DMLEvent{dmlInsertEvent, dmlDeleteEvent, dmlUpdateEvent})
require.Equal(t, 2, len(sql))
require.Equal(t, 2, len(args))
require.Equal(t, 2, len(rowTypes))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

rowTypes length check in safe-mode test also uses stale value.

This call discards rowTypes but still asserts len(rowTypes) immediately after. Rebind rowTypes from this invocation.

Proposed fix
-sql, args, _ = writer.generateBatchSQLInSafeMode([]*commonEvent.DMLEvent{dmlInsertEvent, dmlDeleteEvent, dmlUpdateEvent})
+sql, args, rowTypes = writer.generateBatchSQLInSafeMode([]*commonEvent.DMLEvent{dmlInsertEvent, dmlDeleteEvent, dmlUpdateEvent})
 require.Equal(t, 2, len(sql))
 require.Equal(t, 2, len(args))
 require.Equal(t, 2, len(rowTypes))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sql, args, _ = writer.generateBatchSQLInSafeMode([]*commonEvent.DMLEvent{dmlInsertEvent, dmlDeleteEvent, dmlUpdateEvent})
require.Equal(t, 2, len(sql))
require.Equal(t, 2, len(args))
require.Equal(t, 2, len(rowTypes))
sql, args, rowTypes = writer.generateBatchSQLInSafeMode([]*commonEvent.DMLEvent{dmlInsertEvent, dmlDeleteEvent, dmlUpdateEvent})
require.Equal(t, 2, len(sql))
require.Equal(t, 2, len(args))
require.Equal(t, 2, len(rowTypes))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/sink/mysql/mysql_writer_dml_test.go` around lines 655 - 658, The test
calls writer.generateBatchSQLInSafeMode but ignores its returned rowTypes then
asserts len(rowTypes) against stale data; update the call to rebind rowTypes
(e.g., sql, args, rowTypes, _ = writer.generateBatchSQLInSafeMode(...)) so the
variable rowTypes reflects the invocation, then keep the require.Equal(t, 2,
len(rowTypes)) assertion; locate the call to generateBatchSQLInSafeMode and
adjust the multiple-assignment to include rowTypes.

@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 14, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 14, 2026

@3AceShowHand: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-error-log-review 2588951 link true /test pull-error-log-review

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@3AceShowHand 3AceShowHand changed the title Fix more lint issue *: clean up low-risk lint issues May 14, 2026
@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label May 14, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 14, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ti-chi-bot ti-chi-bot Bot removed the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant