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

terrymanu 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 772ef4d2b1d Align agent local variable guidance with conduct (#38837)
772ef4d2b1d is described below

commit 772ef4d2b1d55b216bd7ad84c6815aff750f62c7
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Jun 10 01:11:25 2026 +0800

    Align agent local variable guidance with conduct (#38837)
    
    Update AGENTS.md to keep VariableDeclarationUsageDistance guidance while
    removing the instruction to mark retained local variables as final.
    
    This aligns AI-agent rules with CODE_OF_CONDUCT.md, which says local
    variables should not be set as final.
---
 AGENTS.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md
index 3f012932ae8..35c2c03ef4c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -33,7 +33,7 @@ This guide is written **for AI coding agents only**. Follow 
it literally; improv
       An overriding method should add Javadocs only when it documents 
implementation-specific behavior, stricter preconditions, side effects, 
exceptions, compatibility notes,
       or semantics not already covered by the parent declaration.
       When cleaning redundant override Javadocs, change comments only and 
verify no public contract information is lost.
-    - Keep variable declarations adjacent to first use; if a value must be 
retained, declare it `final` to satisfy Checkstyle 
VariableDeclarationUsageDistance.
+    - Keep variable declarations adjacent to first use to satisfy Checkstyle 
VariableDeclarationUsageDistance; do not mark local variables as `final`.
     - Single-use local variables must be inlined by default; keep a local 
variable only when it is reused (for stubbing/verification/assertions) or 
materially improves readability.
     - Do not add explicit defensive immutable collection copies in 
constructors or method return values by default.
       Avoid `List.copyOf`, `Set.copyOf`, `Map.copyOf`, 
`Collections.unmodifiableList`, `Collections.unmodifiableSet`, 
`Collections.unmodifiableMap`,
@@ -145,7 +145,7 @@ Dangerous operation detected! Operation type: [specific 
action] Scope of impact:
   If the boundary is missing or ambiguous, ask the developer to confirm it 
before making changes.
 - **Risk gate:** if any action fits the Dangerous Operation Checklist, pause 
and use the confirmation template before proceeding.
 - **Planning rules:** use Sequential Thinking with 3-10 actionable steps (no 
single-step plans) via the plan tool for non-trivial tasks; convert all hard 
requirements (SPI usage, mocking rules, coverage/test naming, forbidden APIs) 
into a checklist inside the plan and do not code until each item is addressed 
or explicitly waived.
-- **Execution discipline:** inspect existing code before edits; keep changes 
minimal; default to mocks and SPI loaders; keep variable declarations near 
first use and mark retained values `final`; inline single-use locals by default 
unless reuse/readability justifies retention; delete dead code and avoid 
placeholders/TODOs.
+- **Execution discipline:** inspect existing code before edits; keep changes 
minimal; default to mocks and SPI loaders; keep variable declarations near 
first use without marking local variables `final`; inline single-use locals by 
default unless reuse/readability justifies retention; delete dead code and 
avoid placeholders/TODOs.
   Verify code and skills do not contain local machine paths before handoff.
 - **AGENTS.md maintenance:** do not add or update a `Session Notes` section in 
`AGENTS.md`. Keep task-specific notes in the active conversation, issue, or PR; 
only stable project-level rules may be generalized into this file.
 - **Post-task self-check (before replying):** confirm all instructions were 
honored; verify no placeholders/unused code; ensure Checkstyle/Spotless gates 
for touched modules are satisfied or explain why not run and what to run; list 
commands with exit codes; call out risks and follow-ups; complete all 
applicable checks before replying and do not rely on users to find missed rule 
violations.

Reply via email to