diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 72ed6387e1a..594ecef8d5d 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -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` +- Booleans variables are predicates: not `modified` but `was_modified` **C++20 Patterns (Use These):** ```cpp @@ -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 @@ -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 diff --git a/AGENTS.md b/AGENTS.md index e045c3c648f..bf69ad75b48 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 @@ -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:** @@ -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)