Skip to content

ship/sealed pack opening - #7149

Merged
matthewevans merged 5 commits into
mainfrom
ship/sealed-pack-opening
Aug 10, 2026
Merged

ship/sealed pack opening#7149
matthewevans merged 5 commits into
mainfrom
ship/sealed-pack-opening

Conversation

@matthewevans

@matthewevans matthewevans commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added Sealed draft mode with sequential pack opening, progress tracking, card previews, and deckbuilding transition.
    • Added sealed-draft access from the landing page and support for resuming pack-opening sessions.
    • Added grouped pool views with sorting by color, card type, and mana value, including duplicate counts and color totals.
  • Localization
    • Added translations for Sealed mode and pool-opening workflows across supported languages.
  • Bug Fixes
    • Corrected draft progress indicators during the pack-opening phase.

@matthewevans
matthewevans enabled auto-merge August 10, 2026 02:46
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@matthewevans, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c8917c4d-776f-409c-af14-a3f28282cb62

📥 Commits

Reviewing files that changed from the base of the PR and between 513f532 and 851132d.

📒 Files selected for processing (8)
  • client/src/adapter/draft-adapter.ts
  • client/src/components/draft/PoolPanel.tsx
  • client/src/components/draft/SealedPackOpening.tsx
  • client/src/components/draft/__tests__/SealedPackOpening.test.tsx
  • client/src/components/draft/poolGroupLabels.ts
  • client/src/network/__tests__/draftProtocol.test.ts
  • crates/draft-core/src/view.rs
  • crates/server-core/src/protocol.rs
📝 Walkthrough

Walkthrough

The draft engine now provides grouped pools and sealed packs through protocol version 9. The client adds sealed setup, sequential pack opening, pool review, deckbuilding completion, translated labels, and persisted opening-phase handling.

Changes

Sealed draft opening flow

Layer / File(s) Summary
Engine pool and sealed view contract
crates/draft-core/src/view.rs, crates/server-core/src/protocol.rs, client/src/network/...
Draft views now include ordered pool groups, color counts, and sealed packs. Engine and transport tests verify grouping, pack boundaries, and serialization.
Client pool grouping contract
client/src/adapter/..., client/src/components/draft/PoolPanel.tsx, client/src/components/draft/poolGroupLabels.ts, client/src/.../__tests__/*
Adapters carry engine pool data. PoolPanel renders shared groups and counts instead of recomputing them locally.
Pack opening and pool review UI
client/src/components/draft/SealedPackOpening.tsx, client/src/components/draft/__tests__/SealedPackOpening.test.tsx, client/src/i18n/locales/*/draft.json
The client presents packs in sequence, shows pulled cards and the grouped pool, and completes deckbuilding. Locales include sealed-opening and pool-group labels.
Draft phase and setup integration
client/src/pages/DraftPage.tsx, client/src/pages/DraftLandingPage.tsx, client/src/stores/draftStore.ts, client/src/services/quickDraftPersistence.ts, client/src/components/draft/DraftSteps.tsx
Sealed setup, the opening phase, resume handling, progress display, landing navigation, and completion transition are integrated into draft navigation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the main change: adding sealed pack opening support.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ship/sealed-pack-opening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/server-core/src/protocol.rs (1)

2090-2120: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Exercise populated sealed_packs on the DraftStateUpdate wire path.

Line 2098 sets sealed_packs to None, so this round-trip only covers the empty case. Build a Sealed DraftPlayerView with multiple non-empty packs, serialize and deserialize it through ServerMessage::DraftStateUpdate, and assert the decoded value preserves card order and pack boundaries. Add equivalent coverage for WebSocket JSON transport as well.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/server-core/src/protocol.rs` around lines 2090 - 2120, Update the
DraftStateUpdate round-trip test around DraftPlayerView to use
DraftStatus::Sealed with multiple non-empty sealed_packs, then assert
deserialization preserves each pack’s card order and boundaries. Add equivalent
assertions through the WebSocket JSON transport test path, reusing the same
populated sealed-pack fixture where appropriate.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/src/components/draft/poolGrouping.ts`:
- Around line 14-116: The draft-pool classification logic currently lives in the
frontend; move color/type/CMC grouping, ordering, and duplicate identity into
the engine and expose typed pre-grouped pool data. Replace primaryType parsing
and the helpers used by groupDraftPool with the engine-provided model, then map
group kinds to localized labels only at the rendering boundary. Update both
PoolPanel and SealedPackOpening to consume the shared engine grouping.

In `@client/src/i18n/locales/de/draft.json`:
- Around line 85-97: Translate the sealed-flow messages, preserving keys and
interpolation placeholders: in client/src/i18n/locales/de/draft.json ranges
85-97, 145-148, and 179; client/src/i18n/locales/es/draft.json ranges 85-97,
145-148, and 179; client/src/i18n/locales/fr/draft.json ranges 85-97, 145-148,
and 179; and client/src/i18n/locales/it/draft.json ranges 85-97, 145-148, and
179. Translate sealedOpening, landing.sealed.description, and quickPhase.opening
into each locale without changing the JSON structure or placeholder names.

In `@client/src/i18n/locales/pl/draft.json`:
- Around line 85-97: Translate all sealed-pack UI strings currently in English:
update the sealedOpening values in client/src/i18n/locales/pl/draft.json:85-97
and client/src/i18n/locales/pt/draft.json:85-97 into Polish and Portuguese
respectively; also translate landing.sealed.description at
client/src/i18n/locales/pl/draft.json:145-148 and
client/src/i18n/locales/pt/draft.json:145-148, plus quickPhase.opening at
client/src/i18n/locales/pl/draft.json:177-179 and
client/src/i18n/locales/pt/draft.json:177-179. Preserve all interpolation
placeholders such as current, total, count, and the existing locale structure.

---

Outside diff comments:
In `@crates/server-core/src/protocol.rs`:
- Around line 2090-2120: Update the DraftStateUpdate round-trip test around
DraftPlayerView to use DraftStatus::Sealed with multiple non-empty sealed_packs,
then assert deserialization preserves each pack’s card order and boundaries. Add
equivalent assertions through the WebSocket JSON transport test path, reusing
the same populated sealed-pack fixture where appropriate.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0283da89-dfa0-4a37-bf54-ef2a01b73e28

📥 Commits

Reviewing files that changed from the base of the PR and between 907d219 and 9bc11dc.

⛔ Files ignored due to path filters (2)
  • client/public/changelog-meta.json is excluded by !client/public/changelog*.json
  • client/public/changelog.json is excluded by !client/public/changelog*.json
📒 Files selected for processing (20)
  • client/src/adapter/draft-adapter.ts
  • client/src/components/draft/DraftSteps.tsx
  • client/src/components/draft/PoolPanel.tsx
  • client/src/components/draft/SealedPackOpening.tsx
  • client/src/components/draft/__tests__/SealedPackOpening.test.tsx
  • client/src/components/draft/poolGrouping.ts
  • client/src/i18n/locales/de/draft.json
  • client/src/i18n/locales/en/draft.json
  • client/src/i18n/locales/es/draft.json
  • client/src/i18n/locales/fr/draft.json
  • client/src/i18n/locales/it/draft.json
  • client/src/i18n/locales/pl/draft.json
  • client/src/i18n/locales/pt/draft.json
  • client/src/pages/DraftLandingPage.tsx
  • client/src/pages/DraftPage.tsx
  • client/src/services/quickDraftPersistence.ts
  • client/src/stores/draftStore.ts
  • crates/draft-core/src/view.rs
  • crates/server-core/src/protocol.rs
  • scripts/changelog/state.json

Comment on lines +14 to +116
function colorGroupKey(card: DraftCardInstance): string {
if (card.colors.length === 0) return "Colorless";
if (card.colors.length > 1) return "Multicolor";
return card.colors[0];
}

const COLOR_GROUP_ORDER: Record<string, number> = {
W: 0, U: 1, B: 2, R: 3, G: 4, Multicolor: 5, Colorless: 6,
};

const COLOR_GROUP_LABELS: Record<string, string> = {
W: "White", U: "Blue", B: "Black", R: "Red", G: "Green",
Multicolor: "Multicolor", Colorless: "Colorless",
};

function primaryType(typeLine: string): string {
const lower = typeLine.toLowerCase();
if (lower.includes("creature")) return "Creature";
if (lower.includes("instant")) return "Instant";
if (lower.includes("sorcery")) return "Sorcery";
if (lower.includes("enchantment")) return "Enchantment";
if (lower.includes("artifact")) return "Artifact";
if (lower.includes("planeswalker")) return "Planeswalker";
if (lower.includes("land")) return "Land";
return "Other";
}

const TYPE_ORDER: Record<string, number> = {
Creature: 0, Instant: 1, Sorcery: 2, Enchantment: 3,
Artifact: 4, Planeswalker: 5, Land: 6, Other: 7,
};

function dedup(cards: DraftCardInstance[]): DraftPoolEntry[] {
const map = new Map<string, DraftPoolEntry>();
for (const card of cards) {
const existing = map.get(card.name);
if (existing) {
existing.count++;
} else {
map.set(card.name, { card, count: 1 });
}
}
return [...map.values()];
}

function sortWithinGroup(cards: DraftCardInstance[]): DraftPoolEntry[] {
const sorted = [...cards].sort((a, b) => a.cmc - b.cmc || a.name.localeCompare(b.name));
return dedup(sorted);
}

function groupByColor(pool: DraftCardInstance[]): DraftPoolGroup[] {
const groups = new Map<string, DraftCardInstance[]>();
for (const card of pool) {
const key = colorGroupKey(card);
const list = groups.get(key) ?? [];
list.push(card);
groups.set(key, list);
}
return [...groups.entries()]
.sort(([a], [b]) => (COLOR_GROUP_ORDER[a] ?? 99) - (COLOR_GROUP_ORDER[b] ?? 99))
.map(([key, cards]) => ({
label: COLOR_GROUP_LABELS[key] ?? key,
cards: sortWithinGroup(cards),
}));
}

export function groupDraftPoolByType(pool: DraftCardInstance[]): DraftPoolGroup[] {
const groups = new Map<string, DraftCardInstance[]>();
for (const card of pool) {
const key = primaryType(card.type_line);
const list = groups.get(key) ?? [];
list.push(card);
groups.set(key, list);
}
return [...groups.entries()]
.sort(([a], [b]) => (TYPE_ORDER[a] ?? 99) - (TYPE_ORDER[b] ?? 99))
.map(([label, cards]) => ({ label, cards: sortWithinGroup(cards) }));
}

function groupByCmc(pool: DraftCardInstance[]): DraftPoolGroup[] {
const groups = new Map<string, DraftCardInstance[]>();
for (const card of pool) {
const key = card.cmc >= 6 ? "6+" : String(card.cmc);
const list = groups.get(key) ?? [];
list.push(card);
groups.set(key, list);
}
const cmcOrder = ["0", "1", "2", "3", "4", "5", "6+"];
return cmcOrder
.filter((key) => groups.has(key))
.map((key) => ({
label: `${key} CMC`,
cards: dedup([...groups.get(key)!].sort((a, b) => a.name.localeCompare(b.name))),
}));
}

export function groupDraftPool(pool: DraftCardInstance[], mode: PoolSortMode): DraftPoolGroup[] {
switch (mode) {
case "color": return groupByColor(pool);
case "type": return groupDraftPoolByType(pool);
case "cmc": return groupByCmc(pool);
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Move draft-pool classification into the engine.

These functions derive color groups, type groups, CMC groups, ordering, and duplicate identity from card data. primaryType also parses Oracle type lines in the frontend. For example, an Artifact Creature always enters the Creature group because of this client-defined priority.

Expose typed, pre-grouped pool data from the engine. Map its group kind to localized UI labels at the rendering boundary. Reuse that model in both PoolPanel and SealedPackOpening.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/components/draft/poolGrouping.ts` around lines 14 - 116, The
draft-pool classification logic currently lives in the frontend; move
color/type/CMC grouping, ordering, and duplicate identity into the engine and
expose typed pre-grouped pool data. Replace primaryType parsing and the helpers
used by groupDraftPool with the engine-provided model, then map group kinds to
localized labels only at the rendering boundary. Update both PoolPanel and
SealedPackOpening to consume the shared engine grouping.

Source: Path instructions

Comment thread client/src/i18n/locales/de/draft.json
Comment thread client/src/i18n/locales/pl/draft.json
@matthewevans
matthewevans added this pull request to the merge queue Aug 10, 2026
@matthewevans
matthewevans removed this pull request from the merge queue due to a manual request Aug 10, 2026
@matthewevans
matthewevans enabled auto-merge August 10, 2026 03:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (4)
client/src/components/draft/PoolPanel.tsx (1)

88-96: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Make the sort-mode selection exhaustive.

The nested ternary treats any value other than "color" and "type" as the CMC grouping. If poolSortMode gains a mode, the panel silently renders CMC groups instead of failing the type check. A keyed lookup makes the union exhaustive and removes the nesting.

♻️ Proposed refactor
-  const groups = view
-    ? poolSortMode === "color"
-      ? view.pool_groups.color_groups
-      : poolSortMode === "type"
-        ? view.pool_groups.type_groups
-        : view.pool_groups.cmc_groups
-    : [];
+  const GROUPS_BY_SORT_MODE = {
+    color: "color_groups",
+    type: "type_groups",
+    cmc: "cmc_groups",
+  } as const;
+  const groups = view ? view.pool_groups[GROUPS_BY_SORT_MODE[poolSortMode]] : [];

Declare GROUPS_BY_SORT_MODE at module scope next to COLOR_COUNT_KEYS.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/components/draft/PoolPanel.tsx` around lines 88 - 96, Replace the
nested sort-mode ternary in PoolPanel with a module-scope GROUPS_BY_SORT_MODE
keyed by every PoolSortMode value, declared alongside COLOR_COUNT_KEYS. Use the
keyed lookup for view.pool_groups so adding a new mode requires updating the
mapping and preserves exhaustive type checking.
crates/draft-core/src/view.rs (2)

433-478: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Replace the sort_by_cmc: bool parameter with a typed ordering enum.

groups_for and sorted_entries take a positional bool that encodes the sort key. At the call sites in grouped_pool, the literals true, true, false carry no meaning at a glance. A small enum makes the intent explicit and lets the compiler check new orderings later.

♻️ Proposed refactor
+enum EntryOrder {
+    ManaValueThenName,
+    Name,
+}
+
 fn grouped_pool(pool: &[DraftCardInstance]) -> DraftPoolGroups {
     DraftPoolGroups {
-        color_groups: groups_for(pool, &COLOR_GROUP_ORDER, color_group, true),
-        type_groups: groups_for(pool, &TYPE_GROUP_ORDER, type_group, true),
-        cmc_groups: groups_for(pool, &CMC_GROUP_ORDER, mana_value_group, false),
+        color_groups: groups_for(pool, &COLOR_GROUP_ORDER, color_group, EntryOrder::ManaValueThenName),
+        type_groups: groups_for(pool, &TYPE_GROUP_ORDER, type_group, EntryOrder::ManaValueThenName),
+        cmc_groups: groups_for(pool, &CMC_GROUP_ORDER, mana_value_group, EntryOrder::Name),
         color_counts: color_counts(pool),
     }
 }

Then match on EntryOrder inside sorted_entries instead of branching on the flag.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/draft-core/src/view.rs` around lines 433 - 478, Replace the positional
sort_by_cmc boolean in groups_for and sorted_entries with a typed EntryOrder
enum that represents the supported sort keys. Update grouped_pool call sites to
pass the appropriate enum variant instead of true or false, and match on
EntryOrder inside sorted_entries while preserving the existing CMC-then-name and
name-only ordering behavior.

Source: Coding guidelines


455-478: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

sorted_entries deduplicates by card name only, so the group count and the pull count diverge.

sorted_entries collapses copies into one DraftPoolEntry with count. The group itself exposes only cards, so any consumer that needs the number of physical cards in the group must sum count over the entries. PoolPanel.tsx uses group.cards.length and therefore under-reports every group that contains duplicates. Consider adding an engine-computed total to DraftPoolGroup so the client never has to derive it.

♻️ Proposed engine-owned total
 pub struct DraftPoolGroup {
     pub kind: DraftPoolGroupKind,
     pub cards: Vec<DraftPoolEntry>,
+    /// Total physical cards in this group, including duplicates.
+    pub total: usize,
 }

Populate it in groups_for from cards.len() before deduplication.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/draft-core/src/view.rs` around lines 455 - 478, Update DraftPoolGroup
and groups_for to include an engine-computed total representing the physical
card count; set it from cards.len() before sorted_entries deduplicates cards by
name. Ensure PoolPanel.tsx and other consumers use this total instead of
group.cards.length when displaying group size.

Source: Path instructions

client/src/adapter/__tests__/draftPodAdapter.test.ts (1)

115-120: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Two fixtures inline the empty pool-group literal that draft-adapter.ts already exports. EMPTY_DRAFT_POOL_GROUPS is the single source for this shape, and server-draft-adapter.test.ts imports it. A new field on DraftPoolGroups would require edits in each inlined copy.

  • client/src/adapter/__tests__/draftPodAdapter.test.ts#L115-L120: import EMPTY_DRAFT_POOL_GROUPS from ../draft-adapter and assign it to pool_groups.
  • client/src/components/draft/__tests__/PackDisplay.pod.test.tsx#L42-L47: import EMPTY_DRAFT_POOL_GROUPS from ../../../adapter/draft-adapter and assign it to pool_groups.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@client/src/adapter/__tests__/draftPodAdapter.test.ts` around lines 115 - 120,
Replace the inline empty pool-group fixture with the shared
EMPTY_DRAFT_POOL_GROUPS export. In
client/src/adapter/__tests__/draftPodAdapter.test.ts:115-120, import it from
../draft-adapter and assign it to pool_groups; make the same replacement in
client/src/components/draft/__tests__/PackDisplay.pod.test.tsx:42-47 using
../../../adapter/draft-adapter.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@client/src/adapter/draft-adapter.ts`:
- Around line 33-39: The mana-value group labels in
client/src/adapter/draft-adapter.ts:33-39 and
client/src/components/draft/poolGroupLabels.ts:20-26 must match Rust
serialization: use mana_value0 through mana_value5 and mana_value6_plus, without
an underscore before the digit. Update the related DraftPoolGroupKind and
poolGroupLabels entries, and add an engine serialization test covering all
mana-value variants to prevent protocol drift.

In `@client/src/network/__tests__/draftProtocol.test.ts`:
- Around line 148-153: Add non-empty pool_groups entries matching the two
fixture cards in the draft protocol round-trip test, including color_groups,
type_groups, and cmc_groups data plus accurate color_counts. Extend the
decoded-view assertions to compare decoded.view.pool_groups with
longView.pool_groups, covering every group field consumed by SealedPackOpening.

In `@crates/draft-core/src/view.rs`:
- Around line 455-478: Update crates/draft-core/src/view.rs:455-478 by adding a
total field to DraftPoolGroup and populating it in groups_for from the
pre-deduplication card count produced before sorted_entries collapses
duplicates. Update client/src/components/draft/PoolPanel.tsx:150-152 to render
group.total instead of group.cards.length.

In `@crates/server-core/src/protocol.rs`:
- Line 2119: Update the round-trip test’s pool_groups fixture instead of using
DraftPoolGroups::default(): populate non-empty color_groups, type_groups, and
cmc_groups from the two pool cards, with non-zero color_counts, then assert the
decoded v.pool_groups matches those groups and counts, including
DraftPoolGroupKind values.

---

Nitpick comments:
In `@client/src/adapter/__tests__/draftPodAdapter.test.ts`:
- Around line 115-120: Replace the inline empty pool-group fixture with the
shared EMPTY_DRAFT_POOL_GROUPS export. In
client/src/adapter/__tests__/draftPodAdapter.test.ts:115-120, import it from
../draft-adapter and assign it to pool_groups; make the same replacement in
client/src/components/draft/__tests__/PackDisplay.pod.test.tsx:42-47 using
../../../adapter/draft-adapter.

In `@client/src/components/draft/PoolPanel.tsx`:
- Around line 88-96: Replace the nested sort-mode ternary in PoolPanel with a
module-scope GROUPS_BY_SORT_MODE keyed by every PoolSortMode value, declared
alongside COLOR_COUNT_KEYS. Use the keyed lookup for view.pool_groups so adding
a new mode requires updating the mapping and preserves exhaustive type checking.

In `@crates/draft-core/src/view.rs`:
- Around line 433-478: Replace the positional sort_by_cmc boolean in groups_for
and sorted_entries with a typed EntryOrder enum that represents the supported
sort keys. Update grouped_pool call sites to pass the appropriate enum variant
instead of true or false, and match on EntryOrder inside sorted_entries while
preserving the existing CMC-then-name and name-only ordering behavior.
- Around line 455-478: Update DraftPoolGroup and groups_for to include an
engine-computed total representing the physical card count; set it from
cards.len() before sorted_entries deduplicates cards by name. Ensure
PoolPanel.tsx and other consumers use this total instead of group.cards.length
when displaying group size.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a029359b-63f4-4364-8538-612b42ad8149

📥 Commits

Reviewing files that changed from the base of the PR and between 9bc11dc and 513f532.

📒 Files selected for processing (23)
  • client/src/adapter/__tests__/draftPodAdapter.test.ts
  • client/src/adapter/__tests__/server-draft-adapter.test.ts
  • client/src/adapter/draft-adapter.ts
  • client/src/adapter/p2p-draft-host.ts
  • client/src/components/draft/PoolPanel.tsx
  • client/src/components/draft/SealedPackOpening.tsx
  • client/src/components/draft/__tests__/LimitedDeckBuilder.test.tsx
  • client/src/components/draft/__tests__/PackDisplay.pod.test.tsx
  • client/src/components/draft/__tests__/SealedPackOpening.test.tsx
  • client/src/components/draft/poolGroupLabels.ts
  • client/src/i18n/locales/de/draft.json
  • client/src/i18n/locales/en/draft.json
  • client/src/i18n/locales/es/draft.json
  • client/src/i18n/locales/fr/draft.json
  • client/src/i18n/locales/it/draft.json
  • client/src/i18n/locales/pl/draft.json
  • client/src/i18n/locales/pt/draft.json
  • client/src/network/__tests__/draftProtocol.test.ts
  • client/src/network/draftProtocol.ts
  • client/src/pages/DraftLandingPage.tsx
  • client/src/stores/__tests__/multiplayerDraftStore.test.ts
  • crates/draft-core/src/view.rs
  • crates/server-core/src/protocol.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • client/src/pages/DraftLandingPage.tsx
  • client/src/i18n/locales/es/draft.json
  • client/src/i18n/locales/pl/draft.json
  • client/src/i18n/locales/fr/draft.json
  • client/src/components/draft/SealedPackOpening.tsx
  • client/src/components/draft/tests/SealedPackOpening.test.tsx

Comment thread client/src/adapter/draft-adapter.ts Outdated
Comment thread client/src/network/__tests__/draftProtocol.test.ts
Comment thread crates/draft-core/src/view.rs
Comment thread crates/server-core/src/protocol.rs Outdated
@matthewevans
matthewevans added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 0880698 Aug 10, 2026
13 checks passed
@matthewevans
matthewevans deleted the ship/sealed-pack-opening branch August 10, 2026 04:13
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