Fix compare intersection bug and add exclude_attrs support#151
Merged
villelaitila merged 1 commit intosoftagram:mainfrom Apr 1, 2026
Merged
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
compare_attrs()inattributecomparison.pycomputed intersection incorrectly —set.intersection()returns a new set but the result was never assigned, sointersectionwas always equal tokeys1. This caused "only in A" attributes to never be reported and incorrect handling of shared attributes. Fixed with&operator.ignoredAttrs, preventing ignored attributes from appearing in change output.exclude_attrsparameter oncompare()andcompareModels()allows callers to suppress noisy attributes (e.g. time-windowed metrics) during comparison.SLIDING_WINDOW_ATTRSconstant incompareutils.pyfor common time-windowed metric attributes.Test plan
test_compare_attrs_intersection_correctness— regression test for the intersection bugtest_compare_attrs_ignored_attrs_excluded_from_only_in— ignored attrs filteringtest_exclude_attrs_in_compareModels— exclude_attrs suppresses specified attributestest_exclude_attrs_restores_ignoredAttrs— global state is restored after comparisontest_sliding_window_attrs_preset— SLIDING_WINDOW_ATTRS content validation