This is an automated email from the ASF dual-hosted git repository.

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 8967bb37c38 Update AGENTS.md (#37153)
8967bb37c38 is described below

commit 8967bb37c38b213319421aaf7356ca42a82bab25
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Nov 21 00:28:20 2025 +0800

    Update AGENTS.md (#37153)
    
    * Add more test cases on SegmentBinder
    
    * Update AGENTS.md
---
 AGENTS.md | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md
index 8530c7d5445..0c2a3ba976e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -182,7 +182,7 @@ Always state which topology, registry, and engine versions 
(e.g., MySQL 5.7 vs 8
 
 ## Execution Loop
 1. **Intake & Clarify** – restate the request, map affected modules, confirm 
sandbox/network/approval constraints, and capture a constraint checklist 
(forbidden APIs, output formats, ordering rules, coverage targets). As part of 
intake, reopen `CODE_OF_CONDUCT.md` sections relevant to the task (e.g., Unit 
Testing Standards before discussing assertions) so you never rely on memory or 
AGENTS-only guidance when the code of conduct already rules on the topic.
-2. **Plan & Reason** – craft a multi-step plan (analysis, edits, tests). When 
a user asks for specific coverage/branch lists, pause coding until you have 
responded with an explicit bullet list of every path (file + line/branch) you 
will exercise, as well as the single test that will cover it; this list is a 
blocking prerequisite for any edits. Add rule-specific constraints (e.g., “no 
`assertEquals`”) to the plan and re-check them before edits. Before altering 
tests or mocks, inspect how  [...]
+2. **Plan & Reason** – craft a multi-step plan (analysis, edits, tests). When 
a user asks for specific coverage/branch lists, pause coding until you have 
responded with an explicit bullet list of every path (file + line/branch) you 
will exercise, as well as the single test that will cover it; this list is a 
blocking prerequisite for any edits. Add rule-specific constraints (e.g., “no 
`assertEquals`”) to the plan and re-check them before edits. Before altering 
tests or mocks, inspect how  [...]
 3. **Implement** – touch only the required files, reuse abstractions, preserve 
ASF headers, and document major decisions. If you must replace a file wholesale 
(e.g., rewrite a test), delete the old file first and then add the new version 
so `apply_patch` does not fight stale context.
 4. **Validate** – run the narrowest meaningful command (e.g., `./mvnw -pl 
<module> -am test`, `./mvnw -pl <module> -DskipITs -Dspotless.skip=true 
-Dtest=ClassName test`). Announce intent beforehand and summarize exit codes 
afterward; when blocked, state the command you intended to run and why it 
matters.
 5. **Report** – lead with intent, list edited files plus rationale/line refs, 
cite verification commands + results, and propose next steps.
@@ -209,7 +209,7 @@ Always state which topology, registry, and engine versions 
(e.g., MySQL 5.7 vs 8
 - **Proxy won’t start:** verify configs/mode/ports and reuse known-good 
example configs; share the log snippet and files inspected without editing 
generated artifacts.
 - **Spotless/checkstyle:** run `./mvnw spotless:apply -Pcheck [-pl <module>]` 
(or `spotless:check`) and confirm ASF headers/import ordering.
 - **Sandbox/network block:** if a command is denied, state what you ran, why 
it failed, and the approval or alternative plan required.
-- **Single-module tests:** prefer scoped commands over repo-wide runs; avoid 
`-Dtest=Pattern` from repo root unless you know the target exists, otherwise 
use the module’s suite or `-Dsurefire.failIfNoSpecifiedTests=false`. When you 
must target a single test class, pass the fully-qualified class name (e.g., 
`-Dtest=org.example.FooTest`) so Surefire can locate it deterministically.
+- **Single-module tests:** prefer scoped commands over repo-wide runs; avoid 
`-Dtest=Pattern` from repo root unless you know the target exists, otherwise 
use the module’s suite or `-Dsurefire.failIfNoSpecifiedTests=false`. When you 
must target a single test class, pass the fully-qualified class name (e.g., 
`-Dtest=org.example.FooTest`) so Surefire can locate it deterministically. To 
run multiple tests at once, join multiple FQCNs with commas (example: 
`-Dtest=a.b.FooTest,a.b.BarTest`) an [...]
 
 ## Compatibility, Performance & External Systems
 - Specify targeted engines and dialect files (MySQL 5.7/8.0, PostgreSQL 13+, 
openGauss, etc.) and guarantee backward-compatible behavior.
@@ -242,6 +242,8 @@ Always state which topology, registry, and engine versions 
(e.g., MySQL 5.7 vs 8
 - When constructors hide collaborators, use `Plugins.getMemberAccessor()` to 
inject mocks and document why SPI creation is bypassed.
 - Cache SPI loader results (`OrderedSPILoader`, `TypedSPILoader`, 
`DatabaseTypedSPILoader`, etc.) per key at the test-class level to avoid 
redundant lookups.
 - If a test already uses `@ExtendWith(AutoMockExtension.class)`, always 
declare the needed static collaborators via `@StaticMockSettings` instead of 
hand-written `mockStatic` blocks; justify any exception explicitly in the plan 
before coding.
+- When a binder under test instantiates another binder (e.g., 
`SelectStatementBinder`, `TableSegmentBinder`), prefer `mockConstruction` and 
capture the injected context rather than reimplementing the constructor logic; 
only skip this approach if the plan explains why it cannot work.
+- Manage every static binder (`ColumnSegmentBinder`, 
`ExpressionSegmentBinder`, etc.) via `@StaticMockSettings` to avoid ad-hoc 
try-with-resources `mockStatic` blocks; if multiple static dependencies are 
needed, list each one in the plan.
 
 ## Brevity & Signal
 - Prefer tables/bullets over prose walls; cite file paths (`kernel/src/...`) 
directly.

Reply via email to