Skip to content

Add Responsible AI end-to-end tests and fixtures - #138

Merged
vsn411 merged 1 commit into
secfoo-com:mainfrom
Arush-Banerjee:test/responsible-ai-e2e-132
Nov 17, 2026
Merged

vsn411 merged 1 commit into
secfoo-com:mainfrom
Arush-Banerjee:test/responsible-ai-e2e-132

Conversation

@Arush-Banerjee

Copy link
Copy Markdown
Contributor

Fixes #132

Adds end-to-end tests for the Responsible AI chain, from a real-shaped report
through the CLI, the --json document and the dashboard. Test and fixture files
only; no changes under src/.

What's added

Fixtures (tests/fixtures/reports/):

  • responsible-ai-compliance.md (Low), -medium.md, -high.md
  • Each follows the skill's output contract: summary with the overall rating,
    findings register, six ### [Sev] Fn: findings, coverage notes.

tests/test_responsible_ai_end_to_end.py:

  • secfoo run --skill responsible-ai-compliance --agent claude --json through
    fake_popen, for each tier: JSON severity counts, an auto-created assessment
    with the right responsible_ai_risk, and assessment show printing
    Responsible AI: low-risk (provisional).
  • Each rating maps to its own tier (low-risk / moderate / high-risk).
  • Dashboard on the same store: /responsible-ai badge class and counts, overview
    "Responsible AI coverage", /activities/responsible-ai-compliance (1 project,
    1 run, 6 findings), /assessments list and detail badges.
  • provisional -> confirmed from the bulk-status form and from
    secfoo assessment update --status completed; reopening returns it to
    provisional; deleting the assessment removes it from the page and the count.
  • Most-recent-run semantics: the badge follows the newest successful run
    (Low then High, High then Low, High then Medium); a failed newer run does not
    change it.
  • secfoo run --assessment <id> attaches to an existing case file and updates
    its badge without creating a second one.
  • Badge derivation edge cases: missing report file, empty report path.

tests/test_skills/test_loader_renderer.py:

  • The brief for this skill contains all seven dimensions and the severity
    rubric text, so editing the skill file cannot silently drop one.

Verification

  • Coverage of web/routes/responsible_ai.py and RunRepository._responsible_ai_badges
    is 100% (line and branch).
  • Confirmed the new tests fail if the rating mapping regresses: collapsing every
    rating to one tier fails 12 tests; making the oldest run win fails 3.
  • ruff check passes on the new and changed test files.

Notes

  • The fixtures are written to the output contract, not captured from a live
    run. I can re-seed the Low fixture from a real run against
    openai/openai-quickstart-python if you would like that; the counts in the
    TIERS table at the top of the test file would be adjusted to match.
  • secfoo assessment list has no Responsible AI column today, so its test
    checks that the auto-created case file appears with its findings counts. The
    rating is covered on assessment show and in the web list. If you want a
    column in the CLI list, I can add it as a follow-up.
  • Running the full suite locally on Windows, 11 unrelated tests fail (Unix file
    modes, SIGTERM/SIGKILL handling, git path handling in skill packs, a
    Hypothesis timing health check and a probe overhead budget). None touch this
    change; the new tests pass.

@vsn411
vsn411 merged commit d421541 into secfoo-com:main Nov 17, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown

Leaderboard update

Arush-Banerjee now has 6 points (rank #5). 19 more to reach Bronze.

Full leaderboard

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.

Responsible AI: end-to-end tests from a real-shaped report to the CLI, JSON and dashboard

2 participants