74ec9843f0
prd-number-check / require-numbered-prds (pull_request) Successful in 9s
tracker-policy-pr / check-pr (pull_request) Successful in 10s
test / unit (pull_request) Successful in 49s
test / image-input-builds (pull_request) Successful in 50s
test / integration-docker (pull_request) Successful in 56s
test / coverage (pull_request) Successful in 15s
test / image-input-builds (push) Successful in 46s
Update Quality Badges / update-badges (push) Successful in 56s
test / coverage (push) Successful in 22s
test / integration-docker (push) Successful in 1m3s
test / unit (push) Successful in 48s
lint / lint (push) Successful in 2m59s
Lower the diff-coverage gate from 90% to 80% and the critical-module target from 90% to 85%. The 90% diff gate forced back-fill tests on nearly every changed line; 80% keeps new code honest without the churn. Global coverage stays informational per ADR 0004 (no new gate added). Updates scripts/diff_coverage.py, scripts/coverage.sh, scripts/critical-modules.txt, .gitea/workflows/test.yml, and records the change as a dated revision in ADR 0004. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
61 lines
2.1 KiB
Bash
Executable File
61 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Combined unit + integration coverage (see docs/decisions/0004-coverage-policy.md).
|
|
#
|
|
# Two modes:
|
|
#
|
|
# scripts/coverage.sh [critical]
|
|
# Run mode (default, for local dev): executes the unit suite then the
|
|
# integration suite under coverage and prints a combined report.
|
|
#
|
|
# scripts/coverage.sh aggregate [critical]
|
|
# Aggregate mode (used by CI): combines pre-existing .coverage.* files
|
|
# produced by individual test jobs and prints a combined report. No tests
|
|
# are re-executed; no KVM or Docker dependency.
|
|
#
|
|
# Pass "critical" as the last argument in either mode to also report just the
|
|
# critical modules (ADR 0004 target: 85%).
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
PY="${PYTHON:-python3}"
|
|
|
|
# Critical security/logic core held to the high bar by ADR 0004. The helper
|
|
# fails before coverage when a curated path was renamed or removed; Coverage.py
|
|
# itself would silently ignore that stale include and inflate the score.
|
|
CRITICAL=$("$PY" scripts/critical_modules.py)
|
|
|
|
if [ "${1:-}" = "aggregate" ]; then
|
|
# Aggregate mode: combine .coverage.* artifacts already in the workspace.
|
|
echo "== combining coverage artifacts ==" >&2
|
|
"$PY" -m coverage combine
|
|
|
|
echo "== combined report ==" >&2
|
|
"$PY" -m coverage report -m
|
|
|
|
if [ "${2:-}" = "critical" ]; then
|
|
echo "== critical modules (ADR 0004 minimum: 85%) ==" >&2
|
|
"$PY" -m coverage report --include="$CRITICAL" --fail-under=85
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
# Run mode (default): execute both suites under coverage in this process.
|
|
rm -f .coverage
|
|
|
|
echo "== unit ==" >&2
|
|
"$PY" -m coverage run -m unittest discover -t . -s tests/unit
|
|
|
|
echo "== integration (firecracker; skips docker tests) ==" >&2
|
|
BOT_BOTTLE_BACKEND=firecracker SKIP_DOCKER_TESTS=1 \
|
|
BOT_BOTTLE_INFRA_ARTIFACT_DIR="${BOT_BOTTLE_CI_INFRA_ARTIFACT_DIR:-}" \
|
|
"$PY" -m coverage run --append -m unittest discover -t . -s tests/integration
|
|
|
|
echo "== combined report ==" >&2
|
|
"$PY" -m coverage report -m
|
|
|
|
if [ "${1:-}" = "critical" ]; then
|
|
echo "== critical modules (ADR 0004 minimum: 85%) ==" >&2
|
|
"$PY" -m coverage report --include="$CRITICAL" --fail-under=85
|
|
fi
|