Skip to content

feat(deck-builder): Wincon tag ↔ win-condition engine cross-link (E125)#1308

Merged
georgepapagapitos merged 4 commits into
mainfrom
e125-wincon-crosslink
Jul 23, 2026
Merged

feat(deck-builder): Wincon tag ↔ win-condition engine cross-link (E125)#1308
georgepapagapitos merged 4 commits into
mainfrom
e125-wincon-crosslink

Conversation

@georgepapagapitos

Copy link
Copy Markdown
Owner

Summary

  • User-tagged Wincon cards now surface in the Power tab's Win Conditions panel, and engine-detected win-condition cards offer a "tag as Wincon" affordance — the two directions from E125's board spec.
  • Display-level only: detectWinConditions (frontend/src/deck-builder/services/winConditions/detect.ts) is untouched, still pure, no new inputs — no v2-wincon signature bump needed.
  • New Deck.winConTags?: string[] — a narrow, single-purpose field (card names only, no goals/colors/categories), explicitly NOT a reopening of the general card-tag system retired in feat(deck): retire user card tags — automatic role pills take over the filter lens #1134. Set only via a user-confirmed click on an evidence chip's tag toggle.
  • Dedupe rule: a card that's both engine evidence and user-tagged shows the mark on its existing row (accent-filled tag icon, aria-pressed); a tag the engine doesn't currently surface gets a separate dashed "Tagged by you" section, so a tag never disappears silently when the live analysis changes.

Files touched

  • frontend/src/deck-builder/services/winConditions/winConTags.ts (+test) — new pure module: tagOnlyWinCons (merge/dedupe) and toggleWinConTag (add/remove).
  • frontend/src/components/deck/WinConditionPanel.tsx (+test) — per-evidence-chip tag toggle (WinConEvidenceItem), the "Tagged by you" section, restructured render so the tag section survives the noClearWinCondition empty state.
  • frontend/src/components/deck/WinConditionPanel.css — toggle button styles (aria-pressed accent fill, 44px coarse-pointer target, reduced-motion guard), dashed border for the tagged-only section.
  • frontend/src/store/decks.ts — new Deck.winConTags?: string[] field, additive/whole-row-synced like primer.
  • frontend/src/pages/DeckEditorPage.tsx — wires winConTags/onToggleWinConTag into the existing WinConditionPanel call site via updateDeck (same pattern as bracketOverride/archetypeOverride).

Test plan

  • winConTags.test.ts — 11 cases: tagOnlyWinCons (primary/secondary dedupe, no-clear-wincon still surfaces tags, mixed split, de-dupe/order) + toggleWinConTag (add/remove/no-mutate).
  • WinConditionPanel.test.tsx — 7 cases covering engine-only / tag-only / both / none states, dedupe, live toggle click, read-only mode when the callback is omitted.
  • npm run typecheck / lint / format:check / test (both packages) — all green; coverage gate enforced (dev Postgres up).
  • Browser validation against the dev account's seeded "Krenko" commander deck (real UI click for the tag toggle; realistic seeded winConditions for the other 3 states, since the live EDHREC/Scryfall analysis pipeline was rate-limited in this environment) — 320/360(dpr3)/600/768/1024/1440, light+dark at 360+1440. polish:responsive-audit run — no findings.
  • Dev account cleanup — Krenko deck restored to its exact original state (verified byte-identical) after validation.

Adds a narrow, single-purpose "tag as Wincon" toggle on WinConditionPanel's
evidence chips (E125) — display-level only, never fed into detectWinConditions.
A tagged card that's already engine evidence gets a "tagged by you" mark in
place; a tagged card the engine doesn't currently surface gets its own dashed
"Tagged by you" section, so a tag never silently disappears as the deck (and
its live analysis) changes. Deck.winConTags is a new, deliberately minimal
field — distinct from the retired general card-tag system (#1134).
@georgepapagapitos
georgepapagapitos enabled auto-merge (squash) July 23, 2026 15:52
@georgepapagapitos
georgepapagapitos merged commit 7bf85bd into main Jul 23, 2026
5 checks passed
@georgepapagapitos
georgepapagapitos deleted the e125-wincon-crosslink branch July 23, 2026 16:45
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