Skip to content

Add exclude_attrs support to ModelCompare and fix set intersection bug#150

Merged
villelaitila merged 1 commit intosoftagram:mainfrom
villelaitila:The_truth_is_rarely_pure_and_never_simple____Oscar_Wilde
Mar 28, 2026
Merged

Add exclude_attrs support to ModelCompare and fix set intersection bug#150
villelaitila merged 1 commit intosoftagram:mainfrom
villelaitila:The_truth_is_rarely_pure_and_never_simple____Oscar_Wilde

Conversation

@villelaitila
Copy link
Copy Markdown
Contributor

Summary

  • Fix critical bug in attributecomparison.py: set.intersection() was called without assignment, so the intersection variable always equaled keys1 — meaning attributes only in model A were never reported as added/removed.
  • Fix keys-only filtering: attributes in ignoredAttrs were still leaking into "only in A/B" diffs.
  • Add exclude_attrs parameter to ModelCompare.compare() and compareModels() for suppressing noisy time-windowed metrics (author counts, commit counts, etc.) during comparison.
  • Add SLIDING_WINDOW_ATTRS preset in compareutils.py — a ready-made set of ~60 sliding-window metric attribute names.
  • Improve docstrings for SElement, SElementAssociation, and ModelCompare.
  • Add 5 new tests covering intersection correctness, ignored attrs exclusion, exclude_attrs behavior, cleanup/restore, and the preset constant.

Test plan

  • All 6 tests in tests/compare/modelcompare_tests.py pass
  • Verify with real production models that sliding window noise is suppressed

- 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.
@softagram-bot
Copy link
Copy Markdown

Looking good 🎉

See the full Softagram report

@villelaitila villelaitila merged commit cd4fa94 into softagram:main Mar 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants