Commit ea36005
committed
48c3293 docs: [#121] add comprehensive environment variable naming guide (Jose Celano)
d73db7e feat: [#121] skip slow tests for Copilot agent with enhanced messaging (Jose Celano)
Pull request description:
## Summary
This PR addresses issue #121 by implementing a solution to prevent GitHub Copilot coding agent from timing out during pre-commit checks.
## Changes
### 1. Environment Variable Renaming
**Changed:** `TORRUST_TD_SKIP_E2E_TESTS` → `TORRUST_TD_SKIP_SLOW_TESTS`
**Rationale:**
- Action-based naming (`SKIP_SLOW_TESTS`) is clearer than condition-based (`RUNNING_IN_AGENT_ENV`)
- More descriptive of what actually happens
- Not tied to a specific environment (more flexible)
- Could be used by developers locally for faster pre-commit checks
### 2. Expanded Test Skipping
**Now skips in fast mode:**
- E2E provision and destroy tests (~44s)
- E2E configuration tests (~48s)
- Code coverage check (~1m 29s)
- **Total time saved: ~3 minutes (54.8% reduction)**
**Still runs in fast mode:**
- cargo machete (~0.08s)
- All linters (~19s)
- Unit tests - 1529 tests (~1m 16s)
- cargo doc (~44s)
### 3. Enhanced Pre-commit Messaging
When `TORRUST_TD_SKIP_SLOW_TESTS=true`, the script now displays:
```
⚠️ Running in fast mode (skipping slow tests)
The following tests are SKIPPED to stay within the 5-minute timeout limit:
• E2E provision and destroy tests (~44 seconds)
• E2E configuration tests (~48 seconds)
• Code coverage check (~1 minute 29 seconds)
💡 These tests will run automatically in CI after PR creation.
If you want to run them manually before committing, use these commands:
cargo run --bin e2e-provision-and-destroy-tests # ~44s
cargo run --bin e2e-config-tests # ~48s
cargo cov-check # ~1m 29s
Fast mode execution time: ~3 minutes 48 seconds
```
**Benefits:**
- Clear list of what was skipped
- Exact commands to run each test separately (all < 5 min)
- AI agents can choose to run them individually if time permits
- Informative guidance about CI safety net
### 4. Comprehensive Documentation
Added detailed timing tables to `docs/contributing/copilot-agent/pre-commit-config.md`:
**Individual Task Timings:**
| Task | Time | % of Total | Skipped? |
|------|------|-----------|----------|
| cargo machete | 0.08s | 0.04% | ❌ No |
| All linters | 18.75s | 5.7% | ❌ No |
| Unit tests | 1m 16s | 22.9% | ❌ No |
| cargo doc | 44s | 13.4% | ❌ No |
| E2E provision | 44s | 13.4% | ✅ Yes |
| E2E config | 48s | 14.4% | ✅ Yes |
| Coverage | 1m 29s | 26.9% | ✅ Yes |
**Unit Tests Breakdown:**
- Shows detailed breakdown of all 1529 tests across 8 test suites
- Explains why unit tests are NOT skipped despite taking 1m 16s
### 5. Documentation Organization
- Created `docs/contributing/copilot-agent/` folder
- Moved `copilot-agent-firewall.md` → `copilot-agent/firewall.md`
- Added `copilot-agent/README.md` index
- Added `copilot-agent/pre-commit-config.md` comprehensive setup guide
- Updated all cross-references
## Performance Results
- **Full mode:** ~5m 30s (exceeds Copilot's ~5-6 min timeout ⚠️ )
- **Fast mode:** ~3m 48s (31% faster, ~2 min safety margin ✅)
- **Unit tests:** 1m 16s (kept in fast mode for quality assurance)
## Testing
✅ Fast mode tested: `TORRUST_TD_SKIP_SLOW_TESTS=true ./scripts/pre-commit.sh`
✅ Full mode tested: `./scripts/pre-commit.sh`
✅ All markdown linting passes
✅ Messaging displays correctly with timing information
## Next Steps for Repository Admins
**Important:** Update GitHub environment variable configuration:
1. Go to Settings > Environments > copilot
2. **Change variable name:** `TORRUST_TD_SKIP_E2E_TESTS` → `TORRUST_TD_SKIP_SLOW_TESTS`
3. Keep value as `true`
## CI Safety Net
Even though slow tests are skipped in pre-commit for Copilot agent, they still run:
- In GitHub Actions workflows on PR creation
- In the full CI pipeline before merging
This ensures no regressions slip through while keeping Copilot agent functional.
## Related
- Closes #121
- Community Discussion: https://github.com/orgs/community/discussions/178998
ACKs for top commit:
josecelano:
ACK 48c3293
Tree-SHA512: 9ba430ec13812da1d3ef3ff9b57b55252bdbec9638f3784fc48a37a593d70ee2a0d3c19320a32593143d486545c822f02936a11537a3f58f547e398b1c73d880
9 files changed
Lines changed: 779 additions & 28 deletions
File tree
- .github
- docs/contributing
- copilot-agent
- packages/dependency-installer
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
0 commit comments