Skip to content

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

Closed

Description

@vsn411

Problem: The Responsible AI path had one storage test and one route test, both using a four-line report that says "High", which is why a Low rating rendering as "moderate" (PR #130) went unnoticed until a manual run. Nothing tests the chain the way a user hits it: secfoo run --skill responsible-ai-compliance auto-creating an assessment, the report being parsed, the rating reaching /responsible-ai, /assessments/<id>, secfoo assessment show and secfoo assessment list, the --json document, the overview's "Responsible AI coverage" count, and the provisional → confirmed transition from the dashboard's bulk-status form as well as the CLI.

Build:

  1. A fixture report under tests/fixtures/reports/responsible-ai-compliance.md with the real shape (summary with rating, register, six findings with ### [Low] Fn: headings, coverage notes), seeded from a real run against openai/openai-quickstart-python; add Medium and High variants.
  2. End-to-end CLI test: CliRunner runs secfoo run --skill responsible-ai-compliance --agent claude --json with fake_popen returning the fixture as the agent's stdout; assert the JSON severity counts, that an assessment was auto-created with the right responsible_ai_risk, and that assessment show prints Responsible AI: low-risk (provisional).
  3. Dashboard tests on the same store: /responsible-ai lists the assessment with the right badge class and counts; / shows coverage 1; /activities/responsible-ai-compliance shows 1 project, 1 run, 6 findings; the bulk-status POST to completed turns the rating confirmed; deleting the assessment removes it from the page and the count.
  4. Most-recent-run semantics: two runs on one assessment (Low then High) → the badge follows the newest successful run; a failed newer run does not change it.
  5. Renderer test: the brief for this skill contains all seven dimensions and the severity rubric text, so a future edit of the skill file cannot silently drop one.
  6. Attached runs: secfoo run --assessment <id> attaches to an existing case file and updates its badge.

Where to look: tests/test_cli.py (test_run_command_does_not_warn_when_responsible_ai_*), tests/test_web/test_assessment_routes.py (client, _create_assessment, the Responsible AI tests), tests/test_storage/test_assessments.py, tests/conftest.py (fake_popen), src/secfoo/storage/repository.py (_responsible_ai_badges), src/secfoo/web/routes/responsible_ai.py, src/secfoo/skills/definitions/responsible-ai-compliance.md.

Done when: the fixture-driven end-to-end test and the dashboard tests pass in pytest tests; coverage of web/routes/responsible_ai.py and the badge derivation is 100%; the tests would fail if the rating mapping regressed to a single tier.

Activity

  1. added
    enhancement
    good first issue
    help wanted
    hackathon
    difficulty: medium
    on Nov 15, 2026
  2. Arush-Banerjee commented on Nov 17, 2026

    @Arush-Banerjee
    Contributor

    I'd like to take this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumenhancementgood first issuehackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions