You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,14 +25,16 @@ Prefer existing error, retry, backoff, logging, metrics, and failpoint helpers i
25
25
26
26
## API v2 Codec Guidelines
27
27
28
-
All API v2 commands that carry keys must have complete and consistent encode/decode handling in `internal/apicodec`. This includes keys, key ranges, lock information, region errors, and any request or response fields that carry encoded keys. When adding or modifying a key-bearing RPC, update both request and response paths, add table-driven coverage in `internal/apicodec`, and verify that encode/decode behavior is symmetric. Missing or one-sided handling can create key-format mismatches and correctness bugs, especially across TiKV and CSE paths.
28
+
All API v2 commands that carry keys must have complete and consistent encode/decode handling in `internal/apicodec`. This includes keys, key ranges, lock information, region errors, and any request or response fields that carry encoded keys. When adding or modifying a key-bearing RPC, update both request and response paths, add table-driven coverage in `internal/apicodec`, and verify that encode/decode behavior is symmetric. Missing or one-sided handling can create key-format mismatches and correctness bugs, especially across TiKV and CSE paths. When adding or modifying a `tikvrpc.Cmd*` whose request has a context field, update `tikvrpc/gen.sh`, regenerate `tikvrpc/cmds_generated.go`, and add `AttachContext` coverage.
29
29
30
30
## Testing Guidelines
31
31
32
32
Use Go's `testing` package with `testify/require`, `testify/assert`, and `testify/suite`, matching nearby tests. Name tests `TestXxx` and keep suite types in the existing lowercase style, such as `testRawkvSuite` or `testSnapshotSuite`.
33
33
34
34
Add or update package-level tests for every behavior change. Use `integration_tests/` when behavior depends on TiKV, PD, transactions, lock resolution, failpoints, or API-version behavior that mocks cannot cover. For concurrency-sensitive changes, run the race command before opening a PR.
35
35
36
+
CSE is only used behind TiDB. Transactional integration tests that run against next-gen/CSE should generate keys through a TiDB-like mem-comparable helper such as `encodeKey(...)`, not raw ad-hoc keys like `[]byte("k")`. For split/range/order-sensitive tests, update data keys, split keys, range bounds, and expected keys together.
37
+
36
38
## Commit & Pull Request Guidelines
37
39
38
40
Recent commits use concise, imperative subjects scoped by package or area, for example `apicodec: cover remaining API v2 key-bearing commands` or `txnkv: enable TiKV-side async resolve region lock for read path`. Follow that pattern and reference issues or PRs when relevant. This repository has DCO checks enabled; create commits with `git commit -s` so the commit message includes the required `Signed-off-by` trailer.
0 commit comments