Skip to content

Hero lost its default weight-desc ranking in the row-model migration #337

Description

@blove

HeroGrid used to rank the book by live weight before handing rows to the grid. #321 migrated it to the model prop and stopped rendering that ranked array — the grid now draws rows in arrival order and never re-ranks, while the local applySort/rankRows path kept running and feeding only the selection summary (removed in #336).

Measured live on a production build, visible weights top to bottom after ~8s of ticking:

16.4, 9.7, 8.2, 5, 4.3, 7, 4.5, 3.7, 3.9, 1.7, 3, 4.6     (4 inversions)

The design spec calls for "Default sort: weight desc (largest positions first), user column-header clicks override" — docs/superpowers/specs/2026-06-09-pms-hero-demo-design.md.

Why this wasn't fixed in #336: the obvious fix is to seed the row model's query with sort: [{ columnId: "weight", direction: "desc" }] and let the engine own the order. But weights tick continuously, so the engine would re-rank on every tick and rows would visibly churn on the homepage — plausibly worse than a stable, unranked book. The original spec anticipated occasional rerank events rather than per-tick reordering, which suggests the recording, not the query, may be the right lever.

That is a product call about how much the hero should move, so it wants a decision before an implementation.

Also blocked on this: apps/website/app/components/heroGrid/sort.ts is now unreferenced by app code (its unit tests still run). It is either the basis of the fix or it should be deleted — that follows from whatever is decided here.

Activity

  1. blove commented on Aug 12, 2026

    @blove
    ContributorAuthor

    Decision (Brian, 2026-08-12): the engine owns the sort, and rows re-rank live.

    Seed the row model's query with sort: [{ columnId: "weight", direction: "desc" }] and let it re-rank as weights tick. The churn is accepted — one order, owned by one thing, matching the spec's "largest positions first". A user header click overrides as it does today.

    Follow-ons that come with it:

    • apps/website/app/components/heroGrid/sort.ts and its unit tests become dead — delete them rather than leaving a second, divergent ordering implementation on disk. That duplication is what made the selection-summary bug (Unblock CI, and put the hero's selection summary back on the drawn grid #336) possible.
    • Decide what an explicit un-sort should do. With the engine owning order, clearing the sort falls back to arrival order rather than weight-desc; if that reads as a bug, the fix is to re-apply the default instead of an empty sort list.
    • Re-check the hero e2e that asserts row-drift and stable row identity under streaming — live re-ranking moves rows by design, and those assertions were written when the drawn order was fixed.
  2. added a commit that references this issue on Aug 13, 2026
    4cc7768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions