Skip to content

Validate feature-name counts and add public API contract tests - #609

Merged
imatiach-msft merged 1 commit into
mainfrom
fix/api-contract-feature-validation-108-91
Nov 6, 2026
Merged

imatiach-msft merged 1 commit into
mainfrom
fix/api-contract-feature-validation-108-91

Conversation

@imatiach-msft

@imatiach-msft imatiach-msft commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #108.
Closes #91.

  • Add introspection-based API contract tests for nine explainers and seven explanation classes, pinning parameter order and separating public methods, properties, and other class attributes.
  • Validate explicit feature-name counts at initialization and evaluation boundaries, against the original input before transformation or subsetting.
  • Preserve inferred names, index handling, reused dataset wrappers, legacy serialization, and supported SHAP statistical/masker backgrounds. Read width metadata without materializing DataFrames unnecessarily.

Validation

python tests\run_tests.py --compatibility-only -q:

Environment Result
Python 3.14 / SHAP 0.54.1 198 passed
Python 3.11 / SHAP 0.48.0 / NumPy 2.0.2 with CI minimum dependency constraints 192 passed, 6 skipped
Python 3.10 / SHAP 0.46.0 192 passed, 6 skipped

The six older-SHAP skips cover bare statistical dictionaries that upstream SHAP does not support. Tests probe upstream support; interpret-community failures are not suppressed.

  • 29 existing index, datetime, summarized-background, subset, and transformation integration tests passed.
  • Changed-file isort and flake8 checks, plus git diff --check, passed.
  • Mutation checks verified that feature-validation and API-contract regressions fail the new tests.
  • Successful Deep/GPU integrations were not run locally; malformed inputs are validated before backend initialization.
  • All 16 GitHub checks passed on the single signed-off commit 69202f1: full Python 3.10-3.14 tests, all four NumPy compatibility jobs, dashboard, lint, CodeQL/code scan, DCO, and both Codecov checks. The initial partial-coverage failures cleared after the unit-test coverage upload.

Recursive review

Eight independent full-diff rounds used GPT-6.1 Sol, Claude Sonnet 5.5, and Grok 4.7, each explicitly requesting maximum reasoning. Runtime-reported models matched; effective reasoning effort was not separately reported. All three final reviewers reported no actionable findings.

One documented concern was rejected: preserving incidental acceptance of None/list initialization backgrounds with explicit names is outside TabularExplainer's documented ndarray/DataFrame/csr input contract.

Final review status: clean with documented rejected findings.

Fixes #108
Fixes #91

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ff75bdc-6085-443a-985f-94c5df7086a0
Signed-off-by: Ilya Matiach <ilmat@microsoft.com>
@imatiach-msft
imatiach-msft force-pushed the fix/api-contract-feature-validation-108-91 branch from b5e19df to 69202f1 Compare November 6, 2026 16:54
@codecov

codecov Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.34%. Comparing base (1c9d179) to head (69202f1).

Files with missing lines Patch % Lines
python/interpret_community/dataset/decorator.py 97.67% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
+ Coverage   88.07%   88.34%   +0.26%     
==========================================
  Files          59       59              
  Lines        4077     4127      +50     
==========================================
+ Hits         3591     3646      +55     
+ Misses        486      481       -5     
Flag Coverage Δ
dashboard 42.64% <71.69%> (+0.33%) ⬆️
unittests 87.61% <98.11%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@imatiach-msft
imatiach-msft merged commit 988b643 into main Nov 6, 2026
16 checks passed
@imatiach-msft
imatiach-msft deleted the fix/api-contract-feature-validation-108-91 branch November 6, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

API testing features length isn't validated against data

1 participant