ci(coverage): add auto-updated "core coverage" badge

Surface the metric ADR 0004 says matters — the critical security/logic
core, currently 95% — as a README badge, distinct from the
informational global `coverage` badge.

- scripts/critical-modules.txt: single source of truth for the core
  module list. scripts/coverage.sh now reads it (instead of a hardcoded
  string) and update-badges.yml reads the same file, so the badge and
  the `critical` report cannot drift.
- update-badges.yml: a `core coverage` step reuses the unit-coverage
  data (every core module is unit-tested, so unit-only is accurate for
  it) and sed-updates the new badge, like the existing ones.
- README: `core coverage 95%` badge linking to ADR 0004 so a reader can
  find out what "core" means.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkwFXLFff9PYPy4wgVBJp9
This commit is contained in:
2026-06-26 02:19:35 -04:00
parent 8caa79ee76
commit d89d389bef
5 changed files with 51 additions and 9 deletions
+4 -7
View File
@@ -16,13 +16,10 @@ cd "$(dirname "$0")/.."
PY="${PYTHON:-python3}"
# Critical security/logic core held to the high bar by ADR 0004.
CRITICAL="bot_bottle/egress_addon.py,bot_bottle/egress_addon_core.py,\
bot_bottle/dlp_detectors.py,bot_bottle/egress.py,bot_bottle/manifest.py,\
bot_bottle/manifest_egress.py,bot_bottle/manifest_agent.py,\
bot_bottle/manifest_schema.py,bot_bottle/git_gate.py,\
bot_bottle/git_http_backend.py,bot_bottle/supervise.py,\
bot_bottle/yaml_subset.py,bot_bottle/bottle_state.py"
# Critical security/logic core held to the high bar by ADR 0004. The list
# lives in one place (scripts/critical-modules.txt) so this report and the
# README "core coverage" badge can't drift; comma-join it for --include.
CRITICAL=$(grep -vE '^[[:space:]]*(#|$)' scripts/critical-modules.txt | paste -sd, -)
rm -f .coverage
+23
View File
@@ -0,0 +1,23 @@
# Critical security/logic core held to the >=90% coverage bar by
# docs/decisions/0004-coverage-policy.md.
#
# SINGLE SOURCE OF TRUTH: scripts/coverage.sh (the `critical` report) and
# .gitea/workflows/update-badges.yml (the "core coverage" badge) both read
# this file. Add a module here when it becomes part of the core; a coverage
# number that silently stops measuring a module is worse than no badge.
#
# One module path per line, relative to the repo root. Blank lines and
# `#` comments are ignored.
bot_bottle/egress_addon.py
bot_bottle/egress_addon_core.py
bot_bottle/dlp_detectors.py
bot_bottle/egress.py
bot_bottle/manifest.py
bot_bottle/manifest_egress.py
bot_bottle/manifest_agent.py
bot_bottle/manifest_schema.py
bot_bottle/git_gate.py
bot_bottle/git_http_backend.py
bot_bottle/supervise.py
bot_bottle/yaml_subset.py
bot_bottle/bottle_state.py