Skip to content

fix(redteam): footnote when --attacks count diverges from summary#220

Merged
cdot65 merged 1 commit into
mainfrom
cdot65/fix/redteam-attacks-divergence-footnote
May 28, 2026
Merged

fix(redteam): footnote when --attacks count diverges from summary#220
cdot65 merged 1 commit into
mainfrom
cdot65/fix/redteam-attacks-divergence-footnote

Conversation

@cdot65

@cdot65 cdot65 commented May 28, 2026

Copy link
Copy Markdown
Owner

Summary

CLI footnote workaround for upstream aggregator divergence — not a server-side reconciliation.

  • airs redteam report <jobId> --attacks --severity X now prints a dimmed one-line footnote when list-attacks returns fewer items than the summary severity breakdown promised for X. Example: summary says 109 CRITICAL, list returns 19 → footnote (showing 19 of 109 expected for severity CRITICAL — list-attacks endpoint excludes some variants; tracking upstream divergence at #206).
  • No extra API calls: getStaticReport(jobId) already runs above the --attacks branch, so severityBreakdown is free.
  • Reshapes internal service.listAttacks() from Promise<RedTeamAttack[]> to Promise<{ attacks; totalItems? }> to surface pagination.total_items. Only internal caller (the report command) updated.
  • New pure helper buildAttackListFootnote() exported from the renderer module — unit-testable in isolation.
  • No footnote when: no --severity filter, no matching breakdown row, totalItems unknown, or counts agree.
  • CUSTOM jobs unaffected (different code path).

Test plan

  • RED: 12 new/updated failing tests across buildAttackListFootnote (5), listAttacks normalizer shape (5 reshape + 2 pagination), renderer footnote (1)
  • GREEN: 693/693 tests pass
  • pnpm lint clean
  • pnpm tsc --noEmit clean
  • pnpm test 693 passed
  • pnpm docs:check clean

Closes #206

When `airs redteam report <jobId> --attacks --severity X` returns fewer
items than the summary breakdown row for X promised, print a one-line
dimmed footnote so operators know the gap is upstream-driven (server-side
list-attacks aggregator excludes some variants) rather than a CLI bug.

Reshapes the internal `listAttacks()` return from `RedTeamAttack[]` to
`{ attacks, totalItems? }` so we can surface `pagination.total_items`.
The footnote logic lives in a pure helper `buildAttackListFootnote()`
that's unit-testable in isolation.

Closes #206
@cdot65 cdot65 merged commit 82f6f5c into main May 28, 2026
5 checks passed
@cdot65 cdot65 deleted the cdot65/fix/redteam-attacks-divergence-footnote branch May 28, 2026 02:10
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.

redteam report --attacks: pagination.total_items doesn't match summary breakdown

1 participant