You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(doccano-django): real Python line coverage via coverage.py overlay
Replaces the prior API-route-surface "coverage" (which counted
fired routes / known routes — a proxy that read like real coverage
but didn't measure code execution) with actual line coverage via
coverage.py 7.6.1.
Architecture:
- `Dockerfile.coverage` extends `doccano/doccano:backend` to
install coverage[toml] and drop a `coverage_subprocess.pth`
file into site-packages, so every gunicorn worker that forks
auto-starts `coverage.process_startup()`.
- `.coveragerc` runs in parallel mode (one .coverage.<pid> per
worker) with sigterm = true so flushing happens on graceful
shutdown.
- `docker-compose.coverage.yml` is an OVERLAY: the GH Actions
coverage workflow applies it via `-f docker-compose.yml -f
docker-compose.coverage.yml`. The base `Dockerfile` and
`docker-compose.yml` are untouched, so keploy/integrations and
keploy/enterprise CI lanes consume the base compose and pay
zero coverage-instrumentation cost.
- `flow.sh::doccano_report_coverage` shells into the running
backend, runs `coverage combine` + `coverage report
--format=total`, emits `Covered N/M (XX.X%)` matching the
helper script's regex. When called against the base image
(no overlay) it prints "INFO: ... uninstrumented" and exits 0
so enterprise lanes' `flow.sh coverage || true` informational
calls keep working.
Removed:
- `doccano_list_routes` (the Django URL-resolver walk).
- `doccano_list_recorded_routes` (the keploy-tests / fired-routes
reader).
- The legacy route-surface `doccano_report_coverage` body.
- `list-routes` subcommand (was diagnostic only for the surface
metric).
Validated locally: e2e run produced `coverage=59.0` to
GITHUB_OUTPUT against a clean stack (gunicorn 4 workers, traffic
loop fired, SIGTERM flush, combine+report inside container).
59% reflects bootstrap + the sample's small traffic surface;
adding curls to flow.sh::doccano_record_traffic moves the
number up.
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Copy file name to clipboardExpand all lines: .github/workflows/doccano-django.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -175,8 +175,8 @@ jobs:
175
175
if python3 -c "import sys; sys.exit(0 if (${RELEASE} - ${BUILD}) > ${THRESHOLD} else 1)"; then
176
176
echo "::error::doccano-django coverage dropped from ${RELEASE}% → ${BUILD}% (-${drop}pp), exceeding the ${THRESHOLD}pp threshold."
177
177
echo "Suggested actions:"
178
-
echo " * Add curl(s) to flow.sh::doccano_record_traffic that exercise the routes you changed/touched."
179
-
echo " * If the route(s) was intentionally retired, drop it from doccano-django/flow.sh::doccano_list_routes' SCOPE_PREFIXES too so it's removed from the denominator."
178
+
echo " * Add curl(s) to flow.sh::doccano_record_traffic that exercise the new code paths."
179
+
echo " * Or extend the .coveragerc 'omit' list if the new module is not part of the runtime backend (migrations, management commands, tests)."
180
180
exit 1
181
181
fi
182
182
echo "OK — coverage delta within ${THRESHOLD}pp threshold."
@@ -196,4 +196,4 @@ jobs:
196
196
197
197
Threshold: PR may not drop coverage by more than **${{ env.COVERAGE_THRESHOLD }}pp**. Override per-repo via the `DOCCANO_COVERAGE_THRESHOLD` actions variable.
198
198
199
-
Coverage measures the API surface (`/v1/projects/*` + `/v1/me` + `/v1/users` + `/v1/health` + `/v1/auth`) that `flow.sh::doccano_record_traffic` actually exercises against the running backend's URL resolver. Reports are attached as artifacts on each job ("coverage-build" / "coverage-release").
199
+
Coverage is **Python line coverage** (coverage.py 7.6.1) of the doccano backend code — the bytes that `flow.sh::doccano_record_traffic` actually executes. Instrumentation lives in a separate `Dockerfile.coverage` + `docker-compose.coverage.yml` overlay; the base `docker-compose.yml` consumed by keploy/integrations and keploy/enterprise CI lanes runs uninstrumented and pays zero coverage cost. Per-file reports are attached as artifacts on each job (`coverage-build` / `coverage-release`).
0 commit comments