Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ void function() {
- 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`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

- Booleans variables are predicates: not `modified` but `was_modified`

**C++20 Patterns (Use These):**
```cpp
Expand Down Expand Up @@ -153,6 +155,7 @@ for (auto &conn : connections) {
- Python 3.11+ with type hints
- 4-space indentation (never tabs)
- Type annotations on all function signatures
- Use f'...' strings rather than .format() strings for new Python code.

### License Headers

Expand Down Expand Up @@ -358,7 +361,9 @@ plugins/my_plugin/
**When adding new functionality:**
1. Check if unit tests exist in same directory (Catch2)
2. Add integration tests in `tests/gold_tests/` (autest)
3. Prefer `Test.ATSReplayTest()` with `replay.yaml` format (Proxy Verifier)
3. Prefer `Test.ATSReplayTest()` with `replay.yaml` format (Proxy Verifier). If
`ATSReplayTest` doesn't fit, prefer organizing the test around a test class with
separate functions for configuring the servers, ATS, client, etc.
4. Test both success and error paths
## Configuration
Expand Down
19 changes: 13 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,15 @@ regularly).
using the Proxy Verifier format. This is simpler, more maintainable, and
parseable by tools.

**Python conventions for test and helper scripts:**
- Launch Python helpers with `{sys.executable}` rather than a hardcoded `python3`,
so the test runs under the same interpreter the harness uses.
- Prefer f-strings over `str.format()` when building command lines, config lines,
and `Testers` expressions.
- Add type annotations to helper functions.
If `ATSReplayTest` is not a good fit (say, the test needs a custom client), then
organize the test around a test class with member functions that configure any
servers, the ATS process, and the client. See
`tests/gold_tests/ats_probe/ats_probe.test.py` for an example of a test organized
around a test class.

In autests, launch Python helpers with `{sys.executable}` rather than a
hardcoded `python3`, so the test runs under the same interpreter the harness
uses.

**For complete details on writing autests, see:**
- `doc/developer-guide/testing/autests.en.rst` - Comprehensive guide to autest
Expand Down Expand Up @@ -314,6 +317,7 @@ SMDebug(dbg_ctl, "Processing request for URL: %s", url);
- snake_case for variables and functions: `server_entry`, `handle_api_return()`
- UPPER_CASE for macros and constants: `HTTP_SM_SET_DEFAULT_HANDLER`
- Private member variables have the `m_` prefix.
- Booleans variables and functions returning booleans are named as predicates: not `modified` but `was_modified`

**Doxygen Comments:**

Expand Down Expand Up @@ -364,6 +368,9 @@ MIOBuffer *buffer = (MIOBuffer*)malloc(sizeof(MIOBuffer));
### Python Code Style (for tests and tools)
- Python 3.11+ with proper type annotations
- 4-space indentation, never TABs
- Type annotations on all function signatures
- Prefer f-strings over `str.format()` when building command lines, config lines,
and `Testers` expressions.

### Memory Management
- Custom allocators supported (jemalloc, mimalloc)
Expand Down