Skip to content

feat: -sort orders inspect layouts by struct size#37

Open
peczenyj wants to merge 2 commits into
develfrom
feature/sort-inspect
Open

feat: -sort orders inspect layouts by struct size#37
peczenyj wants to merge 2 commits into
develfrom
feature/sort-inspect

Conversation

@peczenyj
Copy link
Copy Markdown
Owner

Extends -sort (added for diff in #36) to inspect mode: layouts across all scanned packages are collected and ordered largest-first by Layout.Total (stable sort). Help text now reads "diff: by bytes saved; inspect: by struct size". Diff behavior is unchanged.

While testing this I found that inspect's default order is alphabetical (layout.Layouts does sort.Strings), so the test fixture uses Alpha (24B) / Zeta (40B) where alphabetical and size-descending genuinely differ — otherwise the sort would be untestable.

Tests: -inspect -sort renders the larger struct first; default inspect order (alphabetical) is unchanged. task ci green (91 tests).

⚠️ Stacked on #36 (base feature/sort-diff) to keep moving during the GitHub Actions incident. I'll retarget the base to devel once #36 merges. Closes #30 (the -sort feature, both modes).

Closes #30

🤖 Generated with Claude Code

peczenyj and others added 2 commits May 26, 2026 14:21
-sort (default off) collects findings across all scanned packages and
presents them largest-first by absolute bytes saved (OldSize-NewSize),
using a stable sort so equal-savings structs keep source order and
unknown-size findings sink to the bottom. Diff mode only for now; inspect
support follows.

Part of #30

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
In -inspect mode, -sort now collects all layouts across packages and
orders them largest-first by Layout.Total (stable sort). Updates the flag
help to cover both modes. Diff behavior unchanged.

Closes #30

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@peczenyj peczenyj self-assigned this May 26, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.55%. Comparing base (dc3da22) to head (e7748d8).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           feature/sort-diff      #37      +/-   ##
=====================================================
+ Coverage              85.45%   85.55%   +0.10%     
=====================================================
  Files                     10       10              
  Lines                    708      713       +5     
=====================================================
+ Hits                     605      610       +5     
  Misses                    65       65              
  Partials                  38       38              

☔ View full report in Codecov by Sentry.
📢 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.

@peczenyj peczenyj changed the base branch from feature/sort-diff to devel May 26, 2026 13:58
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