Skip to content

Commit a9b19f0

Browse files
CopilotMarenz
andcommitted
Enhance Copilot instructions with detailed error patterns and validation scenarios
Co-authored-by: Marenz <[email protected]>
1 parent 5f085d0 commit a9b19f0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/copilot-instructions.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ After making any changes to the codebase, ALWAYS run these validation steps:
5757

5858
### Manual Testing Scenarios
5959
Test actual functionality by exercising the API:
60-
- Import and inspect the generated protobuf messages: `python -c "from frequenz.api.dispatch.v1.dispatch_pb2 import *; print(dir())"`
60+
- Import and inspect the generated protobuf messages: `PYTHONPATH=py python3 -c "from frequenz.api.dispatch.v1.dispatch_pb2 import *; print('Available classes:', [name for name in dir() if not name.startswith('_')][:5])"`
6161
- Verify protobuf serialization works: Create a dispatch message, serialize it, and deserialize it
6262
- **ALWAYS** test import after regenerating protobuf files
63+
- **Basic Syntax Validation**: Use `python3 -c "import py_compile; py_compile.compile('path/to/file.py', doraise=True)"` for generated files
6364

6465
## Common Tasks
6566

@@ -116,19 +117,26 @@ nox.configure(RepositoryType.API)
116117
- Install: `curl -LO https://github.com/yoheimuta/protolint/releases/download/v0.53.0/protolint_0.53.0_Linux_x86_64.tar.gz && tar -xzf protolint_0.53.0_Linux_x86_64.tar.gz && sudo mv protolint /usr/local/bin/`
117118

118119
### Network-Limited Workaround Workflow
119-
1. `git submodule update --init` -- 5 seconds
120-
2. `sudo apt install -y protobuf-compiler python3-protobuf python3-grpcio python3-pytest`
120+
1. `git submodule update --init` -- 5 seconds. NEVER CANCEL.
121+
2. `sudo apt install -y protobuf-compiler python3-protobuf python3-grpcio python3-pytest` -- 2-3 minutes. NEVER CANCEL.
121122
3. Generate protobuf files manually (see commands above)
122-
4. `PYTHONPATH=py python3 -m pytest pytests/ -v` -- <1 second
123-
5. **NOTE**: Many development tools unavailable, use basic Python syntax checking
123+
4. `PYTHONPATH=py python3 -m pytest pytests/ -v` -- <1 second. NEVER CANCEL.
124+
5. **Syntax Check**: `python3 -c "import py_compile; py_compile.compile('py/frequenz/api/dispatch/v1/dispatch_pb2.py', doraise=True)"` -- basic Python syntax validation
125+
6. **NOTE**: Many development tools unavailable, use basic Python syntax checking
124126

125127
### Important Notes
126-
- **NEVER CANCEL**: In normal circumstances, `nox` can take 15+ minutes, `python -m build` can take 2+ minutes
128+
- **NEVER CANCEL**: In normal circumstances, `nox` can take 15+ minutes, `python -m build` can take 2+ minutes. Set timeout to 60+ minutes for builds, 30+ minutes for tests.
127129
- **TIMING ESTIMATES**: With network access, expect 15-30 minutes for full build and test cycle
128130
- **FIREWALL LIMITATION**: Current environment has PyPI connectivity issues preventing normal pip operations
131+
- **Error Pattern**: `ReadTimeoutError: HTTPSConnectionPool(host='pypi.org', port=443): Read timed out.`
132+
- **Workaround**: Use system packages (`apt install`) instead of pip when possible
129133
- **CRITICAL**: Always run `git submodule update --init` before any other operations
130134
- **GENERATED CODE**: The py/ directory contains generated Python code from protobuf files
131135
- **TEST DEPENDENCIES**: Basic tests work with system packages, full test suite requires pip-installed dependencies
136+
- **SUCCESS INDICATORS**:
137+
- Protobuf generation: No errors, warning about unused imports is normal
138+
- Test success: `test_package_import PASSED` indicates basic functionality works
139+
- Import test: `Import successful` message confirms protobuf modules are available
132140

133141
### Proto File Workflow
134142
- Protocol buffer definitions are in `proto/frequenz/api/dispatch/v1/dispatch.proto`

0 commit comments

Comments
 (0)