Skip to content

chore(cargo)(deps): bump tracing-subscriber from 0.3.22 to 0.3.23 in /orchestrator #1378

chore(cargo)(deps): bump tracing-subscriber from 0.3.22 to 0.3.23 in /orchestrator

chore(cargo)(deps): bump tracing-subscriber from 0.3.22 to 0.3.23 in /orchestrator #1378

name: Coverage Ratchet
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
jobs:
# Measure current coverage
measure-coverage:
name: Measure Coverage
runs-on: ubuntu-latest
outputs:
rust-coverage: ${{ steps.rust.outputs.coverage }}
python-coverage: ${{ steps.python.outputs.coverage }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Need history for comparison
- name: Setup Rust
uses: dtolnay/rust-toolchain@4be9e76fd7c4901c61fb841f559994984270fce7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install tarpaulin
run: cargo install cargo-tarpaulin
- name: Measure Rust coverage
id: rust
working-directory: orchestrator
run: |
cargo tarpaulin --out Xml --output-dir coverage \
--exclude-files '*/tests/*' --timeout 600 -- --test-threads=1 || true
COVERAGE=$(python3 <<'EOF'
import xml.etree.ElementTree as ET
import sys
try:
tree = ET.parse('coverage/cobertura.xml')
root = tree.getroot()
pct = float(root.attrib['line-rate']) * 100
print(f"{pct:.1f}")
except:
print("0.0")
EOF
)
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
echo "🦀 Rust coverage: ${COVERAGE}%"
- name: Measure Python coverage
id: python
working-directory: agent
run: |
python -m venv .venv
.venv/bin/pip install -q -e ".[dev]"
.venv/bin/pytest tests/ --cov=. --cov-report=xml -q
COVERAGE=$(python3 <<'EOF'
import xml.etree.ElementTree as ET
tree = ET.parse('coverage.xml')
root = tree.getroot()
pct = float(root.attrib.get('line-rate', 0)) * 100
print(f"{pct:.1f}")
EOF
)
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
echo "🐍 Python coverage: ${COVERAGE}%"
# Enforce ratchet (prevent regression)
ratchet-enforcement:
name: Enforce Ratchet
runs-on: ubuntu-latest
needs: measure-coverage
steps:
- uses: actions/checkout@v6
- name: Create baseline if needed
run: |
if [ ! -f .coverage-baseline.json ]; then
cat > .coverage-baseline.json <<'EOF'
{
"rust": "0.0",
"python": "58.0",
"rust_target": "75.0",
"python_target": "75.0",
"rust_ratchet": "0.0",
"python_ratchet": "58.0"
}
EOF
echo "📊 Created initial baseline with Python at 58.0%"
fi
- name: Check Rust ratchet
run: |
CURRENT="${{ needs.measure-coverage.outputs.rust-coverage }}"
RATCHET=$(jq -r '.rust_ratchet' .coverage-baseline.json)
TARGET=$(jq -r '.rust_target' .coverage-baseline.json)
echo "🦀 Current: ${CURRENT}%, Ratchet: ${RATCHET}%, Target: ${TARGET}%"
if (( $(echo "$CURRENT < $RATCHET" | bc -l) )); then
echo "❌ Rust coverage ${CURRENT}% < ratchet ${RATCHET}%"
exit 1
fi
# Update ratchet if coverage improved
if (( $(echo "$CURRENT > $RATCHET" | bc -l) )); then
NEW_RATCHET=$CURRENT
echo "📈 Rust coverage improved, updating ratchet to ${NEW_RATCHET}%"
jq --arg nr "$NEW_RATCHET" '.rust_ratchet = $nr' .coverage-baseline.json > .tmp
mv .tmp .coverage-baseline.json
fi
- name: Check Python ratchet
run: |
CURRENT="${{ needs.measure-coverage.outputs.python-coverage }}"
RATCHET=$(jq -r '.python_ratchet' .coverage-baseline.json)
TARGET=$(jq -r '.python_target' .coverage-baseline.json)
echo "🐍 Current: ${CURRENT}%, Ratchet: ${RATCHET}%, Target: ${TARGET}%"
if (( $(echo "$CURRENT < $RATCHET" | bc -l) )); then
echo "❌ Python coverage ${CURRENT}% < ratchet ${RATCHET}%"
exit 1
fi
# Update ratchet if coverage improved
if (( $(echo "$CURRENT > $RATCHET" | bc -l) )); then
NEW_RATCHET=$CURRENT
echo "📈 Python coverage improved, updating ratchet to ${NEW_RATCHET}%"
jq --arg nr "$NEW_RATCHET" '.python_ratchet = $nr' .coverage-baseline.json > .tmp
mv .tmp .coverage-baseline.json
fi
- name: Configure git for CI
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Commit updated ratchet
if: github.event_name == 'push'
run: |
git add .coverage-baseline.json
if ! git diff --staged --quiet; then
echo "Committing coverage ratchet update..."
git commit -m "chore: update coverage ratchet [skip ci]" --no-verify || {
echo "❌ Git commit failed"
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)"
echo "Git status:"
git status
exit 1
}
echo "Pushing changes..."
git push || {
echo "⚠️ Git push failed (may retry later)"
# Don't fail the job - coverage measurement is still valid
}
else
echo "No coverage changes to commit"
fi
# Documentation freshness
doc-freshness:
name: Documentation Freshness
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Check doc freshness
run: |
python3 <<'EOF'
import re
from pathlib import Path
issues = []
for md_file in Path('docs').rglob('*.md'):
content = md_file.read_text()
# Check for TODO/FIXME in docs
if re.search(r'TODO|FIXME|XXX', content, re.IGNORECASE):
# Only warn, don't fail
print(f"⚠️ {md_file}: Contains TODO/FIXME markers")
# Check for outdated code examples
if '```' in content:
blocks = re.findall(r'```(\w*)\n(.*?)\n```', content, re.DOTALL)
for lang, code in blocks:
if lang in ['python', 'py']:
# Filter out comments and list items before checking (common in docs)
filtered_lines = []
for line in code.split('\n'):
stripped = line.strip()
if not stripped.startswith('#') and not stripped.startswith('-') and not stripped.startswith('*'):
filtered_lines.append(line)
filtered_code = '\n'.join(filtered_lines)
if filtered_code.strip(): # Only check if there's non-comment/list content
try:
compile(filtered_code, '<string>', 'exec')
except SyntaxError as e:
issues.append(f"{md_file}: Invalid Python code: {e}")
if issues:
print("❌ Documentation issues found:")
for issue in issues:
print(f" - {issue}")
exit(1)
else:
print("✅ Documentation freshness check passed")
EOF
# Stale issue/PR management
stale-management:
name: Stale Management
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/stale@v10
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
days-before-close: 14
stale-issue-label: "stale"
stale-pr-label: "stale"
exempt-issue-labels: "enhancement,good first issue"
exempt-pr-labels: "work-in-progress"
stale-issue-message: |
This issue has been inactive for 30 days. Will close in 14 days if no activity.
stale-pr-message: |
This PR has been inactive for 30 days. Will close in 14 days if no activity.