← Back to Pull requests

feat: select all cards matching a filter #65

Open
unknown opened this pull request with 516 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 30, 2026 07:56 UTC
Author

Summary

Move now takes a filter instead of Card ids, and a banner in selection mode switches to it.

CollectionEntries (selection mode)
  banner "Select all N matching this filter"   # shown when total > loaded
    -> allMatching = true                      # replaces the ticked Cards
  CollectionMoveBar
    confirm dialog
      GET /collections/{id}/entries/count      # server counts cards and copies
      POST /collections/{id}/entries/move { destinationId, filter }

 POST /collections/{id}/entries/move
-  { destinationId, cardIds[1..100] }
+  { destinationId, cardIds[1..100] }   # or
+  { destinationId, filter: {name, expansionSetIds, localId, rarityIds, categories, tags} }
+GET /collections/{id}/entries/count    # same filter as the list -> { cards, copies }

  • cardIds and filter are mutually exclusive (400 for both or neither). filter: {} means every entry the Collection's list shows.

  • With a filter, Move resolves the matching entries inside the existing transaction, then runs the unchanged Move logic (merge, capacity refusal, binder source, binder destination refusal).

  • The banner shows in selection mode whenever the filter has more results than are loaded, with no ticks needed. The ticket said "after the page's cards are selected", but a 100-card page cannot be fully ticked once page 2 loads. The ticket text is updated.

  • Changing the filter, leaving selection mode, or changing the filter under an open sheet or dialog clears or closes the filter selection.

  • use-quantity-batch.ts: flush() now retires only the flushed Cards' failures (it cleared all). A filter Move is blocked by any failed quantity edit, and an ids Move is now also blocked by an unresolved failed edit on a selected Card.
  • Evidence

  • Before: Move took 1 to 100 Card ids only. Moving every MA5 card out of a Collection holding MA5 and MA6 meant ticking each card.

  • After:

    test: move by filter, Collection holds two Expansion Sets
      POST move { filter: { expansionSetIds: [MA5] } }
      -> only MA5 entries leave, every copy; MA6 stays
    test: move by filter past 100 entries        -> all move
    test: ids and filter together / neither      -> 400
    test: filter move over capacity              -> refused, nothing changed
    test: banner with 200 of 250 loaded          -> "Select all 250 matching this filter", no ticks
    test: confirm dialog, count pending          -> Confirm disabled; 37 cards, 64 copies when it resolves
    test: cancel, reopen, next count pending     -> no stale "Move 37 cards" (failed before the fix)
    

  • Backend go test -race ./... passes against a pgvector Postgres container. scripts/verification/frontend.sh passes (753 tests).

  • Not run: golangci-lint (snap permission error in my sandbox), and no real-browser (Playwright) check.
  • Merge Danger

    Door: two-way

    Additive API: a new optional body field, a new read endpoint, and cardIds no longer required in the schema. A bad merge reverts cleanly. A Move itself has no undo, as before.

    Blast Radius: Move

    An existing client sending cardIds is unchanged. A filter Move loads every matching entry's Card row in one transaction, so a very large Collection costs more. The binder Slot clear takes the whole id list in one IN, which is fine at binder sizes. The flush() change also touches the quantity editor in Inventory and Collections, where a failed edit now stays flagged until its Card is edited again.

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Select all cards matching the current filter, including results on pages that haven’t been loaded, and move them to another collection.
    Review the matching card and copy totals before confirming a filter-based move.
    Count cards and copies in a collection, with optional catalog filters.
    Bug Fixes
    Filter-based selection clears when the filter changes, and moves are blocked when relevant quantity edits fail to save.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 516 lines (+387 / -129) across 6 files Reviewer: coderabbitai[bot] Review duration: 9m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.53) × (1 − Review Confidence (0.39)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.53 · 516 lines diff across 6 files
    0.53
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 70% · Reviewer familiarity: 35%
    39%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.374
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #65"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 39.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.7% (MEDIUM) · Higher = larger blast radius
    52.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 39.3% · Lower = rushed or shallow review
    39.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 32.0% · Safe to merge
    32.0%