Skip to content

attestation-reporter: wrong-shaped retention lists fail one metric closed (scout S-C4) - #519

Open
dhagell wants to merge 1 commit into
mainfrom
fix/retention-metrics-wrong-shape-sc4
Open

dhagell wants to merge 1 commit into
mainfrom
fix/retention-metrics-wrong-shape-sc4

Conversation

@dhagell

@dhagell dhagell commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Bug (scout round 3, proposal S-C4, not yet a numbered card). PackEngine._retention_metrics (services/attestation-reporter/src/attestation_reporter/engine.py) sorted and indexed offending and unresolvable from the ledger's /retention/check with o.get(...) on whatever it was given. A list of non-objects, a dict, a string or a number raised AttributeError (or TypeError) out of build(), so one odd ledger answer lost the whole board pack; the other metrics already fail one metric closed for wrong shapes (C-247). Reproduced by the new tests (17 red).

Fix (engine.py only): after the existing guards, offending and unresolvable must each be a list whose elements are all records (dicts), using the file's own _non_records helper; otherwise the count metric is unavailable with a fixed note ("not a list of records; figure not published") and the policy figure is still published. Well-formed lists, empty lists, missing keys and None behave exactly as before; canary filtering is unchanged. The note does not echo the wrong value.

New tests/test_retention_wrong_shape_sc4.py (19): 8 wrong shapes for each of the two fields, the note never echoing the value, well-formed records still counted, empty/missing/None still zero. Failing first, then green.

Ran (cloud, no GX10, so UNVERIFIED): attestation-reporter suite 274 passed; environment_anchors.py --check 0 wrong rows. One mutant (drop the shape guard): 17 red; restored. Not run: other suites. Note for the reviewer: False, 0 and "" for these keys are still read as "empty" by the existing or [], as before; I did not change that.


Generated by Claude Code

…count metric unavailable instead of raising out of build (scout S-C4)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nkc8NxkTXYuNnPUXqcTUb9
@dhagell
dhagell marked this pull request as ready for review November 4, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant