Xuanwo opened a new pull request, #8847:
URL: https://github.com/apache/opendal/pull/8847
# Which issue does this PR close?
N/A.
# Rationale for this change
OpenDAL optimizes code for reading top-to-bottom within a single file or
module, accepting local duplication when it keeps call chains short and
components self-contained. `AGENTS.md` previously covered narrow
helper-extraction rules under `Helper Functions`, but did not state the broader
optimize-for-reading principle or distinguish harmful indirection and
divergence traps from intentional local duplication.
Documenting these criteria gives contributors and AI coding/maintenance
agents concrete guidance when authoring, reviewing, or cleaning up
code—including avoiding leftover `layer()` trampolines and `#[doc(hidden)] pub`
service structs in layers, and preferring payload-carrying state enums when
loose lifecycle flags obscure invariants.
# What changes are included in this PR?
- Replace `## Helper Functions` in `AGENTS.md` with `## Optimizing for
Reading`, preserving all existing helper guidelines and adding concrete rules
on:
- Preferring flat, self-contained local code over cross-file or
cross-crate deduplication abstractions.
- Focusing cleanups on dead paths, unused trait implementations,
single-purpose conversion traits, pass-through shells, unused generics,
transitional trampolines, and real divergence hazards (such as uncalled public
legacy copies or parallel diverging checks).
- Expressing multi-phase lifecycle invariants with payload-carrying enum
variants while leaving small single-screen structs simple.
- Keeping internal names (`*Service` instead of legacy `*Accessor`),
visibility, and `unsafe` / doc comments accurate.
- Update `## Layer Implementation Pattern` to state that layers should
construct their internal `*Service` wrapper directly inside
`Layer::apply_service` and keep it private unless external callers need to name
it.
# Are there any user-facing changes?
No. Documentation for repository contributors and agents only.
# Breaking changes
# AI Usage Statement
- Harness: pi
- Model: Gemini 4 Neon
- Effort: xhigh
- Role: Distilled the guidelines from a repository-wide code readability
audit and drafted the `AGENTS.md` update and PR description.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]