Repository navigation
feat: add risk-to-test traceability ledger - #262
Merged
Merged
Conversation
Add a lightweight, structured risk-to-test ledger as an appendix to sumo-qa's markdown-first verdict — never a replacement. Schema + plumbing (file/format only, no inference): - ledger_models.py: RiskLedgerRow / RiskLedger with the six required fields (stable risk id, statement, source anchor, covering/planned test, evidence status, residual decision), five distinct evidence states (planned / passing / failing / stale / accepted_residual), optional repo-map node-id link (#154), extra=forbid, unique-id guard. - ledger_format.py: deterministic markdown-table projection + compact one-line summary, bounded by max_rows (token-budget discipline). - ledger_validation.py: load/validate envelope with stable error kinds. - sumo_qa_format_risk_ledger MCP tool: validates host-supplied rows and renders the appendix; read-only; the host identifies the risks. Skill wiring (optional appendix, prose stays the deliverable): - reviewing-before-merge: project named risks + coverage map below the verdict; uncovered_blocker_count must be 0 before SAFE; markdown table shape pinned (columns + worked rows) so the candidate emits a table. - preparing-for-work: planning-only ledger (all rows planned, no code change / no test run). - creating-test-plan, finishing-qa-work: traceable appendix to the plan / run summary. Docs + coverage: - docs/RISK-LEDGER.md (contract, vocabulary, when NOT to use it); README, TOOLS.md, ARCHITECTURE.md tool-count + index updates. - promptfoo evals: uncovered-risk review ledger + planning-only ledger.
… inputs - ledger_format._escape neutralises newlines/carriage returns in cell values so a multi-line value can no longer break the table row or inject markdown outside the row - format_ledger_markdown clamps a negative max_rows to 0 before slicing, so a negative cap renders zero rows (truncated) instead of a Python negative-slice keeping all-but-the-last row - load_ledger treats any present-but-mismatched schema_version (string OR non-string, e.g. int 2) as schema_version_mismatch instead of surfacing a confusing vocab/literal error
…ct truncated flag _escape() collapses the complete line/paragraph/vertical separator set (VT, FF, FS, GS, RS, NEL, U+2028, U+2029) to a single space before pipe-escaping, so no separator can split a rendered table row. truncated now uses max(max_rows, 0) so an empty ledger with a negative cap reports False instead of True.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2d4fa991ed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
added 2 commits
May 31, 2026 02:31
… counts The optional "Repo-map node" column stripped the trailing table delimiter without re-adding it, so a ledger row carrying repo_map_node_id rendered a 6-column header/rule over 7-column data rows — a malformed table on exactly the documented repo-map path (#154). Re-add the delimiter to both the header and the rule, and pin a cell-count regression test; the prior repo-map tests asserted only substring presence and could not see the ragged table. Also de-specify the surviving hand-written tool-count prose in docs/ARCHITECTURE.md and docs/INSTALL.md to capability altitude, per the #256 policy (docs describe capabilities, not drift-prone inventory counts).
The regression test's cell_count helper split on every '|', so an escaped '\|' inside a cell value was double-counted — a future maintainer adding a pipe-bearing value here would hit a confusing false failure. Split on unescaped delimiters only (re.split with a negative lookbehind) and add a third row that carries a literal pipe AND a repo-map node id, so the escape path and the new column delimiter are now exercised together. Verified the strengthened test still fails on the pre-fix delimiter bug ([6,6,7,7,7]).
7 tasks done
sumithr
added a commit
that referenced
this pull request
May 31, 2026
🤖 I have created a release *beep* *boop* --- ## [0.21.0](v0.20.3...v0.21.0) (2026-05-31) ### Features * add risk-to-test traceability ledger ([#262](#262)) ([031abe7](031abe7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <release-please[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #144.
Adds a risk-to-test traceability ledger as a structured appendix to sumo-qa's markdown-first verdict (never a replacement):
ledger_models.py— Pydantic schema (six required fields, five distinct evidence statesplanned/passing/failing/stale/accepted_residual,is_uncovered_blocker()gate helper).ledger_format.py— deterministic markdown table + compact summary,max_rows-bounded for the token budget.ledger_validation.py— load/validate envelope with stablekinds.sumo_qa_format_risk_ledger— a read-only MCP tool. No risk inference — the host identifies the risks; the tool only validates and renders them. Tools-list snapshot regenerated.preparing-for-work/reviewing-before-merge/creating-test-plan/finishing-qa-workskills; the review gate requiresuncovered_blocker_count == 0before SAFE. Plusdocs/RISK-LEDGER.mdand 2 promptfoo evals.Tests: full suite 1342 passed, 100% coverage. Both new evals PASS.
Review:
sumo-qa-reviewing-before-merge→ SAFE (all named risks covered with fresh path-matching tests). Codex adversarial review rounds 1–2 found and fixed 6 real defects: markdown-injection via unescaped newlines (closed for the full Unicode line/paragraph/vertical separator class), negativemax_rowsslicing,truncated-flag accuracy on empty ledgers, andschema_versionmis-classification.A further
sumo-qa-reviewing-before-mergepass caught one more real defect: the optionalRepo-map nodecolumn stripped the trailing table delimiter without re-adding it, rendering a ragged 6-vs-7-cell table on the documented repo-map path (#154). Fixed inccf9836with a cell-count regression test (the prior tests asserted only substring presence), hardened inad13421to split on unescaped delimiters and exercise the escape path alongside the new column. Also de-specified the surviving hand-written tool-count prose indocs/ARCHITECTURE.md/docs/INSTALL.mdto capability altitude (the #256 policy). The Codex P2 thread that first flagged the delimiter bug is resolved.A superpowers code review of the post-fix diff returned APPROVE, with the regression test empirically proven to fail on the pre-fix code.