fix(workflows): standardize runner configuration for security jobs

This commit is contained in:
Will Sarg 2026-02-16 17:51:49 -05:00
parent 13a42935ae
commit 692d0182f3
2 changed files with 63 additions and 45 deletions

View file

@ -21,7 +21,7 @@ env:
jobs: jobs:
audit: audit:
name: Security Audit name: Security Audit
runs-on: ${{ github.event_name != 'pull_request' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@ -37,7 +37,7 @@ jobs:
deny: deny:
name: License & Supply Chain name: License & Supply Chain
runs-on: ${{ github.event_name != 'pull_request' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }} runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 20 timeout-minutes: 20
steps: steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

View file

@ -24,6 +24,7 @@ cargo test telegram --lib
The `test_telegram_integration.sh` script runs: The `test_telegram_integration.sh` script runs:
**Phase 1: Code Quality (5 tests)** **Phase 1: Code Quality (5 tests)**
- ✅ Test compilation - ✅ Test compilation
- ✅ Unit tests (24 tests) - ✅ Unit tests (24 tests)
- ✅ Message splitting tests (8 tests) - ✅ Message splitting tests (8 tests)
@ -31,21 +32,25 @@ The `test_telegram_integration.sh` script runs:
- ✅ Code formatting - ✅ Code formatting
**Phase 2: Build Tests (3 tests)** **Phase 2: Build Tests (3 tests)**
- ✅ Debug build - ✅ Debug build
- ✅ Release build - ✅ Release build
- ✅ Binary size verification (<10MB) - ✅ Binary size verification (<10MB)
**Phase 3: Configuration Tests (4 tests)** **Phase 3: Configuration Tests (4 tests)**
- ✅ Config file exists - ✅ Config file exists
- ✅ Telegram section configured - ✅ Telegram section configured
- ✅ Bot token set - ✅ Bot token set
- ✅ User allowlist configured - ✅ User allowlist configured
**Phase 4: Health Check Tests (2 tests)** **Phase 4: Health Check Tests (2 tests)**
- ✅ Health check timeout (<5s) - ✅ Health check timeout (<5s)
- ✅ Telegram API connectivity - ✅ Telegram API connectivity
**Phase 5: Feature Validation (6 tests)** **Phase 5: Feature Validation (6 tests)**
- ✅ Message splitting function - ✅ Message splitting function
- ✅ Message length constant (4096) - ✅ Message length constant (4096)
- ✅ Timeout implementation - ✅ Timeout implementation
@ -58,50 +63,60 @@ The `test_telegram_integration.sh` script runs:
After running automated tests, perform these manual checks: After running automated tests, perform these manual checks:
1. **Basic messaging** 1. **Basic messaging**
```bash
zeroclaw channel start ```bash
``` zeroclaw channel start
- Send "Hello bot!" in Telegram ```
- Verify response within 3 seconds
- Send "Hello bot!" in Telegram
- Verify response within 3 seconds
2. **Long message splitting** 2. **Long message splitting**
```bash
# Generate 5000+ char message ```bash
python3 -c 'print("test " * 1000)' # Generate 5000+ char message
``` python3 -c 'print("test " * 1000)'
- Paste into Telegram ```
- Verify: Message split into chunks
- Verify: Markers show `(continues...)` and `(continued)` - Paste into Telegram
- Verify: All chunks arrive in order - Verify: Message split into chunks
- Verify: Markers show `(continues...)` and `(continued)`
- Verify: All chunks arrive in order
3. **Unauthorized user blocking** 3. **Unauthorized user blocking**
```toml
# Edit ~/.zeroclaw/config.toml ```toml
allowed_users = ["999999999"] # Edit ~/.zeroclaw/config.toml
``` allowed_users = ["999999999"]
- Send message to bot ```
- Verify: Warning in logs
- Verify: Message ignored - Send message to bot
- Restore correct user ID - Verify: Warning in logs
- Verify: Message ignored
- Restore correct user ID
4. **Rate limiting** 4. **Rate limiting**
- Send 10 messages rapidly - Send 10 messages rapidly
- Verify: All processed - Verify: All processed
- Verify: No "Too Many Requests" errors - Verify: No "Too Many Requests" errors
- Verify: Responses have delays - Verify: Responses have delays
5. **Error logging** 5. **Error logging**
```bash
RUST_LOG=debug zeroclaw channel start ```bash
``` RUST_LOG=debug zeroclaw channel start
- Check for unexpected errors ```
- Verify proper error handling
- Check for unexpected errors
- Verify proper error handling
6. **Health check timeout** 6. **Health check timeout**
```bash
time zeroclaw channel doctor ```bash
``` time zeroclaw channel doctor
- Verify: Completes in <5 seconds ```
- Verify: Completes in <5 seconds
## 🔍 Test Results Interpretation ## 🔍 Test Results Interpretation
@ -116,12 +131,14 @@ After running automated tests, perform these manual checks:
### Common Issues ### Common Issues
**Issue: Health check times out** **Issue: Health check times out**
``` ```
Solution: Check bot token is valid Solution: Check bot token is valid
curl "https://api.telegram.org/bot<TOKEN>/getMe" curl "https://api.telegram.org/bot<TOKEN>/getMe"
``` ```
**Issue: Bot doesn't respond** **Issue: Bot doesn't respond**
``` ```
Solution: Check user allowlist Solution: Check user allowlist
1. Send message to bot 1. Send message to bot
@ -131,6 +148,7 @@ Solution: Check user allowlist
``` ```
**Issue: Message splitting not working** **Issue: Message splitting not working**
``` ```
Solution: Verify code changes Solution: Verify code changes
grep -n "split_message_for_telegram" src/channels/telegram.rs grep -n "split_message_for_telegram" src/channels/telegram.rs
@ -200,14 +218,14 @@ zeroclaw status
Expected values after all fixes: Expected values after all fixes:
| Metric | Expected | How to Measure | | Metric | Expected | How to Measure |
|--------|----------|----------------| | ---------------------- | ---------- | -------------------------------- |
| Health check time | <5s | `time zeroclaw channel doctor` | | Health check time | <5s | `time zeroclaw channel doctor` |
| First response time | <3s | Time from sending to receiving | | First response time | <3s | Time from sending to receiving |
| Message split overhead | <50ms | Check logs for timing | | Message split overhead | <50ms | Check logs for timing |
| Memory usage | <10MB | `ps aux \| grep zeroclaw` | | Memory usage | <10MB | `ps aux \| grep zeroclaw` |
| Binary size | ~3-4MB | `ls -lh target/release/zeroclaw` | | Binary size | ~3-4MB | `ls -lh target/release/zeroclaw` |
| Unit test coverage | 24/24 pass | `cargo test telegram --lib` | | Unit test coverage | 24/24 pass | `cargo test telegram --lib` |
## 🐛 Debugging Failed Tests ## 🐛 Debugging Failed Tests
@ -264,7 +282,7 @@ on: [push, pull_request]
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: blacksmith-2vcpu-ubuntu-2404
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1