AI agent instruction updates#13335
Conversation
| - Functions/variables: `snake_case` → `handle_request()`, `server_port`, `cache_key` | ||
| - Constants/macros: `UPPER_CASE` → `HTTP_STATUS_OK`, `MAX_BUFFER_SIZE` | ||
| - Member variables: `snake_case` with no prefix → `connection_count`, `buffer_size` | ||
| - Private member variables: `snake_case` with `m_` prefix → `m_was_modified` |
There was a problem hiding this comment.
I did a quick check and it looks like the leading underscore _foo style is the most common in the existing code. About 71% of private member variables. Could we keep using that?
There was a problem hiding this comment.
It is sadly common, but generally not advised because of possible conflicts with other internal variables. m_ is the typical pattern, and is also not uncommon in our codebase. We're really better off with m_ prefixes for new variables.
There was a problem hiding this comment.
For instance:
https://stackoverflow.com/a/20496955/629530
There was a problem hiding this comment.
FWIW, I was following _ prefix rule because it's written in here to do so.
https://cwiki.apache.org/confluence/display/TS/Coding+Style#CodingStyle-MemberVariables
Probably, it's time to discuss this bike-shedding :)
7828aaf to
11fbce8
Compare
AI coding guidance does not fully reflect project conventions, which can lead agents toward inconsistent names and less maintainable tests. This aligns the instructions with established AuTest, Python, and C++ practices. It also documents both private-member prefix styles and the community preference for `_` in new files.
11fbce8 to
c6e5a47
Compare
| - Private member variables use both `_` and `m_` prefixes in the source code; | ||
| be consistent with the surrounding code. For new files, prefer the `_` prefix | ||
| because that reflects the community consensus. | ||
| - Booleans variables and functions returning booleans are named as predicates: not `modified` but `was_modified` |
| - Private member variables use both `_` and `m_` prefixes in the source code; | ||
| be consistent with the surrounding code. For new files, prefer the `_` prefix | ||
| because that reflects the community consensus. | ||
| - Booleans variables are predicates: not `modified` but `was_modified` |
A few tweaks for guiding AI agents.
Undraft this after @moonchen 's similar updates land and this is merged with those changes:
#13306