Memex Admin

External Notes+Collections Live Coverage Gate

Repository: mem-labs/mem

activeUpdated Feb 19, 2026, 8:12 PM

Policy ID js75yedec881jv87dfevstd3h981da8b

External notes/collections route gate.

Rationale:
- Changes to external `/v2/notes` and `/v2/collections` routes are high-impact API contract changes.
- This gate enforces live test-backed coverage checks and prevents stale/manual coverage artifacts from being used as approval evidence.

Scope:
- Applies only when a PR adds/modifies/renames/deletes files under either path:
  - `domains/python/backend/app/src/api/routes_external/v2/notes/**`
  - `domains/python/backend/app/src/api/routes_external/v2/collections/**`

Trigger:
- Any in-scope file change listed above.

Hard requirements:
1) `domains/python/backend/docs/testing/external_routes_coverage.json` must not be added, modified, renamed, or deleted in the PR.
2) Coverage command entrypoint must exist and be executable in the repo:
   - `domains/python/backend/script/testing/coverage`
3) Required verification command must run successfully (exit code `0`) on the PR branch:
   - `cd domains/python/backend && uv run python script/testing/coverage --no-html --no-xml --no-json -- --maxfail=1 -q tests/src/api/routes_external/v2/notes/test_views.py tests/src/api/routes_external/v2/collections/test_views.py`
4) Collections route tests must include at least one test case each that:
   - performs `POST /v2/collections` and asserts on response status + body shape/content, and
   - performs `DELETE /v2/collections/{collection_id}` and asserts on response status.

Evidence standard:
- Reviewer/bot may approve only when command success is visible in CI logs or provided command output, and requirement (4) is verifiable from changed test files.

Decision:
- Return NOT APPROVED when trigger is met and any hard requirement/evidence standard fails.
- Return APPROVED only when all hard requirements are satisfied.