fix: get_benchmark_results rejects a filter on a column the chosen kind lacks - #531
Merged
yakew7 merged 1 commit intoSep 9, 2026
Conversation
_get_benchmark_results_impl silently dropped a filter that named a column absent from the selected kind's CSV (results_performance.csv has no protected_attribute column), so `kind="performance", protected_attribute= "gender"` returned the entire unfiltered 315-row table with nothing in the response signalling the filter was ignored. It now raises ValueError in that case, consistent with profile_dataset/compare_datasets rejecting an `overrides` column that isn't in the dataset. The only reachable case is protected_attribute against kind="performance"; audit/strategy/model/metric exist in both frozen CSVs. Closes yakew7#512 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
|
@propcgamer20-png is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
_get_benchmark_results_impl(faircode/mcp_server.py) silently no-ops a filter whose column isn't in the selectedkind's CSV.results_performance.csvhas noprotected_attributecolumn, so:The caller asked for gender-specific performance numbers and got the whole unfiltered table back, with no way to tell from the response that the filter was dropped. A bogus value on a real column correctly returns
total_matches: 0, so the tool already distinguishes "no match" from "filter applied" - just not "filter targets a column this kind doesn't have".Fix
Raise
ValueErrorwhen a non-None filter names a column absent from the selected kind's CSV - the same contractprofile_dataset/compare_datasetsuse for anoverridescolumn that isn't in the dataset:audit,strategy,model,metricexist in both frozen CSVs, so the only reachable case isprotected_attributevskind="performance". Docstring updated.Tests
test_get_benchmark_results_performance_kind_ignores_protected_attribute_filter(which asserted the silent-ignore behavior) is replaced bytest_get_benchmark_results_rejects_filter_on_column_absent_from_kind, which checks the raise forperformanceand that the same filter still works againstfairness.pytest tests/test_mcp_server.py-> 57 passed, 1 failed. The failure (test_get_explainer_returns_content_and_metadata) is pre-existing onmainon this platform (a\vs/path check in_get_explainer_impl) and unrelated to this change.ruffclean.Closes #512
🤖 Generated with Claude Code