Repository navigation
fix(responsible-ai): add assessment list column, id DESC tie-breaker, and real-run E2E fixtures (#140) - #144
Merged
Conversation
… and real-run E2E fixtures (secfoo-com#140)
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.
PR Draft: Responsible AI tests, fixtures, tie-breaker, and
assessment listcolumnIssue: #140
Branch:
fix/issue-140Root Cause & Motivation
secfoo assessment listomitted Responsible AI status:RunRepositorycomputedresponsible_ai_riskandresponsible_ai_status, andassessment showprinted them, butassessment_listinsrc/secfoo/cli.pyhad noResponsible AIcolumn._responsible_ai_badgesinsrc/secfoo/storage/repository.pyordered only bystarted_at DESC LIMIT 1, so back-to-back runs within the same timestamp could resolve to the older run (id ASCscan order).tests/fixtures/reports/responsible-ai-compliance*.mdwere hand-written with internal contradictions, lacked aCriticalfixture and a fixture where overall rating differs from worst finding severity,test_reopening_a_completed_assessment_makes_the_rating_provisional_againdid not verify the intermediateconfirmedstate, assessment-page badge checks only coveredlowwith a blanket"moderate" not in htmlcheck, and_statwas brittle to extra classes or inlineinfo_tipmarkup.Summary of Changes
src/secfoo/storage/repository.py: Added, id DESCtie-breaker to_responsible_ai_badges'sORDER BY started_at DESC, id DESC LIMIT 1query.src/secfoo/cli.py: Added theResponsible AIcolumn toassessment_list(<tier> (<status>), or-when unrated).tests/fixtures/reports/:responsible-ai-compliance.mdwith the real Claude--depth quickreport onopenai/openai-quickstart-python.responsible-ai-compliance-medium.mdandresponsible-ai-compliance-high.mdas coherent variants derived from the real report.responsible-ai-compliance-critical.md(Overall risk rating: Critical, 1C 2H 2M 1L) andresponsible-ai-compliance-medium-with-high-finding.md(Overall risk rating: Mediumwith 1 High finding).tests/test_responsible_ai_end_to_end.py:criticaltier toTIERSand updatedHigh-riskstat assertion (risk == "high-risk").test_overall_rating_is_independent_of_worst_findingandtest_the_badge_breaks_equal_timestamp_ties_in_favor_of_the_latest_run.test_assessment_list_shows_the_auto_created_case_file_with_its_findingsto verify theResponsible AIcolumn for both rated (low-risk (provisional)) and unrated (-) assessments.test_reopening_a_completed_assessment_makes_the_rating_provisional_againto assert both303redirects and the intermediateResponsible AI: low-risk (confirmed)state.test_assessment_pages_show_the_tier_badgeover all tiers using exact badge element checks, and updated_statto tolerate extra classes and<details class="info-tip">inside labels.tests/test_cli_assessment.py: Passedenv={"COLUMNS": "200"}toassessment listinvocations so Rich does not truncate project/type cells after adding the 8th column.Verification
.venv/bin/pytest tests/test_responsible_ai_end_to_end.py tests/test_cli_assessment.py -v-> 42 passed.venv/bin/pytest tests/test_responsible_ai_end_to_end.py tests/test_cli_assessment.py tests/test_storage/test_assessments.py tests/test_web/test_assessment_routes.py -v-> 146 passed.venv/bin/ruff check tests/test_responsible_ai_end_to_end.py tests/test_cli_assessment.py-> All checks passedPush Instructions
cd /Users/ankitkumarmishra/Downloads/Github/repos/secfoo git push -u origin fix/issue-140Then open a PR targeting
secfoo-com/secfoo:mainreferencingCloses #140.