closedhumanPR #233Other

fix(receipt): refuse Town Proof when coverage is incomplete

Town Proof previously required at least one tested stage but did not reject a nonempty coverage.not_tested list. A passing direct A2A run without a pinned AgentCard digest could therefore leave descriptor_consistency untested while still…

Author

JamesCarnley avatar

@JamesCarnley

github profile →
Status
Closed without merging
Opened on
Sep 3
Branch
fix/town-proof-incomplete-coverage

Description

The pitch.

## Summary

Town Proof previously required at least one tested stage but did not reject a nonempty `coverage.not_tested` list. A passing direct A2A run without a pinned AgentCard digest could therefore leave `descriptor_consistency` untested while still rendering `TOWN-TESTED`.

This change makes Town Proof ineligible whenever the receipt records any untested stage and names those stages in the refusal reason. It also fails closed when the `not_tested` field is missing or malformed.

Partial receipts remain valid evidence: `make_receipt()` still records and signs partial coverage, and `verify_receipt()` still verifies its signature and bundle binding. Only the higher-level badge eligibility policy changes.

## Regression coverage

- A normal unpinned A2A run still passes and produces a valid, verifiable receipt, but cannot render `TOWN-TESTED`; the reason names `descriptor_consistency`.
- A normal pinned, fully covered, passing, fresh, verified run still renders `TOWN-TESTED`.
- Missing and non-string `coverage.not_tested` metadata fail closed instead of raising.
- Existing failed-verdict, stale-evidence, tampering, and CLI behavior tests remain covered.

## Verification

- `.venv/bin/python -m pytest -q tests/test_receipt.py` — 8 passed on Python 3.11.15.
- `.venv/bin/python -m pytest -q` — 185 passed on Python 3.11.15.
- `uv run --python 3.12 --with-editable . --with pytest python -m pytest -q` — 185 passed on Python 3.12.13.
- `nandatown run marketplace --out /tmp/runs` — PASSED on Python 3.11 and 3.12.
- `nandatown run quote-crash-restart --out /tmp/runs` — PASSED on Python 3.11 and 3.12.
- `git diff --check` — passed.

Current CI defines no separate lint or formatting command.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/233/head:pr-233
git checkout pr-233