Skip to content

fix(browser): restore card-mode order_value caption for mixed-children groups#762

Merged
ajslater merged 1 commit into
developfrom
claude/objective-shirley-c5eec2
May 11, 2026
Merged

fix(browser): restore card-mode order_value caption for mixed-children groups#762
ajslater merged 1 commit into
developfrom
claude/objective-shirley-c5eec2

Conversation

@ajslater
Copy link
Copy Markdown
Owner

Summary

  • The browser table-view PR (#745) routed group-row scalar / M2M sort through scalar_intersection_sort_expr / m2m_intersection_sort_expr for every view mode. Intersection returns NULL when a group's children disagree on the sorted field — correct for table view (sort matches the intersection cell display) but it blanks the order_value caption beneath cover-mode cards for any group with mixed children. The user reported this for Publish Date across publishers, series, and folders.
  • Gate the intersection branch on view_mode == "table" in _group_scalar_order_value and _group_m2m_order_value so cover mode falls back to the pre-table-view aggregate (Min/Max/Avg/Sum) for scalars and sort_name for M2M.
  • Add a regression test that reproduces the reported scenario: a "Mixed" series whose children disagree on year used to return orderValue: null; now it returns the Min aggregate.

Why

In cover mode, order_value is the caption rendered beneath each browser card. The intersection rule is correct for table view (cell display matches sort) but is the wrong rule for cover view, where the caption is meant to show the aggregated value the rows are sorted by — Min(year) for ASC, Max(year) for DESC, etc. The table-view PR didn't gate by view mode, so cover-mode users started seeing blank captions for any mixed-children group.

The _extra_group_expr path that also uses these intersection expressions is already correctly gated behind _should_annotate_extras (which checks view_mode == "table"), so no change is needed there.

Test plan

  • Added test_cover_mode_group_order_value_uses_aggregate — verified it fails on the pre-fix code (Mixed series → orderValue=None) and passes after the fix (Mixed → "2018").
  • Existing test_year_sort_matches_intersection_display still passes (table-mode behavior unchanged).
  • All 62 tests in tests/test_browser_ordering.py pass.
  • tests/test_browser_table_response.py, tests/test_browser_columns_registry.py, tests/test_browser_settings_table.py all pass (84 tests).
  • make lint clean.
  • make ty clean.

🤖 Generated with Claude Code

…n groups

The browser table-view PR (#745) routed group-row scalar / M2M sort
through ``scalar_intersection_sort_expr`` / ``m2m_intersection_sort_expr``
for every view mode. Intersection returns NULL when a group's children
disagree on the sorted field, which is correct for table view (sort
matches the intersection cell display) but blanks the order_value
caption beneath cover-mode cards for any group with mixed children.
The user reported this for Publish Date across publishers, series,
and folders.

Gate the intersection branch on ``view_mode == "table"`` so cover
mode falls back to the pre-table-view aggregate (Min/Max/Avg/Sum)
for scalars and ``sort_name`` for M2M.

Regression test reproduces the user's scenario: a "Mixed" series
with children at year=2018 and year=2024 returned orderValue=null
before; now returns "2018" (Min aggregate).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ajslater ajslater merged commit 12dbb4f into develop May 11, 2026
3 checks 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.

1 participant