fix: two manifest validation gaps (single-list NaN handling, RowFilter operator) - #559
Merged
yakew7 merged 1 commit intoSep 10, 2026
Merged
Conversation
…r operator) yakew7#547: ProtectedAttribute.disadvantaged_mask's single-list branches (only disadvantaged_values OR only advantaged_values given) hardcoded known_mask = True for every row, so a NaN in the column was not excluded and got silently routed to whichever side isin() landed it on. The both-lists branch, numeric_threshold, and age_interval_threshold all correctly exclude unclassifiable rows via known_mask. Benefits Denial's audit.yaml uses the single-list pattern for race and national_origin, so a real missing value there would corrupt the fairness gap instead of being dropped. known is now col.notna() in both single-list branches. yakew7#549: RowFilter had no __post_init__, unlike its sibling dataclasses TargetSpec and ProtectedAttribute. A row_filters entry with `column` set but no operator (isin / not_isin / equals / not_equals / notna) silently kept every row. MANIFEST_SPEC.md documents "exactly one of the operators below" as required. Added __post_init__ raising ValueError when none is set, matching the validation style already used in the sibling classes. Closes yakew7#547 Closes yakew7#549
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.
#547 -
disadvantaged_masktreats NaN as "known" in the single-list branchesProtectedAttribute.disadvantaged_mask's branches for "onlydisadvantaged_values" or "onlyadvantaged_values" given hardcodedknown = pd.Series(True, index=df.index). ANaNin the column matches neitherisin()nor its complement, so it was silently classified to one side instead of excluded - contradicting the module's own docstring and inconsistent with the both-lists branch,numeric_threshold, andage_interval_threshold, which all exclude unclassifiable rows viaknown_mask.Benefits Denial/audit.yamluses the single-list pattern forraceandnational_origin, so a real missing value there would corrupt the fairness gap. Fix:known = col.notna()in both single-list branches.#549 -
RowFilterhas no validation that an operator is setUnlike
TargetSpecandProtectedAttribute(which validate required companion fields in__post_init__),RowFilterhad none. A block withcolumnset but no operator silently kept every row:MANIFEST_SPEC.mddocuments "exactly one of the operators below" as required. Added__post_init__raisingValueErrorwhen none ofisin/not_isin/equals/not_equals/notnais set.Tests
test_categorical_single_list_excludes_nan_via_known_mask(parametrized over both single-list branches)test_row_filter_needs_at_least_one_operatorpytest tests/test_manifest.py-> all pass (33 -> 36), includingtest_every_shipped_manifest_loads_without_error(no shippedaudit.yamlhas an operator-less filter).ruffclean. The 3tests/test_benchmark.pyfailures are pre-existing onmainon this platform (manifest-error-wrapping path checks) and unrelated.Closes #547
Closes #549