Add exclude_attrs support to ModelCompare and fix set intersection bug#150
Merged
villelaitila merged 1 commit intosoftagram:mainfrom Mar 28, 2026
Conversation
- Fix attributecomparison.py: set.intersection() was called without assignment, so intersection was always equal to keys1. Use & operator. - Fix keys-only-in-A/B filtering to properly exclude ignoredAttrs. - Add exclude_attrs parameter to compare() and compareModels() for suppressing noisy time-windowed metrics during comparison. - Add SLIDING_WINDOW_ATTRS preset in compareutils.py. - Improve docstrings for SElement, SElementAssociation, and ModelCompare. - Add comprehensive tests for the new functionality. - Document model comparison workflow in CLAUDE.md.
Looking good 🎉
|
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.
Summary
attributecomparison.py:set.intersection()was called without assignment, so the intersection variable always equaledkeys1— meaning attributes only in model A were never reported as added/removed.ignoredAttrswere still leaking into "only in A/B" diffs.exclude_attrsparameter toModelCompare.compare()andcompareModels()for suppressing noisy time-windowed metrics (author counts, commit counts, etc.) during comparison.SLIDING_WINDOW_ATTRSpreset incompareutils.py— a ready-made set of ~60 sliding-window metric attribute names.SElement,SElementAssociation, andModelCompare.Test plan
tests/compare/modelcompare_tests.pypass