PublicRead-only. Nothing here can be changed.

Docs & rules

jessitron/mtg-deck-shufflerGitHub

This is a public, read-only report. Striff reads this repository's docs, turns each sentence that makes a claim about the code into a rule, and checks the rule against the code on the default branch. How this works

main42f9363Last read 16h ago

Documents
Rules
712
106
80
32
17
14
1
47
1
26
19
11
8
3
2
2
2
1
1
602
22
9
6
1
4
2
54
3
28
4
19
73
31
42
15
2
4
7
2
299
88
137
48
26
139
26
10
54
20
3
26
2
128 docs
jessitron/mtg-deck-shufflerOpen repository

jessitron/mtg-deck-shuffler — documented rules

712 of 712 rules, printed November 6, 2026.

The sentence in your docs
The <head> comes from one place for both: formatHtmlHead in src/view/common/html-layout.ts (tokens.css first, fonts, browser-tab-id + tracing bootstrap). EJS pages reach it through views/partials/head.ejs, a thin adapter exposed via app.locals; that adapter is also the one spot that adds site.css (which must never reach /game).
formatHtmlHead is in apps/shuffler/src/view/common
Holds
The domain rules — no direct Shuffler↔Tabletop call, every played card lands on the Stack, join idempotent per joinRequestId, carry the Spine's tableUrl, Spine calls best-effort — are in the domain map.
4 rules from this sentence
nothing in apps/shuffler/src may depend on any tabletop
Holdsshuffler tabletop
any tabletop may not depend on apps/shuffler/src
Holdstabletop shuffler
nothing in apps/shuffler/src may depend on apps/tabletop/src
Holdsshuffler tabletop
nothing in apps/tabletop/src may depend on apps/shuffler/src
Holdstabletop shuffler
the Shuffler mints a short-GUID seatId at join and records all three on BOTH PersistedGamePrep and PersistedGameState (optional fields, no version bumps).
2 rules from this sentence
PersistedGamePrep has a seatId field
Holds
PersistedGameState has a seatId field
Holds
JoinTablePort (types.ts) speaks the Shuffler's domain: join(JoinTableRequest) answering a SeatAtTable.
3 rules from this sentence
JoinTablePort depends on JoinTableRequest
Holds
JoinTablePort depends on SeatAtTable
Holds
JoinTablePort has a join method
Holds
The abstract SpineJoinAdapter owns the translation into the Spine's /join wire vocabulary (spineWire.ts), including the seat-decoration builders; HttpSpineJoinAdapter (real) and FakeSpineJoinAdapter (tests, and the in-memory seat-allocation policy — one table per name, seats 1-4, idempotence by the request's joinRequestId) subclass it and supply only submission.
3 rules from this sentence
HttpSpineJoinAdapter extends SpineJoinAdapter
Holds
FakeSpineJoinAdapter extends SpineJoinAdapter
Holds
SpineJoinAdapter is declared abstract
Holds
SpineEventsPort (types.ts) carries the send half — announceCardPlayed/announceCardReturned/announceCardDiscarded, taking a TableSeat and a GameCard
5 rules from this sentence
SpineEventsPort depends on GameCard
Holdsport-spine domain-types.ts
SpineEventsPort depends on TableSeat
Holds
SpineEventsPort has announceCardPlayed
Holds
SpineEventsPort has announceCardReturned
Holds
SpineEventsPort has announceCardDiscarded
Holds
with the abstract SpineEventsAdapter owning the translation into the port-tabletop envelope builders, HttpSpineEventsAdapter/FakeSpineEventsAdapter supplying only transport, and HttpSpineEventsGateway doing the thin POST /tables/:id/events.
2 rules from this sentence
SpineEventsAdapter depends on something in apps/shuffler/src/port-tabletop
checks “with the abstract SpineEventsAdapter owning the translation into the port-tabletop envelope builders, HttpSpineEventsAdapter/FakeSpineEventsAdapter supplying only transport”
Holdsport-spine port-tabletop
SpineEventsAdapter is declared abstract
Holds
The receive half is one more method on the same port: followTable(tableId, applyEvent, appliedThrough) — "deliver me the events at this table, resuming after what I applied".
SpineEventsPort has a followTable method
Holds
All three gateways wrap every failure in the shared SpineGatewayError (port-spine/SpineGatewayError.ts), so undici's errors and HTTP status codes stop there.
4 rules from this sentence
HttpSpineJoinGateway depends on SpineGatewayError
checks “All three gateways wrap every failure in the shared SpineGatewayError”
Holdsjoin SpineGatewayError.ts
HttpSpineEventsGateway depends on SpineGatewayError
checks “All three gateways wrap every failure in the shared SpineGatewayError”
Holdsevents SpineGatewayError.ts
HttpSpineStreamGateway depends on SpineGatewayError
checks “All three gateways wrap every failure in the shared SpineGatewayError”
Holdsevents SpineGatewayError.ts
SpineGatewayError is in apps/shuffler/src/port-spine
checks “the shared SpineGatewayError (port-spine/SpineGatewayError.ts)”
Holds
each GameCard gets a cardInstanceId GUID (minted in newGame, mint-on-load for old saves).
GameCard has cardInstanceId
Holds
The application never tracks a reconnect cursor. SpineEventsAdapter reads the seq off each event it delivered (extractSeq, private to that file) and advances its own high-water mark, resending it as lastEventId on every connect (including the first, where it's simply absent) so the Spine (services/spine/lib/sse_stream.rb) replays whatever was missed, in order,
SpineEventsAdapter depends on extractSeq
Holds
Below the adapter, HttpSpineStreamGateway.ts is the thin transport: streamed fetch, data: <json>\n\n frames, and the same heartbeat-aware bounded headersTimeout/bodyTimeout undici Agent as the Tabletop's (this is the Shuffler's first undici dependency, pinned to major version 7 to match what Node vendors internally, same reasoning as the Tabletop's pin).
HttpSpineStreamGateway imports undici
Holds
seq is legitimately domain data here: it's a field of the published envelope contract, typed on the validated Envelope, and persisted.
Envelope has a seq field
Holds
face is never read from the payload (the schema blacklists it) — the card keeps whatever currentFace it already had.
GameCard has currentFace
Holds
getCardImageUrl() prefers the stored URL and falls back to constructCardImageUrl() (bare CDN path) — the bare path 404s for freshly-released cards, which is why we store the versioned URLs.
getCardImageUrl depends on constructCardImageUrl
Holds
Card images in src/port-card-images/ (CardImagesPort): ScryfallCardImagesGateway (batched, throttled, 429-retrying), FakeCardImagesGateway, and enrichDeckWithImages().
4 rules from this sentence
CardImagesPort is in apps/shuffler/src/port-card-images
checks “Card images** in src/port-card-images/ (CardImagesPort)”
Holds
ScryfallCardImagesGateway is in apps/shuffler/src/port-card-images
checks “ScryfallCardImagesGateway”
Holds
FakeCardImagesGateway is in apps/shuffler/src/port-card-images
checks “FakeCardImagesGateway”
Holds
enrichDeckWithImages is in apps/shuffler/src/port-card-images
checks “enrichDeckWithImages()”
Holds
The port is an interface, RetrieveDeckPort.
RetrieveDeckPort is a contract
Holds
JoinTablePort.join(JoinTableRequest): SeatAtTable, and SpineEventsPort, which covers both directions of one capability — announceCardPlayed/announceCardReturned/announceCardDiscarded going out, and followTable(tableId, applyEvent, appliedThrough) coming in.
7 rules from this sentence
JoinTablePort depends on JoinTableRequest
Holds
JoinTablePort depends on SeatAtTable
Holds
JoinTablePort has a join method
Holds
SpineEventsPort has announceCardPlayed
Holds
SpineEventsPort has announceCardReturned
Holds
SpineEventsPort has announceCardDiscarded
Holds
SpineEventsPort has a followTable method
Holds
Each capability has an abstract adapter — SpineJoinAdapter, SpineEventsAdapter — holding all the translation (and, for events, the reconnect orchestration), with Http* and Fake* subclasses supplying only transport.
2 rules from this sentence
SpineJoinAdapter is declared abstract
Holds
SpineEventsAdapter is declared abstract
Holds
events/ has two gateways, because a stream shares nothing with a POST: HttpSpineEventsGateway (POST /tables/:id/events) and HttpSpineStreamGateway (the SSE read loop, the undici Agent, the frame parsing).
2 rules from this sentence
HttpSpineEventsGateway is in apps/shuffler/src/port-spine/events
Holds
HttpSpineStreamGateway is in apps/shuffler/src/port-spine/events
Holds
HttpSpineEventsGateway (POST /tables/:id/events) and HttpSpineStreamGateway (the SSE read loop, the undici Agent, the frame parsing).
HttpSpineStreamGateway imports undici
Holds
All three gateways wrap their failures in one shared SpineGatewayError — one service, one error type.
3 rules from this sentence
HttpSpineJoinGateway depends on SpineGatewayError
Holdsjoin SpineGatewayError.ts
HttpSpineEventsGateway depends on SpineGatewayError
Holdsevents SpineGatewayError.ts
HttpSpineStreamGateway depends on SpineGatewayError
Holdsevents SpineGatewayError.ts
tableUrl on SeatAtTable (rendered as the "Go to Table" link) and seq (recorded as GameEvent.spineSeq so a torn-down subscription can resume).
SeatAtTable has tableUrl
Holds
Constant PERSISTED_DECK_VERSION, Defined in src/types.ts, Current 4, Stamped on every Deck (adapters + hydrateDeck ), Validated (fails) at LocalFileAdapter.retrieveDeck → DeckVersionMismatchError
3 rules from this sentence
LocalFileAdapter depends on DeckVersionMismatchError
checks “Validated (fails) at LocalFileAdapter.retrieveDeck → DeckVersionMismatchError”
HoldslocalFileAdapter types.ts
hydrateDeck depends on Deck
Holdsport-card-repository types.ts
LocalFileAdapter has retrieveDeck
checks “LocalFileAdapter.retrieveDeck”
Holds
Constant PERSISTED_GAME_STATE_VERSION, Defined in src/port-persist-state/types.ts, Current 12, Stamped on PersistedGameState ( toPersistedGameState ), Validated (fails) at GameState.fromPersistedGameState → IncompatibleStateVersionError
2 rules from this sentence
GameState depends on IncompatibleStateVersionError
checks “Validated (fails) at GameState.fromPersistedGameState → IncompatibleStateVersionError”
HoldsGameState.ts port-persist-state
GameState has fromPersistedGameState
checks “GameState.fromPersistedGameState”
Holds
Constant PersistedDeck.version, Defined in src/port-persist-state/persisted-types.ts, Current 2, Stamped on PersistedDeck ( dehydrateDeck ), Validated (fails) at not validated on load (dehydrated form)
2 rules from this sentence
dehydrateDeck depends on PersistedDeck
Holdsport-card-repository port-persist-state
PersistedDeck has version
checks “Constant PersistedDeck.version”
Holds
decks/*.json (read by LocalFileAdapter) embed full Deck objects with full CardDefinitions.
LocalFileAdapter depends on Deck
Holdsport-deck-retrieval types.ts
PersistedGameState (a saved game) stores cards as cardDefinitionId references (PersistedGameCard) and rehydrates full CardDefinitions from the card repository at load.
PersistedGameState depends on PersistedGameCard
Holds
PersistedGamePrep (a saved prep) embeds a full Deck (with CardDefinitions).
PersistedGamePrep depends on Deck
Holdsport-persist-prep types.ts
It is insensitive to CardDefinition field changes — which is why it stayed at 2 through the cardTypes change.
PersistedDeck may not depend on CardDefinition
Holdsport-persist-state types.ts
PersistedDeck (the dehydrated deck inside persisted game state) stores only cardDefinitionIds + provenance.
PersistedDeck has provenance
Holds
Card repository (SqliteCardRepositoryAdapter, gitignored data.db) is a cache of CardDefinitions keyed by card_definition_id.
SqliteCardRepositoryAdapter depends on CardDefinition
Holdsport-card-repository types.ts
and let the card cache rebuild itself (it drops+recreates on stale schema in SqliteCardRepositoryAdapter.initializeDatabase).
SqliteCardRepositoryAdapter has initializeDatabase
Holds
formatPageWrapper (src/view/common/html-layout.ts) renders <body class="dev-mode"> when devMode is true.
formatPageWrapper is in apps/shuffler/src/view/common
Holds
there is no direct Shuffler→Tabletop call anymore.
nothing in apps/shuffler/src may depend on any tabletop
Holdsshuffler tabletop
the library-portal swallow (ticket 12, src/client/shapes/cardSwallow.ts) is send-then-commit — it POSTs POST /api/tables/:tableSlug/cards/return (handleCardReturned, src/server/cardReturned.ts) and only deletes the card shape once that call resolves ok; on failure the card's visuals revert and it stays on the table. That route resolves playerName/the Spine's real tableId from the room registry (the client only knows the card's own owner/cardDefinitionId/cardSource/gameCardIndex, matching this ship's shared-canvas design — it has no notion of its own player identity) and calls sendCardReturnedToSpineBestEffort (src/server/sendCardReturned.ts),
handleCardReturned depends on sendCardReturnedToSpineBestEffort
Holds
Inside inSpan, don't use it — inSpan already records the exception on the span.
inSpan may not depend on logError
Holds
chooseLicenseKey (src/client/chooseLicenseKey.ts) withholds any baked key wherever the gate can't fire, so a stale key in .be can't blank local dev or http prod. See README → Licensing.
chooseLicenseKey is in apps/tabletop/src/client
Holds
The label band. Every card-holding zone reserves 40 units at its top (ZONE_LABEL_BAND, src/shared/mtgZoneShape.ts) so its label stays readable with a card in it.
ZONE_LABEL_BAND is in apps/tabletop/src/shared
Holds
The client frames the table's full fixed extent on open (TABLE_EXTENT in TablePage.tsx), not a fit-to-content.
TABLE_EXTENT is in apps/tabletop/src/client
Holds
projectEvents(events) -> TableState is a pure function on this ship, and the Spine makes no code change beyond registering the new payload schemas.
projectEvents depends on TableState
Holds
The button is not yet wired to the diff — it emits a diagnostic button opened span when clicked and (if the player types a message and hits Send) a connected diagnostic message sent span carrying diagnostic.message, and nothing more (src/client/shapes/DiagnosticButton.tsx).
DiagnosticButton is in apps/tabletop/src/client/shapes
Holds
It holds seats, seenEventIds, spineTableId, spineSubscription and stackCardCount() — none of which are tldraw's business — plus a raw .room it never encapsulates, which every module mutates directly (entry.seenEventIds.add, playerArea.graveyardCount++, entry.seats.set).
6 rules from this sentence
RoomEntry has seats
checks “It holds seats”
Holds
RoomEntry has seenEventIds
Holds
RoomEntry has spineTableId
checks “spineTableId”
Holds
RoomEntry has spineSubscription
checks “spineSubscription”
Holds
RoomEntry has a stackCardCount method
checks “stackCardCount()”
Holds
RoomEntry has room
checks “a raw .room”
Holds
the wiring does not.** projectEvents(events) -> TableState and snapshotCanvas(editor) -> TableState produce the same shape so they can be diffed, and diffTableStates diffs them.
2 rules from this sentence
snapshotCanvas depends on TableState
checks “snapshotCanvas(editor) -> TableState”
Holdsclient shared
diffTableStates depends on TableState
Holds
The clearest tell is applyCardArrival(tableName, body: unknown) in src/server/cardArrival.ts: it accepts a raw envelope, runs Ajv, checks slugifyTableName(envelope.tableId) !== tableName, sniffs whether name === "card.played-face-down", and only then places a shape.
applyCardArrival depends on slugifyTableName
Holdsserver shared
1. tldraw undo/redo. TablePage.tsx's uiOverrides.actions wraps both actions.undo.onSelect and actions.redo.onSelect in an inSpan("undo"/"redo", ...) — added specifically because tldraw's undo/redo run against the shared synced store, not a local-only history, so one player hitting ctrl-Z could in principle revert other players' card moves back to their creation position.
uiOverrides depends on inSpan
HoldsTablePage.tsx observability
cardArrival.ts's placeArrivedCard (shared by applyCardArrival and applyCardDiscard) — mints a brand-new shape via store.put, position from stackCardPosition/graveyardCardPosition.
2 rules from this sentence
applyCardArrival depends on placeArrivedCard
Holds
applyCardDiscard depends on placeArrivedCard
Holds
New hook useReconnectSpans.ts (apps/tabletop/src/client/useReconnectSpans.ts), wired into TablePage.tsx alongside useCardArrivalSpans/usePhysicsAnnouncements, watches that connectionStatus and emits two spans on transitions (following the same void inSpan("name", () => {}, {attrs}) idiom as "card arrived on canvas"/"card moved by remote change" — a store-driven callback has no ambient span to hang attributes on):
useReconnectSpans depends on inSpan
HoldsuseReconnectSpans.ts observability
New hook useReconnectSpans.ts (apps/tabletop/src/client/useReconnectSpans.ts), wired into TablePage.tsx alongside useCardArrivalSpans/usePhysicsAnnouncements,
4 rules from this sentence
TablePage depends on useReconnectSpans
Holds
TablePage depends on useCardArrivalSpans
Holds
TablePage depends on usePhysicsAnnouncements
Holds
useReconnectSpans is in apps/tabletop/src/client
Holds
no clipboard, no direct Shuffler→Tabletop call.
nothing in apps/shuffler/src may depend on apps/tabletop/src
Holdsshuffler tabletop
chooseLicenseKey (src/client/chooseLicenseKey.ts, unit-tested) withholds any baked key wherever the gate can't fire, so a stale key in .be can't blank anything.
chooseLicenseKey is in apps/tabletop/src/client
Holds
src/log.ts in the Shuffler, src/server/log.ts in the Tabletop, logError() in the Tabletop's browser wrapper.
2 rules from this sentence
logError is in apps/tabletop/src/client/observability
Holds
logError is in apps/tabletop/src/client
Holds
migrate the column to bare id PRIMARY KEY (no declared type ⇒ BLOB affinity ⇒ stores whatever it's given, no coercion in either direction) — SqlitePersistStateAdapter.initializeDatabase detects the old INTEGER column type via pragma_table_info and rewrites the table (rename → recreate → copy → drop) the first time it opens an old data.db.
SqlitePersistStateAdapter has initializeDatabase
Holds
cardSource in code and contracts, card.source on spans.
CardDefinition has cardSource
Holds
GameState method returns a WhatHappened object describing what changed
GameState depends on WhatHappened
Holds
getAnimationClassHelper() in shared-components.ts maps WhatHappened to CSS classes
getAnimationClassHelper depends on WhatHappened
Holdsview GameState.ts
In src/view/common/shared-components.ts (lines 115-127): getAnimationClassHelper(whatHappened, gameCardIndex) checks the WhatHappened arrays/properties and returns the appropriate CSS class string for a given card.
2 rules from this sentence
WhatHappened is in apps/shuffler/src
Holds
getAnimationClassHelper is in apps/shuffler/src/view/common
checks “In src/view/common/shared-components.ts”
Holds
The third is the Tabletop's tap animation, decided 2026-08-07 and built 2026-08-09 (65276e6) — reasoning in .scratch/tabletop-physics/issues/04-tap-is-state.md and .scratch/tabletop-physics/issues/05-rotate-to-tap.md, implementation ticket .scratch/tabletop-physics/issues/15-tap-animation.md, code in apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx component().
2 rules from this sentence
MtgCardShapeUtil is in apps/tabletop/src/client/shapes
checks “code in apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx”
Holds
MtgCardShapeUtil has a component method
checks “code in apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx component()”
Holds
The state model. props.tapped: boolean on the mtg-card shape is the stored truth, and it is never read back out of an angle (the old UNTAPPED_EPSILON check died with ticket 04/05; ticket 12 also replaced the image-shape subclass with the genuine custom shape MtgCardShapeUtil.tsx).
MtgCardShapeProps has tapped
Holds
MtgCounterShapeUtil.tsx (6713421) fixed the rotation half of that by giving the counter's own component() the identical mechanism as the card: a useLayoutEffect that watches the host card's props.tapped (read fresh via useValue off the editor, keyed by parentId — not off the shape argument's parentId field, which isn't reactive to reparenting) and replays the same 500ms ease-out WAAPI catch-up on the counter's own .tl-image-container-hosted element.
MtgCounterShapeUtil has a component method
Holds
TAP_ANGLE (Math.PI / 2) is now exported from cardTap.ts so this file doesn't duplicate the constant.
TAP_ANGLE is exported
Holds
Lines 115-127: getAnimationClassHelper() — maps WhatHappened to CSS classes
getAnimationClassHelper depends on WhatHappened
Holdsview GameState.ts
Line 34: calls getAnimationClassHelper() in formatCardContainer()
formatCardContainer depends on getAnimationClassHelper
Holds
WhatHappened interface definition
WhatHappened is a contract
Holds
The tap animation lives in component(): a useLayoutEffect keyed on props.tapped (prevTappedRef starts at first-seen value) runs WAAPI element.animate() on the .tl-image-container div — rotate(∓90deg) → 0, 500ms, ease-out, cancelling any running animations first.
MtgCardShapeUtil has a component method
Holds
apps/tabletop/src/client/shapes/cardTap.ts — tapPartial()'s center-preserving rotation-delta math. TAP_ANGLE (Math.PI / 2) is now exported (2026-08-12) so MtgCounterShapeUtil.tsx reuses the same constant instead of duplicating it.
TAP_ANGLE is exported
Holds
apps/tabletop/src/client/shapes/MtgCounterShapeUtil.tsx — hosted counter's own tap catch-up, in component()'s useLayoutEffect keyed on the host card's props.tapped (read via useValue off the editor, not the shape's parentId field).
MtgCounterShapeUtil has a component method
Holds
If the card shape's rotation-delta convention in cardTap.ts (TAP_ANGLE, now exported for exactly this reuse) or its center-preserving pivot math ever changes, this counter math must change with it — it re-derives the same before/after rotation the card's own catch-up assumes.
TAP_ANGLE is exported
Holds
Animation Card slide left/right, CSS Class .card-moved-left , .card-moved-right, Status Working, Duration 0.5s, Trigger WhatHappened.movedLeft/Right
WhatHappened has movedLeft
Holds
Animation Library shuffle, CSS Class .shuffling on .library-stack, Status Working, Duration 1.5s, Trigger WhatHappened.shuffling (from shuffle() and mulligan() ) — class is never removed see architecture.md
WhatHappened has shuffling
Holds
Animation Tap / untap swing (90°), Where Tabletop, MtgCardShapeUtil component(), Status Working ( 65276e6 , physics ticket 15), Duration 0.5s ease-out (Jess overrode this owner's 0.8s lean), Trigger props.tapped changing on the synced mtg-card shape (toggled by onClick tldraw's rotate handle stays reserved for free rotation, never repurposed for tap)
MtgCardShapeUtil has a component method, and MtgCardShapeUtil is in apps/tabletop/src
Holds
Animation Hosted counter's tap catch-up (rotation + orbit), Where Tabletop, MtgCounterShapeUtil component(), Status Working ( 6713421 rotation-only, extended 2026-08-12 with orbit compensation), Duration 0.5s ease-out, matching the card's own swing, Trigger Host card's props.tapped changing, read via useValue inside the counter's shape util
MtgCounterShapeUtil has a component method, and MtgCounterShapeUtil is in apps/tabletop/src
Holds
WhatHappened changes: Does it modify the WhatHappened interface or how GameState methods populate it? getAnimationClassHelper() in shared-components.ts must match.
2 rules from this sentence
GameState depends on WhatHappened
checks “Does it modify the WhatHappened interface or how GameState methods populate it?”
Holds
WhatHappened is a contract
checks “WhatHappened interface”
Holds
formatHtmlHead(options) in src/view/common/html-layout.ts — options: {title, stylesheets?, additionalFonts?, scriptsHtml?}.
formatHtmlHead is in apps/shuffler/src/view/common
Holds
formatHtmlHead(options) in src/view/common/html-layout.ts — options: {title, stylesheets?, additionalFonts?, scriptsHtml?}. The skeleton, in fixed order: meta charset + viewport, escaped title (escapeHtml inside the shell — deck names come from Archidekt), font preconnects + one Google Fonts <link> (Orbitron always, plus additionalFonts), /fleet/tokens.css FIRST, /styles.css, then options.stylesheets in the order given, then /browser-tab-id.js, /hny.js, the guarded Hny.initializeTracing block,
formatHtmlHead depends on escapeHtml
Holds
Loaded on both /game (GAME_HEAD_SCRIPTS_HTML in src/view/common/html-layout.ts) and /prepare (views/prepare.ejs, alongside table-look-focus.js, which it doesn't replace — that file handles the table-look picker's own htmx-swap focus restoration, a different problem).
GAME_HEAD_SCRIPTS_HTML is in apps/shuffler/src/view/common
Holds
Google Fonts — Orbitron, Ovo, Risque, loaded from fonts.googleapis.com by two head sources (down from three since b268414, 2026-08-08): the Shuffler's one page shell (formatHtmlHead in src/view/common/html-layout.ts — head.ejs is just an adapter over it) and apps/tabletop/index.html.
formatHtmlHead is in apps/shuffler/src/view/common
Holds
HTML that interpolates user-supplied text must escape it. Deck names come from Archidekt. escapeHtml lives in src/view/common/shared-components.ts (moved there from active-game-page.ts on 2026-08-07, where it was module-private) — import it rather than writing a second copy.
escapeHtml is in apps/shuffler/src/view/common
Holds
formatActiveGameHtmlSection (active-game-page.ts) now emits commandZoneHtml, revealedCardsHtml, librarySectionHtml in that sequence.
formatActiveGameHtmlSection is in apps/shuffler/src/view/play-game
Holds
sleeveTintStyle(sleeveColor, withTextColor) in shared-components.ts is the one place the inline style string is built: formatDeckTitleHtmlFragment (withTextColor: true) and formatCommandZoneHtmlFragment (withTextColor: false, reading game.sleeveColor) both call it, as does prep-view-helpers.ts for /prepare (prep.sleeveColor).
2 rules from this sentence
sleeveTintStyle is in apps/shuffler/src/view/common
checks “sleeveTintStyle(sleeveColor, withTextColor) in shared-components.ts”
Holds
formatDeckTitleHtmlFragment depends on sleeveTintStyle
checks “formatDeckTitleHtmlFragment (withTextColor: true) and formatCommandZoneHtmlFragment (withTextColor: false, reading game.sleeveColor) both call it”
Holds
isDarkHex in shared-components.ts is now the only implementation of the formula in the codebase, because every pick is a real hx-post that re-renders the server's own markup rather than a client guess at what the server would render.
isDarkHex is in apps/shuffler/src/view/common
Holds
That's true only within the Shuffler. Table-layout ticket 21 (2026-08-11, commander-damage counters) reopened the hazard across ships: MtgLifeCounterShapeUtil.tsx (Tabletop) needs the same dark/light call for its identity-band text and has no route to shared-components.ts, so it carries a second, hand-ported isDarkHex, commented as a manual-sync copy.
MtgLifeCounterShapeUtil may not depend on apps.shuffler.src.view.common.shared-components.isDarkHex
Holdstabletop shuffler
All four background-tint call sites — command-zone surround and deck-title on both /prepare (prep-view-helpers.ts) and /game (shared-components.ts's formatCommandZoneHtmlFragment, active-game-page.ts) — now call sleeveTintStyle(secondaryColor, …) instead of sleeveTintStyle(sleeveColor, …).
formatCommandZoneHtmlFragment depends on sleeveTintStyle
Holds
The mana-pie hexes live twice by design: --mana-* in packages/design-tokens/tokens.css and SLEEVE_QUICK_PICKS in apps/shuffler/src/table-look.ts (domain data — a CSS var() can't be a persisted value). The table-look.ts comment says "change a token there, visit here"; honour it.
SLEEVE_QUICK_PICKS is in apps/shuffler/src
Holds
/game now paints the picked mat too — CLOSED (2026-08-09). GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep at /start-game and /restart-game (GameState.newGame gained two trailing optional params; both call sites in app.ts pass prep.sleeveColor, prep.playmatImagePath).
7 rules from this sentence
GameState has newGame
checks “GameState.newGame gained two trailing optional params”
Holds
GameState has sleeveColor
checks “GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep”
Holds
GameState has playmatImagePath
checks “GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep”
Holds
PersistedGameState has sleeveColor
checks “GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep”
Holds
PersistedGameState has playmatImagePath
checks “GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep”
Holds
PersistedGamePrep has sleeveColor
checks “CLOSED (2026-08-09).** GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep at /start-game and /restart-game (GameState.newGame gained two trailing optional params; both call sites in app.ts pass prep.sleeveColor, prep.playmatImagePath).”
Holds
PersistedGamePrep has playmatImagePath
checks “CLOSED (2026-08-09).** GameState/ PersistedGameState snapshot sleeveColor/playmatImagePath off PersistedGamePrep at /start-game and /restart-game (GameState.newGame gained two trailing optional params; both call sites in app.ts pass prep.sleeveColor, prep.playmatImagePath).”
Holds
formatGamePageHtmlPage (active-game-page.ts) sets the same inline longhand background-image on .playmat.playmat-game that /prepare already uses — never the shorthand, same reasoning as the mat-preview rule above.
formatGamePageHtmlPage is in apps/shuffler/src/view/play-game
Holds
The library stack is also now sleeve-aware on both pages: formatLibraryStack/formatLibraryCardBack (shared-components.ts) render each card back as a flat-hex `<div class="...
2 rules from this sentence
formatLibraryStack is in apps/shuffler/src/view/common
checks “formatLibraryStack/formatLibraryCardBack (shared-components.ts)”
Holds
formatLibraryCardBack is in apps/shuffler/src/view/common
checks “formatLibraryCardBack (shared-components.ts)”
Holds
--seat-primary/--seat-secondary/--seat-text-on-primary/--seat-text-on-secondary are set as an inline style on .playmat-game (formatGamePageHtmlPage in active-game-page.ts, via seatColorCustomProperties), not #game-container — #game-container gets outerHTML-swapped on every game-state update via HTMX, so anything set on it is lost on the next swap.
formatGamePageHtmlPage depends on seatColorCustomProperties
Holds
LibraryPortalOverlay.tsx's conic-gradient swirl, rendered via TLComponents.InFrontOfTheCanvas (the app's first use of that slot, wired in TablePage.tsx), is for the one case the ring can't cover: a zone whose opaque picture would hide an interior tint underneath it (today, only the library — see README → tldraw limits, "an opaque picture layered over a zone box hides that box's interior").
TablePage uses TLComponents
Holds
The text layout is a fourth file, and it is deliberately MINIMAL (reverted to this same-day, 2026-08-08 — see history.md): counterTextFit.ts (~40 lines) exposes fitCounterFont(text, w, h), which shrinks the font from the 0.32 × h base until an ESTIMATED wrapped block (0.8em/char, 0.85 wrap slack) fits the SQUARE content box.
fitCounterFont is exported
Holds
It lives in apps/tabletop/src/server/tableFurniture.ts → ensurePlayerArea (grep toRichText) — a server-side draw, not a ShapeUtil.
ensurePlayerArea is in apps/tabletop/src/server
Holds
This label's text baseline is now a measured shared datum other shapes depend on (2026-08-12, tabletop-name-baseline-align). NAME_TEXT_BASELINE = 50 in apps/tabletop/src/server/cardLayout.ts is the glyph baseline's offset below the text shape's top, measured off the live render (stock serif, size "m", scale: 2) because tldraw owns text metrics and there's no token to read it from
NAME_TEXT_BASELINE is in apps/tabletop/src/server
Holds
LIBRARY_PILE_INSET (12) in src/shared/mtgZoneShape.ts is shared server/client — tableFurniture.ts uses it for the card-back image geometry, MtgZoneShapeUtil for the sleeve pile.
2 rules from this sentence
LIBRARY_PILE_INSET is in apps/tabletop/src/shared
checks “LIBRARY_PILE_INSET (12) in src/shared/mtgZoneShape.ts is shared server/client”
Holds
MtgZoneShapeUtil depends on LIBRARY_PILE_INSET
Holdsclient shared
ZONE_LABEL_BAND (40) joined it there 2026-08-09 (0d61890), shared for the same reason: every card-holding zone reserves 40 units of label headroom at its top, and both the card-back image (tableFurniture.ts) and the sleeve pile (MtgZoneShapeUtil) now start below the band
2 rules from this sentence
ZONE_LABEL_BAND is in apps/tabletop/src/shared
checks “ZONE_LABEL_BAND (40) joined it there 2026-08-09 (0d61890), shared for the same reason”
Holds
MtgZoneShapeUtil depends on ZONE_LABEL_BAND
checks “the sleeve pile (MtgZoneShapeUtil) now start below the band”
Holdsclient shared
Implemented as inline CSSProperties in MtgCounterShapeUtil.tsx (still no Tabletop ship-local stylesheet — ticket 18 deliberately didn't start one).
MtgCounterShapeUtil uses CSSProperties
Holds
then the images moved to their own directory (apps/shuffler/public/images/playmats/) and PLAYMATS became a directory scan (loadPlaymats()) rather than a literal array — dropping an image file in makes it selectable, no code change.
PLAYMATS depends on loadPlaymats
Holds
A new color prop on the shape (src/shared/mtgTitleShape.ts), computed server-side by darkerColor() in tableFurniture.ts (relative-luminance compare) from the raw primaryColor/ secondaryColor hexes on seat.joined — domain data, same identity-data exemption as sleeveColor, precedent /game's --seat-primary/--seat-secondary.
2 rules from this sentence
MtgTitleShapeProps has color
checks “A new color prop on the shape (src/shared/mtgTitleShape.ts)”
Holds
darkerColor is in apps/tabletop/src/server
checks “computed server-side by darkerColor() in tableFurniture.ts”
Holds
sleeveTintStyle(sleeveColor, withTextColor), exported from shared-components.ts, computes the inline background-color (and, when withTextColor is true and the hex reads dark by the same BT.601 formula, color: white) that applySleeveTint used to compute only in the browser it is now the only implementation of that formula in the codebase, where before prep-picker.js's isDark and this isDarkHex had to be kept in sync by hand. formatDeckTitleHtmlFragment takes an optional sleeveColor param and calls it with withTextColor: true (the plaque's lettering can flip); formatCommandZoneHtmlFragment reads game.sleeveColor and calls it with withTextColor: false (the surround has no text to flip).
2 rules from this sentence
formatDeckTitleHtmlFragment depends on sleeveTintStyle
checks “formatDeckTitleHtmlFragment takes an optional sleeveColor param and calls it with withTextColor: true”
Holds
formatCommandZoneHtmlFragment depends on sleeveTintStyle
checks “formatCommandZoneHtmlFragment reads game.sleeveColor and calls it with withTextColor: false”
Holds
Confirmed working, not just argued, 2026-08-08 (tabletop-physics ticket 13): MtgZoneShapeUtil's component() sets fontFamily: "var(--font-chrome)" on a plain div inside HTMLContainer, and it resolves to Orbitron — checked both by reading the DOM's computed font-family in a live browser and by screenshot.
MtgZoneShapeUtil has a component method
Holds
tldraw's toast system renders with its own default visual treatment, not the fleet's identity — recorded, not fought (2026-08-12). useToasts().addToast() (TablePage.tsx's COPY_DISABLED_TOAST, the "copy doesn't work here, use duplicate instead" hint) is the fleet's first toast.
COPY_DISABLED_TOAST is in apps/tabletop/src/client
Holds
tldraw owns that metric (its own stroke geometry, and canvas text can't use the fleet fonts anyway — same font-enum limit), so there's no token or CSS to read it from: NAME_TEXT_BASELINE in apps/tabletop/src/server/cardLayout.ts is measured off the live render.
NAME_TEXT_BASELINE is in apps/tabletop/src/server
Holds
The typeface names still appear in the two <head> sources (down from three since b268414, 2026-08-08: the Shuffler's one page shell, formatHtmlHead in src/view/common/html-layout.ts, plus the Tabletop's index.html) — that's the Google Fonts <link> fetching the files, a separate concern from naming a face in a rule, and it does not go through a token.
formatHtmlHead is in apps/shuffler/src/view/common
Holds
sleeveTintStyle(sleeveColor, withTextColor), exported from shared-components.ts, computes the inline background-color (and, when withTextColor is true and the hex reads dark by the same BT.601 formula, color: white) that applySleeveTint used to compute only in the browser
sleeveTintStyle is exported
Holds
CLOSED (2026-08-09).** GameState/ PersistedGameState gained sleeveColor/playmatImagePath (snapshotted from PersistedGamePrep at /start-game and /restart-game, optional fields, no version bump — same exception as tableName), and formatGamePageHtmlPage sets the same inline longhand background-image on .playmat.playmat-game that /prepare already uses
4 rules from this sentence
GameState has a sleeveColor field
Holds
GameState has a playmatImagePath field
Holds
PersistedGameState has a sleeveColor field
Holds
PersistedGameState has a playmatImagePath field
Holds
The library pile is rendered by MtgZoneShapeUtil itself via a new sleeveColor prop on mtg-zone: an inner solid rect inset by the shared LIBRARY_PILE_INSET (12, moved to apps/tabletop/src/shared/mtgZoneShape.ts, used by server image geometry and client sleeve geometry alike), square-cornered like the sleeved cards (its 5%-of-inset-width radius went in the same e53a27e).
MtgZoneShapeUtil depends on LIBRARY_PILE_INSET
Holdsclient shared
an inner solid rect inset by the shared LIBRARY_PILE_INSET (12, moved to apps/tabletop/src/shared/mtgZoneShape.ts, used by server image geometry and client sleeve geometry alike), square-cornered like the sleeved cards (its 5%-of-inset-width radius went in the same e53a27e).
LIBRARY_PILE_INSET is in apps/tabletop/src/shared
Holds
The count is deliberately open-ended, not settled at five (2026-08-09): it grew to 11 the same week when a player found the original five too high-contrast against cards/text, adding six lower-contrast art crops to PLAYMATS in src/table-look.ts — no CSS or markup change was needed, since table-look-panel.ejs iterates the array generically and .table-look-mats already wraps.
PLAYMATS is in apps/shuffler/src
Holds
PLAYMATS stopped being a hand-curated literal array entirely (2026-08-11). The images moved to their own directory, apps/shuffler/public/images/playmats/, and table-look.ts now builds PLAYMATS by scanning that directory at startup (loadPlaymats()) instead of listing paths by hand — slug and display name are derived from the filename.
PLAYMATS depends on loadPlaymats
Holds
in the order it predicted them.** 96551ef replaced the locked stock tldraw text shape (serif, color: "green", scale: 2 — enum values, not choices) with a locked custom BaseBox shape (MtgTitleShapeUtil.tsx, drawn by ensurePlayerArea in apps/tabletop/src/server/tableFurniture.ts) so the whole label is one editable <input>
ensurePlayerArea is in apps/tabletop/src/server
Holds
the darker of the deck's two identity colors** — a new color prop on the mtg-title shape (src/shared/mtgTitleShape.ts, single source, in both client and server createTLSchema), computed server-side in tableFurniture.ts by the exported darkerColor(a?, b?) (relative-luminance compare, pick darker).
3 rules from this sentence
MtgTitleShape is in apps/tabletop/src/shared
checks “a new color prop on the mtg-title shape (src/shared/mtgTitleShape.ts, single source, in both client and server createTLSchema), computed server-side in tableFurniture.ts by the exported darkerColor(a?, b?) (relative-luminance compare, pick darker).”
Holds
darkerColor is in apps/tabletop/src/server
checks “a new color prop on the mtg-title shape (src/shared/mtgTitleShape.ts, single source, in both client and server createTLSchema), computed server-side in tableFurniture.ts by the exported darkerColor(a?, b?) (relative-luminance compare, pick darker).”
Holds
darkerColor is exported
checks “the exported darkerColor(a?, b?)”
Holds
store.connectionStatus from useSync's RemoteTLStoreWithStatus ("offline" | "online", populated only while store.status === "synced-remote", sourced from @tldraw/sync's ClientWebSocketAdapter via onStatusChange): first documented here by apps/tabletop/src/client/useReconnectSpans.ts no separate "reconnecting" state exists at this level, so a disconnect/reconnect cycle is only observable as an offline→online transition pair. Wired into TablePage.tsx alongside useCardArrivalSpans/usePhysicsAnnouncements, same inSpan() idiom.
2 rules from this sentence
useReconnectSpans depends on inSpan
HoldsuseReconnectSpans.ts observability
TablePage depends on useReconnectSpans
Holds
apps/tabletop/src/server/spineSubscriber.ts is the live example; apps/shuffler/src/port-spine/events/HttpSpineStreamGateway.ts (this ship's own Spine SSE subscriber, ported from the Tabletop's, and the only file in the Shuffler that imports undici) is the second.
2 rules from this sentence
HttpSpineStreamGateway imports undici
checks “apps/shuffler/src/port-spine/events/HttpSpineStreamGateway.ts (this ship's own Spine SSE subscriber, ported from the Tabletop's, and the only file in the Shuffler that imports undici) is the second.”
Holds
HttpSpineStreamGateway is in apps/shuffler/src/port-spine/events
checks “apps/shuffler/src/port-spine/events/HttpSpineStreamGateway.ts”
Holds
The Shuffler's one page shell (formatHtmlHead in apps/shuffler/src/view/common/html-layout.ts) — every page's browser telemetry bootstrap (tab-id script → hny.js → guarded Hny.initializeTracing, in that order) comes from this one function; EJS pages reach it through views/partials/head.ejs. The X-Browser-Tab-Id/ game.browser_tab_id browser↔server correlation depends on it.
formatHtmlHead is in apps/shuffler/src/view/common
Holds
HttpSpineEventsGateway.sendEvent reuses the Shuffler's Tabletop-facing helper to build the envelope (shared buildCardPlayedEvent) and posts the full envelope as-is, traceparent included
HttpSpineEventsGateway has sendEvent
Holds
GameState.recordSpineJoin itself stamps nothing; telemetry stays in the HTTP layer.
GameState has recordSpineJoin
Holds
Adding a game-mutation route in apps/shuffler/src/app.ts: all 13 game-mutation routes go through apply-game-command.ts's applyGameCommand(), which owns the "not-found"/"incompatible-version" markCurrentSpanAsError calls for all of them — don't re-add per-route copies of those two.
applyGameCommand depends on markCurrentSpanAsError
Holds
applyGameCommand also setCommonSpanAttributes({ tableName, playerName }) right after the game loads, so every mutation route gets table.name/player.name for free — a new mutation route needs nothing extra.
applyGameCommand depends on setCommonSpanAttributes
Holds
The Shuffler reaches exactly one other ship, through one directory: port-spine/. Since the 2026-09-06 layering refactor that directory holds two ports, one per capability — join/ (JoinTablePort) and events/ (SpineEventsPort, both directions) — each with an adapter (domain↔envelope translation, reconnect orchestration) over a gateway (the actual fetch).
2 rules from this sentence
JoinTablePort is in apps/shuffler/src/port-spine/join
checks “join/ (JoinTablePort)”
Holds
SpineEventsPort is in apps/shuffler/src/port-spine/events
checks “events/ (SpineEventsPort, both directions)”
Holds
apps/shuffler/src/port-tabletop/ holds envelope-shape helpers only (buildCardPlayedEvent, the CardPlayedEvent/EventEnvelope types) — don't add an HTTP client back into it on the theory the directory name implies one.
3 rules from this sentence
buildCardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
CardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
EventEnvelope is in apps/shuffler/src/port-tabletop
Holds
If a future change needs the Shuffler to reach the Tabletop directly again, that's a new decision, not a revert — ask before adding it.
nothing in apps/shuffler/src may depend on apps/tabletop/src
Holdsshuffler tabletop
undici.Agent lifetime under the port/adapter/gateway layering: createHeartbeatAwareDispatcher() is a constructor default on HttpSpineStreamGateway, which is itself a constructor default on HttpSpineEventsAdapter, of which server.ts builds exactly one — one connection pool per process, down from one per subscription.
HttpSpineEventsAdapter depends on HttpSpineStreamGateway
Holds
and apps/tabletop/src/server/spineSubscriber.ts's createHeartbeatAwareDispatcher() now uses bounded values instead — HEADERS_TIMEOUT_MS = 5_000 (headers arrive with the immediate heartbeat now, so this only needs to cover real network/scheduling latency) and BODY_TIMEOUT_MS = 45_000 (three heartbeat intervals — one missed beat is noise, three means the connection is actually dead).
createHeartbeatAwareDispatcher is in apps/tabletop/src/server
Holds
Adding a third Tabletop server event handler alongside handleSeatJoined (seatJoined.ts, span "add player furniture") and handleCardArrival (cardArrival.ts, span "place arrived card"): both wrap only the placement/furniture-creation work — the part touching entry.room.updateStore
handleSeatJoined is in apps/tabletop/src/server
Holds
Also stamp table.name via tableNameFromSlug(tableName) (apps/tabletop/src/shared/slugify.ts), never the raw route param — since TableSlug.mint (services/spine/lib/table_slug.rb) the Tabletop's tableName/tableSlug param is an id-bearing slug (<name-slug>-<8-hex>), not a bare display name; stamping it raw as table.name breaks the cross-ship filter.
tableNameFromSlug is in apps/tabletop/src/shared
Holds
TablePage.tsx (the browser side, mtg-tabletop-web dataset) does NOT yet do this — its setGlobalAttrs({ "table.name": tableSlug }) and inSpan("table page opened", ...) calls still stamp the raw, id-bearing slug.
3 rules from this sentence
TablePage is in apps/tabletop/src/client
checks “TablePage.tsx (the browser side”
Holds
TablePage depends on setGlobalAttrs
checks “its setGlobalAttrs({ "table.name": tableSlug }) and inSpan("table page opened", ...) calls still stamp the raw, id-bearing slug.”
HoldsTablePage.tsx observability
TablePage depends on inSpan
checks “inSpan("table page opened", ...) calls”
HoldsTablePage.tsx observability
Adding a new named event to usePhysicsAnnouncements.ts (or a third store.listen() → inSpan() hook alongside it and useCardArrivalSpans.ts): keep detection where the gesture's own hook already computes it — this listener only translates the resulting store diff into a span name.
useCardArrivalSpans depends on inSpan
HoldsuseCardArrivalSpans.ts observability
Wired into TablePage.tsx alongside useCardArrivalSpans/usePhysicsAnnouncements, same inSpan() idiom.
2 rules from this sentence
TablePage depends on useCardArrivalSpans
Holds
TablePage depends on usePhysicsAnnouncements
Holds
Out of tabletop-shape-mechanics' territory (that owner's KB records this explicitly, 2026-09-01): no ShapeUtil hooks, no writes, no store.listen() — a one-shot read on a status flip, this owner's territory.
useReconnectSpans may not use ShapeUtil
Holds
Wrapping another tldraw stock UI action (uiOverrides.actions in TablePage.tsx) in inSpan(): undo/redo are now wrapped alongside the pre-existing copy override (2026-08-20)
uiOverrides depends on inSpan
HoldsTablePage.tsx observability
matched by a small pure predicate in its own file (apps/shuffler/src/game-events-route-filter.ts, isGameEventsStreamPath(url), unit-tested) rather than an inline lambda in tracing.ts — keep the match logic in its own tested file for the same reason telemetry-sampler.ts's matchers are.
isGameEventsStreamPath is in apps/shuffler/src
Holds
Adding any new browser-side fetch()/XHR in the Tabletop: as of 2026-09-07, apps/tabletop/src/client/observability/index.ts's initTracing() does register fetch/XHR auto-instrumentation (registerInstrumentations() with FetchInstrumentation/ XMLHttpRequestInstrumentation, ignoreUrls built by buildExportDestinationIgnoreUrls)
initTracing depends on buildExportDestinationIgnoreUrls
Holds
The one exception: a call that isn't a fetch/XHR at all — TablePage.tsx's WebSocket connection URI is the standing example, since fetch/XHR instrumentation cannot touch a WS handshake URL. For that shape, currentTraceparent() is still the right tool and is still exported for exactly this caller.
TablePage depends on currentTraceparent
HoldsTablePage.tsx observability
For that shape, currentTraceparent() is still the right tool and is still exported for exactly this caller.
currentTraceparent is exported
Holds
A deliberate telemetry value change — the only one in the port/adapter/gateway layering refactor. The pattern doc (apps/shuffler/notes/DESIGN-layering.md) says a gateway must not leak its provider's error types, so all three Shuffler→Spine gateways — port-spine/join/HttpSpineJoinGateway, port-spine/events/HttpSpineEventsGateway, and port-spine/events/HttpSpineStreamGateway now wrap every failure in SpineGatewayError (port-spine/SpineGatewayError.ts), preserving message verbatim and keeping the original as cause.
3 rules from this sentence
HttpSpineJoinGateway depends on SpineGatewayError
checks “port-spine/join/HttpSpineJoinGateway, port-spine/events/HttpSpineEventsGateway, and port-spine/events/HttpSpineStreamGateway now wrap every failure in SpineGatewayError (port-spine/SpineGatewayError.ts), preserving message verbatim and keeping the original as cause.”
Holdsjoin SpineGatewayError.ts
HttpSpineEventsGateway depends on SpineGatewayError
checks “port-spine/join/HttpSpineJoinGateway, port-spine/events/HttpSpineEventsGateway, and port-spine/events/HttpSpineStreamGateway now wrap every failure in SpineGatewayError (port-spine/SpineGatewayError.ts), preserving message verbatim and keeping the original as cause.”
Holdsevents SpineGatewayError.ts
HttpSpineStreamGateway depends on SpineGatewayError
checks “and port-spine/events/HttpSpineStreamGateway now wrap every failure in SpineGatewayError (port-spine/SpineGatewayError.ts), preserving message verbatim and keeping the original as cause.”
Holdsevents SpineGatewayError.ts
logError(message, attributes, error?) in apps/tabletop/src/client/observability/index.ts.
logError is in apps/tabletop/src/client/observability
Holds
Where apps/shuffler/src/telemetry-sampler.ts, What it is BackgroundChatterSampler — keeps CHATTER_SAMPLE_RATIO = 0.01 of probes ( kube-probe , elb-healthchecker by UA) + /health + static assets by extension 100% of everything else Reads both semconv spellings (Invariant 4) Unit tested
BackgroundChatterSampler depends on CHATTER_SAMPLE_RATIO
Holds
Likewise, dispatchSpineEventForGame still opens the span itself and awaits all its work inside startActiveSpan's callback, and SpineEventsAdapter.followTable awaits applyEvent inline (serializing a replay burst through a processingChain promise so events stay in arrival order) — so the port never opens a span and the caller's span always encloses the work.
SpineEventsAdapter has followTable
Holds
usePhysicsAnnouncements.ts generalizes the same pattern from one span to a whole vocabulary. Where useCardArrivalSpans.ts is store.listen() → inSpan() for exactly one named event,
useCardArrivalSpans depends on inSpan
HoldsuseCardArrivalSpans.ts observability
usePhysicsAnnouncements.ts generalizes the same pattern from one span to a whole vocabulary. Where useCardArrivalSpans.ts is store.listen() → inSpan() for exactly one named event, the newer hook fans the same shape across many kinds of tldraw store mutations (card.tapped/untapped, card.transformed (formerly card.flipped; renamed 2026-10-05, no board or trigger referenced it), card.turnedFaceDown, card.zoneMoved, counter.attached, plus a generic shape.created/moved/changed fallback). Both hooks are wired side by side in TablePage.tsx.
2 rules from this sentence
TablePage depends on usePhysicsAnnouncements
Holds
TablePage depends on useCardArrivalSpans
Holds
TablePage.tsx's uiOverrides.actions now wraps tldraw's stock undo/redo in inSpan(), next to the existing copy override (2026-08-20)
2 rules from this sentence
uiOverrides depends on inSpan
checks “TablePage.tsx's uiOverrides.actions now wraps tldraw's stock undo/redo in inSpan()”
HoldsTablePage.tsx observability
TablePage depends on inSpan
HoldsTablePage.tsx observability
useReconnectSpans.ts — the fleet's first documented use of tldraw sync's connectionStatus signal. useSync's returned RemoteTLStoreWithStatus exposes store.connectionStatus: "offline" | "online", populated only while store.status === "synced-remote" — sourced from @tldraw/sync's ClientWebSocketAdapter via onStatusChange;
useReconnectSpans imports @tldraw/sync
Holds
A deliberate telemetry value change — the only one in the port/adapter/gateway layering refactor. The pattern doc (apps/shuffler/notes/DESIGN-layering.md) says a gateway must not leak its provider's error types, so all three Shuffler→Spine gateways — port-spine/join/HttpSpineJoinGateway, port-spine/events/HttpSpineEventsGateway, and port-spine/events/HttpSpineStreamGateway
3 rules from this sentence
HttpSpineJoinGateway is in apps/shuffler/src/port-spine/join
Holds
HttpSpineEventsGateway is in apps/shuffler/src/port-spine/events
Holds
HttpSpineStreamGateway is in apps/shuffler/src/port-spine/events
Holds
now wrap every failure in SpineGatewayError (port-spine/SpineGatewayError.ts), preserving message verbatim and keeping the original as cause.
SpineGatewayError is in apps/shuffler/src/port-spine
Holds
Log message spine sse connection error, reconnecting ( port-spine/events/SpineEventsAdapter.ts ), exception.type before TypeError / Error (incl undici's UND_ERR_HEADERS_TIMEOUT shapes), after SpineGatewayError
SpineEventsAdapter is in apps/shuffler/src/port-spine/events
Holds
A span is created for every SSE event kind, not only card.played — a dropped kind would otherwise never have a span, so seat.taken/table.created/future kinds would be invisible in Honeycomb; only the routing to applyCardArrival inside the span stays card.played-only.
dispatchSpineEvent depends on applyCardArrival
Holds
Three live body-embedded mint sites, all format identically (00-{traceId}-{spanId}-{flags}): Where apps/tabletop/src/client/observability/index.ts currentTraceparent, Behavior with no active span Returns undefined — used only for websocket-URL propagation, never a durable field, so "no span, no value" is correct there
currentTraceparent is in apps/tabletop/src/client/observability
Holds
The ignoreUrls shape matters, and a plain string would have silently missed a case. buildExportDestinationIgnoreUrls(config, origin) (same file, pure and exported) resolves config.tracesUrl/config.logsUrl against location.href into absolute-URL RegExps.
2 rules from this sentence
buildExportDestinationIgnoreUrls is in apps/tabletop/src/client/observability
Holds
buildExportDestinationIgnoreUrls is exported
Holds
currentTraceparent() itself stays exported from observability/index.ts for exactly this caller.
currentTraceparent is exported
Holds
The Shuffler does NOT have this gap. Checked (grep -rn "registerInstrumentations\|WebTracerProvider\|instrumentation-fetch" apps/shuffler) whether the Shuffler's browser-side telemetry has the same hole — it doesn't.
nothing in apps/shuffler/src may use WebTracerProvider
Holds
There is exactly ONE place the Shuffler's browser telemetry starts: formatHtmlHead() in apps/shuffler/src/view/common/html-layout.ts.
formatHtmlHead is in apps/shuffler/src/view/common
Holds
The guard covers the key, not just presence of Hny/browserTabId. The whole guard+init body ships as one exported literal script-source string constant, HONEYCOMB_TRACING_INIT_SCRIPT (apps/shuffler/src/view/common/html-layout.ts), so the exact source the browser runs is also what apps/shuffler/test/html-layout-tracing-guard.test.ts evals (via new Function)
HONEYCOMB_TRACING_INIT_SCRIPT is in apps/shuffler/src/view/common
Holds
Server side (per-request span attribute). Two stamping sites keep telemetry in the HTTP/command layer, never in the domain GameState:
GameState may not depend on setCommonSpanAttributes
Holds
Mutation routes — applyGameCommand() (apps/shuffler/src/apply-game-command.ts) calls setCommonSpanAttributes({ tableName: game.tableName, playerName: game.playerName }) right after the game loads, covering all 13 game-mutation POST routes in one place (the same choke point that owns the not-found/version-conflict error stamping).
applyGameCommand depends on setCommonSpanAttributes
Holds
Browser side (resource attributes). formatGamePageHtmlPage (active-game-page.ts) passes game.tableName/game.playerName into formatPageWrapper → formatHtmlHead → the inline initHoneycombTracing(..., tableName, playerName) call, which conditionally adds "table.name"/"player.name" to the browser OTel resource next to app.dev_mode.
2 rules from this sentence
formatGamePageHtmlPage depends on formatPageWrapper
Holdsplay-game common
formatPageWrapper depends on formatHtmlHead
Holds
apps/tabletop/src/shared/slugify.ts adds tableNameFromSlug() (strips a trailing -<8-hex>) specifically so table.name keeps its old meaning (bare human name, matching the Shuffler) instead of silently becoming the full slug.
tableNameFromSlug is in apps/tabletop/src/shared
Holds
the Tabletop's browser dataset (mtg-tabletop-web) was NOT part of this fix.** TablePage.tsx's setGlobalAttrs({ "table.name": tableSlug }) and its inSpan("table page opened", ..., { "table.name": tableSlug }) call still stamp the raw, id-bearing tableSlug prop as table.name — only the server-side call sites above route through tableNameFromSlug().
TablePage depends on setGlobalAttrs
HoldsTablePage.tsx observability
import tableNameFromSlug client-side (it has no server-only dependencies) and apply it before the setGlobalAttrs/inSpan calls, stamping the untouched tableSlug separately as table.slug for symmetry with the server side.
tableNameFromSlug may not depend on apps/tabletop/src/server
Holdsshared server
Shuffler side. SpineJoinResult (apps/shuffler/src/port-spine/join/spineWire.ts) and SpineJoinOutcome (apps/shuffler/src/table-sync/sendToSpine.ts) carry seatId through;
4 rules from this sentence
SpineJoinResult is in apps/shuffler/src/port-spine/join
Holds
SpineJoinOutcome is in apps/shuffler/src/table-sync
Holds
SpineJoinResult has seatId
Holds
SpineJoinOutcome has seatId
Holds
GameState.recordSpineJoin (apps/shuffler/src/GameState.ts) adopts outcome.seatId as this.seatId when present (the field is no longer readonly) — deliberately with no telemetry call inside GameState itself, per the rule that stamping stays in the HTTP/command layer, never the domain model.
3 rules from this sentence
GameState is in apps/shuffler/src
Holds
GameState has a seatId field
Holds
GameState has recordSpineJoin
Holds
Wire threading. res.locals.sessionId also flows through sendCardBeforeMutate → sendCardPlayedToSpineBestEffort → buildCardPlayedEvent's initiator (apps/shuffler/src/port-tabletop/types.ts), so card.played envelopes carry the same sessionId that's on the request span — one value, both places.
buildCardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
Browser side only (resource attribute). formatGamePageHtmlPage (active-game-page.ts) passes gameId: String(game.gameId) into formatPageWrapper → formatHtmlHead → the inline initHoneycombTracing(..., gameId) call, which adds "game.id" to the browser OTel resource next to app.dev_mode/table.name/player.name. Same conditional (if (gameId)) and same jsStringArg() escaping as the two name args.
formatHtmlHead depends on jsStringArg
Holds
Run identity on EVERY span, via a RunAttributesSpanProcessor stamping at onStart (verify.run.id, verify.ship, verify.git.sha) — copied from the Tabletop browser wrapper's GlobalAttributesSpanProcessor, the fleet's established way to do this.
GlobalAttributesSpanProcessor is in apps/tabletop/src/client/observability
Holds
Returns read-only array of GameCard & { location: LibraryLocation }
2 rules from this sentence
GameState depends on GameCard
Holds
GameState depends on LibraryLocation
Holds
File src/types.ts, Relevant Parts CardDefinition.cardTypes (union of all faces' types), CardDefinition.colorIdentity
CardDefinition has colorIdentity
Holds
File src/port-persist-state/types.ts, Relevant Parts GameCard interface (location, gameCardIndex)
3 rules from this sentence
GameCard is a contract
checks “GameCard interface”
Holds
GameCard has location
checks “GameCard interface (location, gameCardIndex)”
Holds
GameCard has gameCardIndex
checks “GameCard interface (location, gameCardIndex)”
Holds
Game route reconstructs GameState via GameState.fromPersistedGameState(persisted, cardRepository) — since JES-127 this also mints cardInstanceId on load for old saves (optional field, no version bump, signature unchanged). Harmless to library search: reads that never save just re-mint until some action persists.
GameState has a fromPersistedGameState method
Holds
Card repository is keyed by card_definition_id (CardDefinition.cardDefinitionId, formerly scryfallId); library search never reads the id.
CardDefinition has cardDefinitionId
Holds
game.listLibrary() - provides the cards to display
GameState has a listLibrary method
Holds
game.getStateVersion() - used for optimistic concurrency on card modal links
GameState has a getStateVersion method
Holds
If CardDefinition fields change (especially cardTypes, colorIdentity), the library search template mapping in src/app.ts needs updating (search for app.get("/library-modal/:gameId" and app.get("/prep-library-modal/:prepId" — line numbers drift).
2 rules from this sentence
CardDefinition has a cardTypes field
Holds
CardDefinition has a colorIdentity field
Holds
cardSource: "archidekt-custom" (optional on CardDefinition, absent = scryfall; card repository column card_source).
CardDefinition has cardSource
Holds
Position order is still the one true order internally (GameState.listLibrary() sorts by location.position — draw/Put on Top/Put on Bottom depend on it);
GameState has a listLibrary method
Holds
Aspect Card types source, Detail CardDefinition.cardTypes — pre-unioned across all faces/parts at ingestion
CardDefinition has cardTypes
Holds
apps/tabletop/src/server/cardArrival.ts exports applyCardArrival(tableName, body) — the shared validation/dedup/placement logic for a card.played event.
applyCardArrival is in apps/tabletop/src/server
Holds
In production, applyCardArrival is called exclusively by the Spine SSE dispatcher, apps/tabletop/src/server/spineEventDispatch.ts's dispatchSpineEvent — it subscribes to the Spine's per-table SSE stream, filters for card.played, continues the trace from the broadcast envelope's traceparent, and calls applyCardArrival inside that span.
dispatchSpineEvent depends on applyCardArrival
Holds
A second, test-only HTTP seam exists — apps/tabletop/src/server/testSeedRoute.ts's handleTestCardSeed, mounted at POST /test/tables/:tableName/cards only when ENABLE_TEST_SEED_ROUTE=true (set by verify.sh and cardArrival.test.ts, never in production) — for Playwright specs and vitest files that spawn the server as its own process with no live Spine to seed a card through; it calls applyCardArrival directly, the same function the SSE path calls.
handleTestCardSeed depends on applyCardArrival
Holds
A second, test-only HTTP seam exists — apps/tabletop/src/server/testSeedRoute.ts's handleTestCardSeed, mounted at POST /test/tables/:tableName/cards only when ENABLE_TEST_SEED_ROUTE=true (set by verify.sh and cardArrival.test.ts, never in production) — for Playwright specs and vitest files that spawn the server as its own process with no live Spine to seed a card through;
handleTestCardSeed is in apps/tabletop/src/server
Holds
Ticket 01 (2026-08-11, organizational split — see "Ticket 01" section below for the full writeup). apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx is now a thin shell: it still extends tldraw's BaseBoxShapeUtil<MtgCardShape> (not ImageShapeUtil — see "Ticket 12 landed" below) and still declares every override below — the override's mere presence is load-bearing regardless of its body, see the onClick-defers-selection quirk further down — but each override's body now lives in a sibling file and is called with this.editor passed through explicitly.
MtgCardShapeUtil is in apps/tabletop/src/client/shapes
Holds
it still extends tldraw's BaseBoxShapeUtil<MtgCardShape> (not ImageShapeUtil — see "Ticket 12 landed" below) and still declares every override below — the override's mere presence is load-bearing regardless of its body, see the onClick-defers-selection quirk further down — but each override's body now lives in a sibling file and is called with this.editor passed through explicitly.
MtgCardShapeUtil depends on MtgCardShape
Holdsclient shared
onClick(shape) (body: handleCardClick, cardTapClick.ts) — tap/untap toggle (JES-144).
2 rules from this sentence
MtgCardShapeUtil has an onClick method
checks “onClick(shape)”
Holds
MtgCardShapeUtil depends on handleCardClick
checks “body: handleCardClick”
Holds
Tap state lives in props.tapped (a real, validated boolean — no more reading it back out of rotation with a float-tolerance epsilon).
MtgCardShapeProps has tapped
Holds
onTranslateEnd(_initial, current) (body: handleTranslateEnd, cardZoneEntry.ts) — fires once, on the moved shape, when a drag settles. Three responsibilities live here:
2 rules from this sentence
MtgCardShapeUtil has an onTranslateEnd method
checks “onTranslateEnd(_initial, current)”
Holds
MtgCardShapeUtil depends on handleTranslateEnd
checks “body: handleTranslateEnd”
Holds
onTranslateEnd(_initial, current) (body: handleTranslateEnd, cardZoneEntry.ts) — fires once, on the moved shape, when a drag settles. Three responsibilities live here: Zone-entry detection (600cac1): resolves the zone under the card's center via zoneAt() (since ticket 18 returning the full ZoneHit — {id, zone} — not just the zone string, because eviction needs the zone shape's bounds), and if the card entered a new zone, logs it and stamps meta.zone for next time.
handleTranslateEnd depends on zoneAt
Holds
Zone-entry detection (600cac1): resolves the zone under the card's center via zoneAt() (since ticket 18 returning the full ZoneHit — {id, zone} — not just the zone string, because eviction needs the zone shape's bounds), and if the card entered a new zone, logs it and stamps meta.zone for next time.
3 rules from this sentence
zoneAt depends on ZoneHit
checks “resolves the zone under the card's center via zoneAt() (since ticket 18 returning the full ZoneHit”
Holds
ZoneHit has id
Holds
ZoneHit has zone
Holds
canReceiveNewChildrenOfType / canRemoveChildrenOfType / onDragShapesIn / onDragShapesOut (ticket 18; bodies: canReceivePassenger/canRemovePassenger/ handleDragShapesIn/handleDragShapesOut, cardPassengers.ts) — the card is a drop target and host for mtg-counter shapes, via tldraw's native drag-and-drop parenting.
6 rules from this sentence
MtgCardShapeUtil has canReceiveNewChildrenOfType
checks “canReceiveNewChildrenOfType”
Holds
MtgCardShapeUtil has canRemoveChildrenOfType
checks “canRemoveChildrenOfType”
Holds
MtgCardShapeUtil depends on canReceivePassenger
checks “bodies: canReceivePassenger”
Holds
MtgCardShapeUtil depends on canRemovePassenger
checks “canRemovePassenger”
Holds
MtgCardShapeUtil depends on handleDragShapesIn
checks “handleDragShapesIn”
Holds
MtgCardShapeUtil depends on handleDragShapesOut
checks “handleDragShapesOut”
Holds
component(shape) / getIndicatorPath(shape) (bodies: CardFace/cardIndicatorPath, cardRender.tsx) — new, required by BaseBoxShapeUtil. The card renders its own <img> (front or back URL chosen from props.face) instead of delegating to tldraw's image machinery.
4 rules from this sentence
MtgCardShapeUtil has a component method
checks “component(shape) / getIndicatorPath(shape)”
Holds
MtgCardShapeUtil has a getIndicatorPath method
checks “component(shape) / getIndicatorPath(shape)”
Holds
MtgCardShapeUtil depends on CardFace
checks “bodies: CardFace/cardIndicatorPath, cardRender.tsx”
Holds
MtgCardShapeUtil depends on cardIndicatorPath
checks “bodies: CardFace/cardIndicatorPath, cardRender.tsx”
Holds
New file apps/tabletop/src/server/cardRemoval.ts, applyCardRemoval(tableName, body): filters on envelope.occurredIn === "shuffler" so the Tabletop's own portal-initiated card.returned sends (which already deleted the shape client-side) don't loop back and try to remove it again, finds the mtg-card shape by exact props.instanceId match, and deletes it with a raw store.delete inside room.updateStore.
applyCardRemoval is in apps/tabletop/src/server
Holds
Passengers are reparented in place, using hand-rolled rotation math, not evictPassengers. Before deleting the card, applyCardRemoval walks store.getAll() for shapes with parentId === card.id and PASSENGER_TYPES.has(type), and rewrites each one's parentId to the card's own parentId,
applyCardRemoval may not depend on evictPassengers
Holdsserver client
This is the same category of rotation-composition math onDragShapesIn's reparent-zeroing (watch point 12) and nudgeOffAnotherCard's page-bounds read (watch point 25) both lean on, but worked out independently here rather than reused — there's no Editor to call editor.getShapePageBounds()/reparentShapes on server-side, so this is hand-rolled trig against the raw store records instead.
applyCardRemoval may not depend on nudgeOffAnotherCard
Holdsserver client
swallowCard (cardSwallow.ts) is send-then-commit, not fire-and-forget delete. It calls evictPassengers, then editor.animateShapes — spin twice (rotation + 2·2π·SWALLOW_SPINS) while shrinking (w/h → 1) and fading (opacity → 0) into the library zone's page-space center over 500ms
swallowCard depends on evictPassengers
Holds
BaseBoxShapeUtil.getInterpolatedProps — editor.animateShapes only interpolates x/y/rotation/opacity out of the box; a custom shape's own props need an explicit override to tween instead of snapping at the animation's end. MtgCardShapeUtil adds:
MtgCardShapeUtil has getInterpolatedProps
Holds
LibraryPortalOverlay.tsx instead renders in viewport space (editor.pageToViewport, following the armed zone's page bounds through zoom/pan), wired via TLComponents.InFrontOfTheCanvas in TablePage.tsx's components object next to the existing Toolbar/ContextMenu overrides. It reads a new useArmedLibraryZoneId(editor) — a thin narrowing of the same armedZoneIdSignal every other zone's glow reads, filtered to zone === "library" — so it's the identical arm/disarm decision, rendered through a different slot because this one shape has opaque content stacked on top of it that a component()-level treatment can't paint over.
LibraryPortalOverlay depends on useArmedLibraryZoneId
Holds
It reads a new useArmedLibraryZoneId(editor) — a thin narrowing of the same armedZoneIdSignal every other zone's glow reads, filtered to zone === "library" — so it's the identical arm/disarm decision, rendered through a different slot because this one shape has opaque content stacked on top of it that a component()-level treatment can't paint over.
useArmedLibraryZoneId depends on armedZoneIdSignal
Holds
the server-side arrival cascade (stackCardPosition, apps/tabletop/src/server/cardLayout.ts) keeps consecutive same-seat arrivals visibly offset, but that only covers a card's first landing on the Stack via card.played — a card dragged there by a player could land squarely on top of another card and fully hide it, with nothing to notice or correct it.
stackCardPosition is in apps/tabletop/src/server
Holds
Passing shapeUtils: [MtgCardShapeUtil] alone would silently drop geo/image/text/etc. from the client store's validation schema — any furniture using those types would fail to sync.
shapeUtils depends on MtgCardShapeUtil
HoldsTablePage.tsx shapes
The scryfallId → cardDefinitionId rename added the first migration on any custom shape here: mtgCardShapeMigrations in src/shared/mtgCardShape.ts (createShapePropsMigrationIds("mtg-card", { RenameScryfallId: 1 }), up/down move the value between keys). It is wired into the server schema above (migrations:) and the client as static override migrations on MtgCardShapeUtil.
MtgCardShapeUtil has migrations, and MtgCardShapeUtil depends on mtgCardShapeMigrations
Holdsclient shared
mtgCardShapeMigrations in src/shared/mtgCardShape.ts (createShapePropsMigrationIds("mtg-card", { RenameScryfallId: 1 }), up/down move the value between keys).
mtgCardShapeMigrations is in apps/tabletop/src/shared
Holds
apps/tabletop/src/shared/mtgZoneShape.ts (props/validators/TLGlobalShapePropsMap registration, same pattern as mtgCardShape.ts) and apps/tabletop/src/client/shapes/MtgZoneShapeUtil.tsx (BaseBoxShapeUtil<MtgZoneShape>).
3 rules from this sentence
MtgZoneShapeUtil depends on MtgZoneShape
Holdsclient shared
MtgZoneShape is in apps/tabletop/src/shared
Holds
MtgZoneShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgZoneShapeUtil.tsx”
Holds
The playmat's own picture is a prop on this shape, not a second shape (2026-08-11). MtgZoneShapeProps gained imageUrl: string | null, set only on zone: "playmat", same lifecycle as sleeveColor — written once at mint time in tableFurniture.ts's ensurePlayerArea, never mutated by a player action.
MtgZoneShapeProps has imageUrl
Holds
The same change made every pair of zone AABBs strictly disjoint (20-unit GAP, exported from cardLayout.ts), pairwise-asserted in test/cardLayout.test.ts, because an overlap would resolve via topmostZoneAt()'s draw-order tiebreak — deterministic but semantically meaningless. See watch point 8.
GAP is exported
Holds
playerAreaOrigin throws past the new MAX_SEATS export (4) instead of wrapping a fifth seat onto S, both seatJoined.ts and cardArrival.ts 409 first ("table is full: 4 seats"), and the disjointness invariant is additionally asserted over the actually-drawn mtg-zone shapes at the handler seam (test/seatJoined.test.ts, 21 zones at a full table).
MAX_SEATS is exported
Holds
apps/tabletop/src/client/shapes/zoneHitTest.ts (new) extracts the hit test into topmostZoneAt(editor, center), returning { id, zone } for the topmost mtg-zone shape whose page bounds contain center (same greatest-index tie-break as before, now with its rationale and watch-point-8 caveat written once instead of duplicated per caller).
topmostZoneAt is in apps/tabletop/src/client/shapes
Holds
MtgCardShapeUtil.zoneAt() now calls topmostZoneAt(...)?.zone instead of walking shapes itself.
MtgCardShapeUtil depends on topmostZoneAt
Holds
the same file also exports useIsZoneArmed(editor, zoneId), built on one computed() per Editor instance (a lazy WeakMap<Editor, Computed<TLShapeId | undefined>> — not one computed per zone shape).
2 rules from this sentence
useIsZoneArmed is in apps/tabletop/src/client/shapes, and useIsZoneArmed is exported
Holds
useIsZoneArmed is exported, and useIsZoneArmed is in apps/tabletop/src/client/shapes
Holds
MtgZoneShapeUtil.component() calls useIsZoneArmed(this.editor, shape.id) unconditionally at the top, before any conditional branching, purely to read derived state for rendering.
2 rules from this sentence
MtgZoneShapeUtil depends on useIsZoneArmed
checks “MtgZoneShapeUtil.component() calls useIsZoneArmed(this.editor, shape.id)”
Holds
MtgZoneShapeUtil has a component method
checks “MtgZoneShapeUtil.component()”
Holds
ZoneHit widened from {id, zone} to {id, zone, seatId} — topmostZoneAt now reads the winning candidate's props.seatId too, since the new check needs it.
3 rules from this sentence
topmostZoneAt depends on ZoneHit
checks “ZoneHit widened from {id, zone} to {id, zone, seatId} — topmostZoneAt now reads the winning candidate's props.seatId too”
Holds
ZoneHit has seatId
checks “ZoneHit widened from {id, zone} to {id, zone, seatId}”
Holds
ZoneHit has id, zone and seatId
checks “ZoneHit widened from {id, zone} to {id, zone, seatId}”
Holds
armedZoneIdSignal's computed body gets one new branch, placed after topmostZoneAt resolves a hit and before returning it:
armedZoneIdSignal depends on topmostZoneAt
Holds
apps/tabletop/src/shared/mtgLifeCounterShape.ts (MtgLifeCounterShapeProps = {w, h, value}, the standard TLGlobalShapePropsMap augmentation) and apps/tabletop/src/client/shapes/MtgLifeCounterShapeUtil.tsx (BaseBoxShapeUtil, no interaction hooks — same as mtg-zone).
5 rules from this sentence
MtgLifeCounterShapeProps is in apps/tabletop/src/shared
checks “apps/tabletop/src/shared/mtgLifeCounterShape.ts (MtgLifeCounterShapeProps = {w, h, value}, the standard TLGlobalShapePropsMap augmentation) and apps/tabletop/src/client/shapes/MtgLifeCounterShapeUtil.tsx (BaseBoxShapeUtil, no interaction hooks”
Holds
MtgLifeCounterShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgLifeCounterShapeUtil.tsx”
Holds
MtgLifeCounterShapeProps has w
checks “MtgLifeCounterShapeProps = {w, h, value}”
Holds
MtgLifeCounterShapeProps has h
checks “MtgLifeCounterShapeProps = {w, h, value}”
Holds
MtgLifeCounterShapeProps has value
checks “MtgLifeCounterShapeProps = {w, h, value}”
Holds
Minted at seat-join time in tableFurniture.ts's ensurePlayerArea, on the name row, far right, via lifeCounterPosition()/LIFE_COUNTER_W/ LIFE_COUNTER_H in cardLayout.ts, starting at value: 40.
4 rules from this sentence
lifeCounterPosition is in apps/tabletop/src/server
Holds
LIFE_COUNTER_W is in apps/tabletop/src/server
checks “LIFE_COUNTER_W/ LIFE_COUNTER_H in cardLayout.ts”
Holds
LIFE_COUNTER_H is in apps/tabletop/src/server
checks “LIFE_COUNTER_H in cardLayout.ts”
Holds
ensurePlayerArea depends on lifeCounterPosition
Holds
Registered via the standard four-step pattern (props file, TablePage.tsx's shapeUtils array, rooms.ts's createTLSchema).
2 rules from this sentence
shapeUtils depends on MtgLifeCounterShapeUtil
HoldsTablePage.tsx shapes
shapeUtils is in apps/tabletop/src/client
Holds
A fifth custom shape type, mtg-title (apps/tabletop/src/shared/mtgTitleShape.ts, props {w, h, text}; apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx, BaseBoxShapeUtil<MtgTitleShape>), replaces the locked stock text seat-name label in tableFurniture.ts's ensurePlayerArea.
3 rules from this sentence
MtgTitleShapeUtil depends on MtgTitleShape
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx, BaseBoxShapeUtil<MtgTitleShape>), replaces the locked stock text seat-name label in tableFurniture.ts's ensurePlayerArea.”
Holdsclient shared
MtgTitleShape is in apps/tabletop/src/shared
Holds
MtgTitleShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx”
Holds
A third custom shape type, mtg-counter (apps/tabletop/src/shared/mtgCounterShape.ts, props {w, h, text}; apps/tabletop/src/client/shapes/MtgCounterShapeUtil.tsx, BaseBoxShapeUtil<MtgCounterShape>): an unlocked, draggable disc with free editable text, blank by default.
2 rules from this sentence
MtgCounterShape is in apps/tabletop/src/shared
checks “A third custom shape type, mtg-counter (apps/tabletop/src/shared/mtgCounterShape.ts, props {w, h, text}; apps/tabletop/src/client/shapes/MtgCounterShapeUtil.tsx, BaseBoxShapeUtil<MtgCounterShape>):”
Holds
MtgCounterShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgCounterShapeUtil.tsx”
Holds
No onClick — text editing is tldraw's stock double-click-to-edit (canEdit(): true), specifically so this util never triggers the PointingShape selection-deferral quirk.
MtgCounterShapeUtil has a canEdit method
Holds
isAspectRatioLocked(): true keeps the box square, which is what makes border-radius: 50% draw a circle rather than an ellipse.
MtgCounterShapeUtil has an isAspectRatioLocked method
Holds
evictCounters reparents the counters to the page and editor.animateShapes them to spots from findOpenSpotsNearZoneEdge — a new pure-geometry seam (apps/tabletop/src/client/shapes/openSpotNearZoneEdge.ts, no Editor, unit-tested in test/openSpotNearZoneEdge.test.ts):
findOpenSpotsNearZoneEdge may not use Editor
Holds
evictCounters reparents the counters to the page and editor.animateShapes them to spots from findOpenSpotsNearZoneEdge — a new pure-geometry seam (apps/tabletop/src/client/shapes/openSpotNearZoneEdge.ts, no Editor, unit-tested in test/openSpotNearZoneEdge.test.ts): nearest zone edge to where the card entered, slots alternating outward (+1, −1, +2, −2…), "occupied" considering only mtg-card/mtg-counter bounds — furniture is fair ground to sit on.
findOpenSpotsNearZoneEdge is in apps/tabletop/src/client/shapes
Holds
apps/tabletop/src/client/shapes/MtgCounterTool.ts, a StateNode with id "mtg-counter": click-to-place one counter, then back to the select tool.
MtgCounterTool is in apps/tabletop/src/client/shapes
Holds
Every furniture-minting call site inside ensurePlayerArea and ensureStackDrawn — the playmat outline, the playmat image, the library zone and its image, the command zone, the graveyard, the exile zone, the seat name label, and the Stack — was switched from nextIndex to nextFurnitureIndex.
2 rules from this sentence
ensurePlayerArea depends on nextFurnitureIndex
Holds
ensureStackDrawn depends on nextFurnitureIndex
Holds
apps/tabletop/src/client/TablePage.tsx passes ContextMenu: TableContextMenu in the components: TLComponents object already used for Toolbar.
TablePage uses TLComponents
Holds
tapPartial (the pivot solve, previously a private method on MtgCardShapeUtil) moved to apps/tabletop/src/client/shapes/cardTap.ts as a standalone pure function — verified pure during review (reads only shape.rotation/shape.props.{w,h}, the module-level TAP_ANGLE, and the imported Vec helper) — no behavior change.
tapPartial is in apps/tabletop/src/client/shapes
Holds
Three changes, only the second and third of which are this owner's territory (the first — owner/isCommander becoming validated MtgCardShapeProps fields — is a fact the shape carries, not a mechanic; it grants no capability and adds no hook):
2 rules from this sentence
MtgCardShapeProps has an owner field
Holds
MtgCardShapeProps has an isCommander field
Holds
The mtgCardShape() builder (apps/tabletop/src/server/tableFurniture.ts, next to the existing zoneShape() helper): both mint seams now call this instead of writing their own store.put({...} as any) literal.
2 rules from this sentence
mtgCardShape is in apps/tabletop/src/server
checks “The mtgCardShape() builder** (apps/tabletop/src/server/tableFurniture.ts”
Holds
zoneShape is in apps/tabletop/src/server
checks “The mtgCardShape() builder (apps/tabletop/src/server/tableFurniture.ts, next to the existing zoneShape() helper):”
Holds
The fix is one function, apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts, registered once at Tldraw mount time (TablePage.tsx's onTldrawMount, renamed from aimCameraAtTheTable since it now does two things at mount, not one):
2 rules from this sentence
onTldrawMount depends on clearStaleSelectionOnPointerDown
Holds
clearStaleSelectionOnPointerDown is in apps/tabletop/src/client
checks “apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts”
Holds
cardPassengers.ts — PASSENGER_TYPES, the two can* gates (canReceivePassenger/canRemovePassenger), and onDragShapesIn/onDragShapesOut's bodies (handleDragShapesIn/handleDragShapesOut(editor, ...)), including the rotation-zeroing math for reparentShapes' page-rotation-preservation quirk.
2 rules from this sentence
MtgCardShapeUtil has onDragShapesIn
Holds
MtgCardShapeUtil has onDragShapesOut
Holds
apps/tabletop/src/client/closeContextMenuBeforeOutsideClick.ts (new) exports closeContextMenuBeforeOutsideClick(): () => void, registered from onTldrawMount in TablePage.tsx alongside clearStaleSelectionOnPointerDown(editor):
3 rules from this sentence
onTldrawMount depends on closeContextMenuBeforeOutsideClick
checks “registered from onTldrawMount in TablePage.tsx”
Holds
closeContextMenuBeforeOutsideClick is in apps/tabletop/src/client
checks “apps/tabletop/src/client/closeContextMenuBeforeOutsideClick.ts”
Holds
closeContextMenuBeforeOutsideClick is exported
checks “exports closeContextMenuBeforeOutsideClick(): () => void”
Holds
apps/tabletop/src/server/cardArrival.ts — split into a shared core plus two entry points, ticket 08 (tabletop-cards-come-and-go, 2026-08-23): placeArrivedCard(tableName, envelope, payload, faceDown, resolvePosition) (private) now holds the dedup/seat-check/span/mint/ store.put logic every arrival shares mints props.instanceId (moved out of meta by ticket 12) at shape creation (createShapeId; no longer mints a tldraw asset record — Transform is a pure props.face write now), builds the record via tableFurniture.ts's mtgCardShape().
placeArrivedCard depends on mtgCardShape
Holds
apps/tabletop/src/shared/mtgLifeCounterShape.ts — new, table-layout ticket 20 (2026-08-10): the same pattern for the life counter MtgLifeCounterShapeProps (w, h, value, no ownership enforcement — any player can change any counter), the TLGlobalShapePropsMap augmentation registering mtg-life-counter, and mtgLifeCounterShapeProps validators, imported by client MtgLifeCounterShapeUtil.tsx and server rooms.ts.
2 rules from this sentence
MtgLifeCounterShapeProps is in apps/tabletop/src/shared
Holds
mtgLifeCounterShapeProps is in apps/tabletop/src/shared
Holds
apps/tabletop/src/shared/mtgCardShape.ts — MtgCardShapeProps (the validated prop shape: w, h, instanceId, cardDefinitionId, cardName, frontImageUrl, backImageUrl, face, faceDown, tapped, sleeveColor, and, since table-layout ticket 18 (2026-08-09), owner (seatId) and isCommander — facts the shape carries, granting no capability),
14 rules from this sentence
MtgCardShapeProps is in apps/tabletop/src/shared
Holds
apps/tabletop/src/shared/mtgCardShape.ts — MtgCardShapeProps (the validated prop shape: w, h, instanceId, cardDefinitionId, cardName, frontImageUrl, backImageUrl, face, faceDown, tapped, sleeveColor, and, since table-layout ticket 18 (2026-08-09), owner (seatId) and isCommander — facts the shape carries, granting no capability), the TLGlobalShapePropsMap module augmentation that registers mtg-card into tldraw's TLShape union, and mtgCardShapeProps (the RecordProps validators, imported by client MtgCardShapeUtil.tsx, server rooms.ts, and server tableFurniture.ts's mtgCardShape() builder, below).
mtgCardShapeProps is in apps/tabletop/src/shared
Holds
the TLGlobalShapePropsMap module augmentation that registers mtg-card into tldraw's TLShape union, and mtgCardShapeProps (the RecordProps validators, imported by client MtgCardShapeUtil.tsx, server rooms.ts, and server tableFurniture.ts's mtgCardShape() builder, below).
MtgCardShapeUtil depends on mtgCardShapeProps
Holdsclient shared
Since the library portal (2026-08-20), gained gameCardIndex: number | null — the card's index in its owner's game state, required (non-null) for the library-portal swallow to send card.returned.v1; null for shapes that never carried one (commander/ghost mints).
MtgCardShapeProps has gameCardIndex
Holds
Also exports mtgCardShapeMigrations — the first props migration on any custom shape here (RenameScryfallId: 1, scryfallId → cardDefinitionId; AddCardSource: 2, the required cardSource: "scryfall" | "archidekt-custom" prop), registered in server rooms.ts and as MtgCardShapeUtil.migrations.
4 rules from this sentence
mtgCardShapeMigrations is in apps/tabletop/src/shared
Holds
MtgCardShapeUtil depends on mtgCardShapeMigrations
Holdsclient shared
MtgCardShapeUtil has migrations
Holds
mtgCardShapeMigrations is exported
Holds
apps/tabletop/src/shared/cardSource.ts — CardSource type; cardSourceOf(card) (absent means "scryfall"); cardSpanAttributes(card), the one place spans get card.definition_id
3 rules from this sentence
CardSource is in apps/tabletop/src/shared
Holds
cardSourceOf is in apps/tabletop/src/shared
Holds
cardSpanAttributes is in apps/tabletop/src/shared
Holds
the same pattern for furniture (ticket 13): MtgZoneShapeProps (w, h, zone — a closed enum "playmat" | "library" | "graveyard" | "exile" | "stack" | "command" — seatId, label, sleeveColor, and, since 2026-08-11, imageUrl: string | null — the playmat's own picture, set only on zone: "playmat", same mint-once/never-mutated lifecycle as sleeveColor), the TLGlobalShapePropsMap augmentation registering mtg-zone, and mtgZoneShapeProps validators, imported by client MtgZoneShapeUtil.tsx, server rooms.ts, and server tableFurniture.ts (for the Zone type alias it re-exports). Also home to two shared layout constants both sides must agree on: LIBRARY_PILE_INSET (12) and, since zone-label-band (2026-08-09, 0d61890), ZONE_LABEL_BAND (40) — the headroom every card-holding zone reserves at the top so its label stays readable; imported by cardLayout.ts, tableFurniture.ts, and MtgZoneShapeUtil.tsx.
2 rules from this sentence
MtgZoneShapeProps is in apps/tabletop/src/shared
Holds
mtgZoneShapeProps is in apps/tabletop/src/shared
Holds
the TLGlobalShapePropsMap augmentation registering mtg-zone, and mtgZoneShapeProps validators, imported by client MtgZoneShapeUtil.tsx, server rooms.ts, and server tableFurniture.ts (for the Zone type alias it re-exports).
MtgZoneShapeUtil depends on mtgZoneShapeProps
Holdsclient shared
Also home to two shared layout constants both sides must agree on: LIBRARY_PILE_INSET (12) and, since zone-label-band (2026-08-09, 0d61890), ZONE_LABEL_BAND (40) — the headroom every card-holding zone reserves at the top so its label stays readable; imported by cardLayout.ts, tableFurniture.ts, and MtgZoneShapeUtil.tsx.
4 rules from this sentence
LIBRARY_PILE_INSET is in apps/tabletop/src/shared
Holds
ZONE_LABEL_BAND is in apps/tabletop/src/shared
Holds
MtgZoneShapeUtil depends on LIBRARY_PILE_INSET
Holdsclient shared
MtgZoneShapeUtil depends on ZONE_LABEL_BAND
Holdsclient shared
MtgLifeCounterShapeProps (w, h, value, no ownership enforcement — any player can change any counter), the TLGlobalShapePropsMap augmentation registering mtg-life-counter, and mtgLifeCounterShapeProps validators, imported by client MtgLifeCounterShapeUtil.tsx and server rooms.ts.
4 rules from this sentence
MtgLifeCounterShapeUtil depends on mtgLifeCounterShapeProps
Holdsclient shared
MtgLifeCounterShapeProps has w
Holds
MtgLifeCounterShapeProps has h
Holds
MtgLifeCounterShapeProps has value
Holds
apps/tabletop/src/shared/mtgTitleShape.ts — new, editable-deck-title (2026-08-12, 96551ef): the same pattern for the deck-title label — MtgTitleShapeProps (w, h, text — free string), the TLGlobalShapePropsMap augmentation registering mtg-title, and mtgTitleShapeProps validators, imported by client MtgTitleShapeUtil.tsx and server rooms.ts.
4 rules from this sentence
MtgTitleShapeUtil depends on mtgTitleShapeProps
checks “and mtgTitleShapeProps validators, imported by client MtgTitleShapeUtil.tsx and server rooms.ts.”
Holdsclient shared
MtgTitleShapeProps has w
checks “MtgTitleShapeProps (w, h, text — free string)”
Holds
MtgTitleShapeProps has h
checks “MtgTitleShapeProps (w, h, text — free string)”
Holds
MtgTitleShapeProps has text
checks “MtgTitleShapeProps (w, h, text — free string)”
Holds
apps/tabletop/src/shared/mtgCounterShape.ts — the same pattern for counters (ticket 18): MtgCounterShapeProps (w, h, text — free string, blank by default; no domain identity beyond its text), the TLGlobalShapePropsMap augmentation registering mtg-counter, and mtgCounterShapeProps validators, imported by client MtgCounterShapeUtil.tsx and server rooms.ts.
4 rules from this sentence
MtgCounterShapeUtil depends on mtgCounterShapeProps
checks “and mtgCounterShapeProps validators, imported by client MtgCounterShapeUtil.tsx and server rooms.ts.”
Holdsclient shared
MtgCounterShapeProps has w
checks “MtgCounterShapeProps (w, h, text — free string”
Holds
MtgCounterShapeProps has h
checks “MtgCounterShapeProps (w, h, text — free string”
Holds
MtgCounterShapeProps has text
checks “MtgCounterShapeProps (w, h, text — free string”
Holds
apps/tabletop/src/client/shapes/MtgLifeCounterShapeUtil.tsx — new, table-layout ticket 20 (2026-08-10): extends BaseBoxShapeUtil<MtgLifeCounterShape>, no interaction hooks (same shape as MtgZoneShapeUtil — locked, never clicked/dragged as a shape).
MtgLifeCounterShapeUtil is in apps/tabletop/src/client/shapes
Holds
component() renders +/- buttons and an always-live typeable number field via the HyperlinkButton pattern (pointer-events: all inline, editor.markEventAsHandled(e) on pointer handlers) — deliberately does NOT reuse tldraw's .tl-image-container class the way MtgCounterShapeUtil does (watch point 23).
MtgLifeCounterShapeUtil has a component method
Holds
apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx — new, editable-deck-title (2026-08-12, 96551ef): extends BaseBoxShapeUtil<MtgTitleShape>, no interaction hooks (same locked-shape posture as MtgZoneShapeUtil/MtgLifeCounterShapeUtil).
2 rules from this sentence
MtgTitleShapeUtil depends on MtgTitleShape
checks “extends BaseBoxShapeUtil<MtgTitleShape>”
Holdsclient shared
MtgTitleShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx”
Holds
component() renders an always-live <input> bound to a local useState draft (value={draft ?? text}), committing to the synced text prop only on blur/Enter (setText → commitDraft) and discarding on Escape.
MtgTitleShapeUtil has a component method
Holds
apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts — new, ticket 05 (2026-08-11): clearStaleSelectionOnPointerDown(editor), registered once at Tldraw mount (TablePage.tsx's onTldrawMount).
clearStaleSelectionOnPointerDown is in apps/tabletop/src/client
Holds
apps/tabletop/src/client/shapes/cardSwallow.ts — new, the library portal (2026-08-20): swallowCard(editor, current, zoneHit) — calls evictPassengers (now exported from cardZoneEntry.ts) before animating the dropped card's spin/shrink/fade into the library's center via editor.animateShapes (500ms), then defers (setTimeout(0), never synchronous) an async completeSwallow: POSTs owner/cardDefinitionId/gameCardIndex to /api/tables/:tableSlug/cards/return and only calls editor.deleteShapes([id]) on a confirmed 2xx — on failure it re-animateShapess the shape's pre-swallow visual snapshot back and leaves it in the store.
swallowCard depends on completeSwallow
Holds
apps/tabletop/src/client/shapes/cardSwallow.ts — new, the library portal (2026-08-20): swallowCard(editor, current, zoneHit) — calls evictPassengers (now exported from cardZoneEntry.ts) before animating the dropped card's spin/shrink/fade into the library's center via editor.animateShapes (500ms), then defers (setTimeout(0), never synchronous) an async completeSwallow: POSTs owner/cardDefinitionId/gameCardIndex to /api/tables/:tableSlug/cards/return and only calls editor.deleteShapes([id]) on a confirmed 2xx — on failure it re-animateShapess the shape's pre-swallow visual snapshot back and leaves it in the store. Called from MtgCardShapeUtil.onTranslateEnd's new pointer-keyed check, ahead of handleTranslateEnd.
MtgCardShapeUtil depends on swallowCard
Holds
apps/tabletop/src/client/shapes/cardSwallow.ts — new, the library portal (2026-08-20): swallowCard(editor, current, zoneHit) — calls evictPassengers (now exported from cardZoneEntry.ts) before animating the dropped card's spin/shrink/fade into the library's center via editor.animateShapes (500ms),
2 rules from this sentence
swallowCard is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/cardSwallow.ts”
Holds
evictPassengers is in apps/tabletop/src/client/shapes
checks “evictPassengers (now exported from cardZoneEntry.ts)”
Holds
apps/tabletop/src/client/shapes/LibraryPortalOverlay.tsx — new, the library portal (2026-08-20): the arming visual — a rotating pink/amber conic-gradient swirl plus a dark veil, rendered in viewport space via editor.pageToViewport and wired as TLComponents.InFrontOfTheCanvas in TablePage.tsx (the app's first use of that slot). Reads a new useArmedLibraryZoneId(editor) (zoneHitTest.ts, below) — the same shared armedZoneIdSignal every other zone's component()-level glow reads, narrowed to zone === "library", rendered through this different slot because the library's opaque card-back picture would otherwise hide a component()-level treatment.
LibraryPortalOverlay depends on useArmedLibraryZoneId
Holds
apps/tabletop/src/client/shapes/LibraryPortalOverlay.tsx — new, the library portal (2026-08-20): the arming visual — a rotating pink/amber conic-gradient swirl plus a dark veil, rendered in viewport space via editor.pageToViewport and wired as TLComponents.InFrontOfTheCanvas in TablePage.tsx (the app's first use of that slot).
LibraryPortalOverlay is in apps/tabletop/src/client/shapes
Holds
Reads a new useArmedLibraryZoneId(editor) (zoneHitTest.ts, below) — the same shared armedZoneIdSignal every other zone's component()-level glow reads, narrowed to zone === "library", rendered through this different slot because the library's opaque card-back picture would otherwise hide a component()-level treatment.
2 rules from this sentence
useArmedLibraryZoneId is in apps/tabletop/src/client/shapes
checks “Reads a new useArmedLibraryZoneId(editor) (zoneHitTest.ts, below)”
Holds
useArmedLibraryZoneId depends on armedZoneIdSignal
Holds
apps/tabletop/src/server/cardRemoval.ts — new, ticket 07 (shuffler-side-exits-tell-the-table, 2026-08-21): applyCardRemoval(tableName, body)
applyCardRemoval is in apps/tabletop/src/server
Holds
apps/tabletop/src/server/cardReturned.ts — new, the library portal (2026-08-20): handleCardReturned, the new POST /api/tables/:tableSlug/cards/return route registered in server.ts next to the existing seat.joined route. Validates seatId/cardDefinitionId/ gameCardIndex, looks up the room's spineTableId and the seat's playerName, and calls sendCardReturnedToSpineBestEffort — 200 { ok: true } on a confirmed send, 502 { ok: false } otherwise.
handleCardReturned depends on sendCardReturnedToSpineBestEffort
Holds
apps/tabletop/src/client/closeContextMenuBeforeOutsideClick.ts — new, 2026-08-19: exports closeContextMenuBeforeOutsideClick(): () => void, registered from onTldrawMount in TablePage.tsx alongside clearStaleSelectionOnPointerDown.
3 rules from this sentence
onTldrawMount depends on closeContextMenuBeforeOutsideClick
checks “registered from onTldrawMount in TablePage.tsx alongside clearStaleSelectionOnPointerDown”
Holds
onTldrawMount depends on clearStaleSelectionOnPointerDown
checks “closeContextMenuBeforeOutsideClick(): () => void, registered from onTldrawMount in TablePage.tsx alongside clearStaleSelectionOnPointerDown.”
Holds
closeContextMenuBeforeOutsideClick is in apps/tabletop/src/client
checks “apps/tabletop/src/client/closeContextMenuBeforeOutsideClick.ts”
Holds
apps/tabletop/src/client/shapes/cardTap.ts — new, ticket 17: tapPartial(shape, tapped), the center-fixed pivot solve (watch point 4) extracted out of MtgCardShapeUtil as a standalone pure function so the context menu's Tap/Untap item can share it — a menu item has no this.editor/ShapeUtil instance to call a private method on. tapPartialsForCards(cards, tapped) is a plain (cards: MtgCardShape[], tapped: boolean) helper with no Editor parameter.
MtgCardShapeUtil depends on MtgCardShape
Holdsclient shared
apps/tabletop/src/client/shapes/cardTap.ts — new, ticket 17: tapPartial(shape, tapped), the center-fixed pivot solve (watch point 4) extracted out of MtgCardShapeUtil as a standalone pure function so the context menu's Tap/Untap item can share it — a menu item has no this.editor/ShapeUtil instance to call a private method on.
tapPartial is in apps/tabletop/src/client/shapes
Holds
apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx — **reduced to a thin ShapeUtil shell,
MtgCardShapeUtil is in apps/tabletop/src/client/shapes
Holds
now 83 lines. Still extends BaseBoxShapeUtil<MtgCardShape>, still declares every override tldraw needs to see (onClick etc.
MtgCardShapeUtil has onClick
Holds
component(shape) → CardFace({shape}), getIndicatorPath(shape) → cardIndicatorPath(shape) — both in cardRender.tsx, below.
4 rules from this sentence
MtgCardShapeUtil has a component method
Holds
CardFace is in apps/tabletop/src/client/shapes
Holds
MtgCardShapeUtil has a getIndicatorPath method
Holds
cardIndicatorPath is in apps/tabletop/src/client/shapes
Holds
onClick(shape) → handleCardClick(editor, shape) — in cardTapClick.ts, below.
2 rules from this sentence
MtgCardShapeUtil depends on handleCardClick
Holds
handleCardClick is in apps/tabletop/src/client/shapes
Holds
canReceiveNewChildrenOfType/canRemoveChildrenOfType → canReceivePassenger/ canRemovePassenger; onDragShapesIn/onDragShapesOut → handleDragShapesIn/ handleDragShapesOut(editor, ...) — all in cardPassengers.ts, below.
12 rules from this sentence
MtgCardShapeUtil has canReceiveNewChildrenOfType
Holds
MtgCardShapeUtil depends on canReceivePassenger
Holds
canReceivePassenger is in apps/tabletop/src/client/shapes
Holds
MtgCardShapeUtil has canRemoveChildrenOfType
Holds
MtgCardShapeUtil depends on canRemovePassenger
Holds
canRemovePassenger is in apps/tabletop/src/client/shapes
Holds
MtgCardShapeUtil has onDragShapesIn
Holds
MtgCardShapeUtil depends on handleDragShapesIn
Holds
handleDragShapesIn is in apps/tabletop/src/client/shapes
Holds
MtgCardShapeUtil has onDragShapesOut
Holds
MtgCardShapeUtil depends on handleDragShapesOut
Holds
handleDragShapesOut is in apps/tabletop/src/client/shapes
Holds
onTranslateEnd(_initial, current) → handleTranslateEnd(editor, current) — in cardZoneEntry.ts, below.
3 rules from this sentence
MtgCardShapeUtil has an onTranslateEnd method
Holds
MtgCardShapeUtil depends on handleTranslateEnd
Holds
handleTranslateEnd is in apps/tabletop/src/client/shapes
Holds
Since the library portal (2026-08-20), onTranslateEnd itself gained a pointer-keyed check ahead of that call — topmostZoneAt(editor, editor.inputs.currentPagePoint) against the dragger's own library — that, when it matches, calls swallowCard (cardSwallow.ts, new) and returns undefined instead of ever calling handleTranslateEnd.
MtgCardShapeUtil depends on topmostZoneAt
Holds
getInterpolatedProps(startShape, endShape, progress) — new override, the library portal (2026-08-20): lerps props.w/props.h so editor.animateShapes shrinks the card smoothly during the swallow instead of snapping (tldraw's built-in animation only interpolates x/y/rotation/opacity for a shape's own props otherwise).
MtgCardShapeUtil has a getInterpolatedProps method
Holds
apps/tabletop/src/client/shapes/cardRender.tsx — new, ticket 01: component()'s JSX body (exported as CardFace({shape})) and getIndicatorPath's body (cardIndicatorPath(shape)), plus the tap catch-up useLayoutEffect (ticket 15's WAAPI counter-rotate-then-ease-to-0, keyed on props.tapped).
CardFace is exported
Holds
Since 2026-08-16, also home to the Stack-landing collision check — nudgeOffAnotherCard/overlapFraction, both module-local — fired only on a fresh drag-entry into "stack", nudging a dropped card right off another it would otherwise fully hide.
2 rules from this sentence
nudgeOffAnotherCard is internal to its module
Holds
overlapFraction is internal to its module
Holds
Since the library portal (2026-08-20), evictPassengers is exported (was private) so cardSwallow.ts's swallowCard — which bypasses handleTranslateEnd entirely on a qualifying library drop — can call it directly; see interactions.md watch point 26.
2 rules from this sentence
swallowCard depends on evictPassengers
checks “Since the library portal (2026-08-20), evictPassengers is exported (was private) so cardSwallow.ts's swallowCard — which bypasses handleTranslateEnd entirely on a qualifying library drop — can call it directly”
Holds
evictPassengers is exported
checks “evictPassengers is exported”
Holds
apps/tabletop/src/client/shapes/MtgZoneShapeUtil.tsx — extends BaseBoxShapeUtil<MtgZoneShape> (ticket 13); still defines no interaction hooks at all (onClick/onTranslateEnd/ onDragShapesOver are all absent — see architecture.md/interactions.md watch point 7 for why that's safe).
MtgZoneShapeUtil depends on MtgZoneShape
Holdsclient shared
apps/tabletop/src/client/shapes/MtgZoneShapeUtil.tsx — extends BaseBoxShapeUtil<MtgZoneShape> (ticket 13); still defines no interaction hooks at all (onClick/onTranslateEnd/ onDragShapesOver are all absent — see architecture.md/interactions.md watch point 7 for why that's safe). component() renders a plain <div> — solid black border for playmat, dashed --dark-pink for everything else — and, since ticket 14 (2026-08-08), reads useIsZoneArmed(this.editor, shape.id) from zoneHitTest.ts to add a glow (box-shadow + tinted background/border color) while a dragged card is hovering over it. getIndicatorPath().
MtgZoneShapeUtil depends on useIsZoneArmed
Holds
component() renders a plain <div> — solid black border for playmat, dashed --dark-pink for everything else — and, since ticket 14 (2026-08-08), reads useIsZoneArmed(this.editor, shape.id) from zoneHitTest.ts to add a glow (box-shadow + tinted background/border color) while a dragged card is hovering over it. getIndicatorPath().
2 rules from this sentence
MtgZoneShapeUtil has a component method
checks “component() renders a plain <div>”
Holds
MtgZoneShapeUtil has a getIndicatorPath method
checks “getIndicatorPath()”
Holds
Since 2026-08-10, ZoneHit also carries seatId (was just {id, zone}), and armedZoneIdSignal gates command zones on ownership via a new private allDraggedCardsAreOwnersCommander(editor, seatId) — see architecture.md's "Command zones only arm for their owner's commander" section and interactions.md watch point 19.
3 rules from this sentence
armedZoneIdSignal depends on allDraggedCardsAreOwnersCommander
checks “armedZoneIdSignal gates command zones on ownership via a new private allDraggedCardsAreOwnersCommander(editor, seatId)”
Holds
allDraggedCardsAreOwnersCommander is internal to its module
checks “private allDraggedCardsAreOwnersCommander(editor, seatId)”
Holds
ZoneHit has seatId
checks “ZoneHit also carries seatId”
Holds
Since the library portal (2026-08-20), armedZoneIdSignal gained a matching zone === "library" branch gated on a new exported allDraggedCardsBelongToOwner(editor, seatId) (every selected shape a mtg-card owned by seatId with a non-null gameCardIndex), and a new useArmedLibraryZoneId(editor) narrows the same signal to library-only for LibraryPortalOverlay.tsx.
2 rules from this sentence
armedZoneIdSignal depends on allDraggedCardsBelongToOwner
checks “Since the library portal (2026-08-20), armedZoneIdSignal gained a matching zone === "library" branch gated on a new exported allDraggedCardsBelongToOwner(editor, seatId) (every selected shape a mtg-card owned by seatId with a non-null gameCardIndex)”
Holds
allDraggedCardsBelongToOwner is exported
checks “a new exported allDraggedCardsBelongToOwner(editor, seatId)”
Holds
component() renders the disc (or, while editing, an <input> with the setTimeout(0) focus workaround, markEventAsHandled on pointer-down, and Enter/Escape → editor.complete()); isAspectRatioLocked() keeps it square.
2 rules from this sentence
MtgCounterShapeUtil has a component method
checks “component() renders the disc”
Holds
MtgCounterShapeUtil has an isAspectRatioLocked method
checks “isAspectRatioLocked() keeps it square”
Holds
Exports COUNTER_SIZE (44).
COUNTER_SIZE is exported
Holds
apps/tabletop/src/client/shapes/openSpotNearZoneEdge.ts — new, ticket 18: findOpenSpotsNearZoneEdge(request), pure geometry over plain Rects (no Editor, unit- tested) — picks the zone edge nearest the card's entry point and alternates slots outward, skipping occupied rects; overlap beats failure. Used only by evictCounters.
findOpenSpotsNearZoneEdge depends on Rect
Holds
apps/tabletop/src/client/TablePage.tsx — registers shapeUtils = [...defaultShapeUtils, MtgCardShapeUtil, MtgZoneShapeUtil, MtgCounterShapeUtil, MtgLifeCounterShapeUtil, MtgTitleShapeUtil] (the last added editable-deck-title, 2026-08-12).
5 rules from this sentence
shapeUtils depends on MtgCardShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgZoneShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgCounterShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgLifeCounterShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgTitleShapeUtil
HoldsTablePage.tsx shapes
Since 2026-08-12, also home to useCopyHint() (mounted from ToolbarWithCounter) and uiOverrides.actions.copy — a toast telling players ctrl+c doesn't work here.
ToolbarWithCounter depends on useCopyHint
Holds
CardPlayedPayload is now just a type alias for CardArrivalPayloadCommon, same as CardDiscardedPayload.** Cleanup, not a behavior change: resolvePosition for applyCardArrival was already ignoring the field's value.
2 rules from this sentence
CardPlayedPayload depends on CardArrivalPayloadCommon
checks “CardPlayedPayload is now just a type alias for CardArrivalPayloadCommon”
Holds
CardDiscardedPayload depends on CardArrivalPayloadCommon
checks “CardPlayedPayload is now just a type alias for CardArrivalPayloadCommon, same as CardDiscardedPayload.** Cleanup, not a behavior change:”
Holds
applyCardArrival/applyCardDiscard are called by spineEventDispatch.ts's dispatchSpineEvent in production, and by testSeedRoute.ts's handleTestCardSeed (a test-only HTTP seam, ENABLE_TEST_SEED_ROUTE=true only, now dispatching to one or the other based on the posted envelope's name) in tests.
3 rules from this sentence
dispatchSpineEvent depends on applyCardDiscard
checks “applyCardArrival/applyCardDiscard are called by spineEventDispatch.ts's dispatchSpineEvent”
Holds
handleTestCardSeed depends on applyCardArrival
Holds
handleTestCardSeed depends on applyCardDiscard
Holds
apps/tabletop/src/server/spineEventDispatch.ts — dispatchSpineEvent(tableName, event), the production entry point for card.played — filters the Spine's per-table SSE stream for that event name, continues the trace from the broadcast envelope's traceparent, and calls applyCardArrival.
dispatchSpineEvent depends on applyCardArrival
Holds
Since 2026-08-20, also exports RoomEntry.stackCardCount(owner) — replaces the deleted PlayerArea.stackCount monotonic counter with a live count, taken fresh on every card.played arrival, of how many mtg-card shapes owned by owner currently have (x, y) inside stackBounds() (cardLayout.ts), read via this.room.getCurrentSnapshot().documents.
RoomEntry has a stackCardCount method
Holds
while a new nextFurnitureIndex(tableName), chained via getIndexBelow(...) off null, mints every furniture shape inside ensurePlayerArea/ensureStackDrawn.
2 rules from this sentence
ensurePlayerArea depends on nextFurnitureIndex
Holds
ensureStackDrawn depends on nextFurnitureIndex
Holds
ZoneShapeArgs/zoneShape() gained an imageUrl?: string | null field threaded from ensurePlayerArea's look.playmatImageUrl into the mtg-zone record's own props.imageUrl — the old matImageId/AssetRecordType/ imageAsset()/imageShape() sequence for the playmat was deleted outright, not just refactored.
2 rules from this sentence
ensurePlayerArea depends on zoneShape
checks “threaded from ensurePlayerArea's look.playmatImageUrl into the mtg-zone record's own props.imageUrl”
Holds
ZoneShapeArgs has an imageUrl field
checks “ZoneShapeArgs/zoneShape() gained an imageUrl?: string | null field”
Holds
Since table-layout ticket 18 (2026-08-09), also home to mtgCardShape(args: MtgCardShapeArgs) (next to zoneShape()) — the single place every required mtg-card prop is listed when building a shape record; called by both cardArrival.ts and seatJoined.ts instead of each writing its own store.put literal. See watch point 15.
mtgCardShape depends on MtgCardShapeArgs
Holds
MtgCardShapeArgs.cardSource is required with no default, so the compiler finds every mint site.
MtgCardShapeArgs has cardSource
Holds
Since 96159be: MAX_SEATS (= 4, the compass slot count) is exported, and playerAreaOrigin(seatIndex) throws past it instead of wrapping a fifth seat onto the S slot (which would have silently broken the disjointness invariant); seatJoined.ts and cardArrival.ts refuse with 409 ("table is full: 4 seats") before ever reaching the throw.
MAX_SEATS is exported
Holds
The hit test itself moved, ticket 14 (landed 2026-08-08). zoneAt() no longer walks shapes itself it calls topmostZoneAt(this.editor, bounds.center) from the new apps/tabletop/src/client/shapes/zoneHitTest.ts, which now resolves overlapping zones by picking whichever candidate has the greatest index (an IndexKey; plain string > comparison already reflects z-order for tldraw's fractional-indexing scheme), i.e.
zoneAt depends on topmostZoneAt
Holds
A pointer-keyed check placed ahead of handleTranslateEnd inside onTranslateEnd can pre-empt it entirely — and inherits the obligation to re-derive whichever of its side effects still apply. (The library portal, 2026-08-20.) MtgCardShapeUtil.onTranslateEnd now checks topmostZoneAt(editor, editor.inputs.currentPagePoint) the pointer's own page point, the same one armedZoneIdSignal (watch point 9) already keys the live arming glow on before calling handleTranslateEnd, and if the pointer is over the dragger's own library with every selected shape a mtg-card owned by that seat, it calls swallowCard and returns undefined, skipping handleTranslateEnd (and its zone-change branch — meta.zone stamping, zone-entry logging, passenger eviction, stack-landing nudge) entirely for that gesture.
MtgCardShapeUtil depends on swallowCard
Holds
Two new mechanics facts landed alongside this, both firsts for the KB: getInterpolatedProps (BaseBoxShapeUtil) is required to tween a custom shape's own props during editor.animateShapes the built-in animation only interpolates x/y/rotation/ opacity, so shrinking w/h smoothly (rather than snapping) needs this override, added to MtgCardShapeUtil for the swallow's shrink-to-nothing effect; and `TLComponents.
MtgCardShapeUtil has getInterpolatedProps
Holds
zoneAt() in MtgCardShapeUtil.tsx now filters candidate.type === "mtg-zone" and reads the validated candidate.props.zone, instead of scanning every shape for a truthy meta.zone.
zoneAt is in apps/tabletop/src/client/shapes
Holds
it calls topmostZoneAt(this.editor, bounds.center) from the new apps/tabletop/src/client/shapes/zoneHitTest.ts, which now resolves overlapping zones by picking whichever candidate has the greatest index (an IndexKey; plain string > comparison already reflects z-order for tldraw's fractional-indexing scheme), i.e.
topmostZoneAt is in apps/tabletop/src/client/shapes
Holds
Arming is no longer universally card-agnostic — command zones are the first exception (2026-08-10). ZoneHit (topmostZoneAt's return type) widened to carry seatId alongside id/zone, and armedZoneIdSignal now gates specifically on hit.zone === "command": the zone only arms if allDraggedCardsAreOwnersCommander(editor, hit.seatId)
5 rules from this sentence
topmostZoneAt depends on ZoneHit
checks “ZoneHit (topmostZoneAt's return type)”
Holds
armedZoneIdSignal depends on allDraggedCardsAreOwnersCommander
checks “the zone only arms if allDraggedCardsAreOwnersCommander(editor, hit.seatId)”
Holds
ZoneHit has seatId
checks “ZoneHit”
Holds
ZoneHit has id
checks “command zones are the first exception (2026-08-10).** ZoneHit (topmostZoneAt's return type) widened to carry seatId alongside id/zone”
Holds
ZoneHit has zone
checks “command zones are the first exception (2026-08-10).** ZoneHit (topmostZoneAt's return type) widened to carry seatId alongside id/zone”
Holds
Zone heights changed 2026-08-09 (zone-label-band, 0d61890) without touching detection. Every card-holding zone now reserves ZONE_LABEL_BAND (40, exported from shared/mtgZoneShape.ts) of label headroom: library/command/exile are 278, graveyard 356.
2 rules from this sentence
ZONE_LABEL_BAND is in apps/tabletop/src/shared
Holds
ZONE_LABEL_BAND is exported
Holds
One coupling worth knowing: COMMAND_ZONE_H is defined as LIBRARY_H because the graveyard sits at column.y + LIBRARY_H + GAP spanning the full column width — a height drift between the two top boxes would erode the command zone's gap (asserted in test/cardLayout.test.ts).
COMMAND_ZONE_H depends on LIBRARY_H
Holds
Confirmed a second time, tabletop-architecture ticket 03 (2026-08-11): extracting the pairwise-separation check into an exported checkZonesDisjoint and calling it at module load (see watch point 8's new paragraph below) touched only cardLayout.ts and its own test file
checkZonesDisjoint is exported
Holds
First store-level store.listen() consumer of this owner's gesture detection. apps/tabletop/src/client/usePhysicsAnnouncements.ts (owned by fleet-is-observable, not this owner) watches the shape mutations this owner's ShapeUtil hooks already produce
usePhysicsAnnouncements is in apps/tabletop/src/client
Holds
apps/tabletop/src/client/useReconnectSpans.ts (also fleet-is-observable's territory) does a single store.allRecords() count on useSync's connectionStatus flipping "offline" → "online" — no store.listen(), no write, no ShapeUtil/gesture involvement, so unlike usePhysicsAnnouncements/useCardArrivalSpans above it isn't a consumer of anything this owner's hooks produce.
useReconnectSpans is in apps/tabletop/src/client
Holds
Second store-level store.listen() consumer of this owner's gesture detection, and the first scoped to {source: "remote"} rather than {source: "user"}. apps/tabletop/src/client/ useCardArrivalSpans.ts (also fleet-is-observable's territory) already listened for new mtg-card shapes arriving;
useCardArrivalSpans is in apps/tabletop/src/client
Holds
So anything that reparents shapes (tldraw's own group/frame machinery, future features, undo) is silently also attach/detach for counters, and the drag hooks on MtgCardShapeUtil (canReceiveNewChildrenOfType/canRemoveChildrenOfType/onDragShapesIn/ onDragShapesOut) are the mediating surface.
4 rules from this sentence
MtgCardShapeUtil has canReceiveNewChildrenOfType
Holds
MtgCardShapeUtil has canRemoveChildrenOfType
Holds
MtgCardShapeUtil has onDragShapesIn
Holds
MtgCardShapeUtil has onDragShapesOut
Holds
Counter eviction on battlefield exit rides inside MtgCardShapeUtil.onTranslateEnd's zone-change branch — changing the zone-entry debounce or the NON_BATTLEFIELD_ZONES set changes when counters detach.
MtgCardShapeUtil has onTranslateEnd
Holds
cardRemoval.ts's server-side applyCardRemoval reparents passengers in place (no Editor, no spot-finding) rather than detaching them to an open spot — see watch point 28.
applyCardRemoval is in apps/tabletop/src/server
Holds
One centralized listener, apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts (registered at Tldraw mount, TablePage.tsx's onTldrawMount), now clears a stale selection on every pointer_down whenever the hit shape isn't already selected — closing this watch point for every shape type, present and future, without a per-type hook.
2 rules from this sentence
onTldrawMount depends on clearStaleSelectionOnPointerDown
checks “One centralized listener, apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts (registered at Tldraw mount, TablePage.tsx's onTldrawMount), now clears a stale selection on every pointer_down whenever the hit shape isn't already selected”
Holds
clearStaleSelectionOnPointerDown is in apps/tabletop/src/client
checks “apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts”
Holds
Item 4 is conditional on the component's content being interactive — NOT on the shape being unlocked: ticket 13's mtg-zone generalized steps 1-3 cleanly (see architecture.md) but didn't need step 4 at all, because nothing ever clicks a zone — MtgZoneShapeUtil.component() renders a plain <div> with no .tl-image-container treatment and that's correct, not an oversight.
MtgZoneShapeUtil has a component method
Holds
and since the command-zone redraw (table-layout ticket 13, 2026-08-08, commits 1046b93+b18bd16 — a different ticket 13 from the tabletop-physics one that created mtg-zone) that's a tested invariant, not an accident of layout: every pair of zone AABBs, within a seat's column and between player areas, keeps a 20-unit gap (GAP, exported from cardLayout.ts),
GAP is exported
Holds
playerAreaOrigin throws past the new MAX_SEATS export (4) instead of wrapping a fifth seat onto the S slot's exact AABBs, with seatJoined.ts/cardArrival.ts refusing with 409 before the throw can ever fire.
MAX_SEATS is exported
Holds
a computed() shared per-Editor, read via a use* hook, that writes nothing to the store.** zoneHitTest.ts's armedZoneIdSignal/ useIsZoneArmed (ticket 14, 2026-08-08) is the first hook in this KB that reads live drag-in-progress state (editor.isIn("select.translating")) purely to drive component() rendering, with no store write, no undo entry, and no sync traffic.
useIsZoneArmed depends on armedZoneIdSignal
Holds
This pattern now has a second instance: mtg-title, the editable deck title (2026-08-12, 96551ef; apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx). A locked shape whose component() hosts a live <input> writing to its own text prop
2 rules from this sentence
MtgTitleShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx”
Holds
MtgTitleShapeUtil has a component method
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx).** A locked shape whose component() hosts a live <input> writing to its own text prop”
Holds
Fixed by extracting mtgCardShape(args: MtgCardShapeArgs) in tableFurniture.ts (next to the existing zoneShape() helper): the one place that lists every required mtg-card prop, called by both cardArrival.ts and seatJoined.ts instead of each writing its own literal.
mtgCardShape depends on MtgCardShapeArgs
Holds
TablePage.tsx's shapeUtils array is now built as [...defaultShapeUtils.filter((Util) => Util.type !== "note"), MtgCardShapeUtil, MtgZoneShapeUtil, MtgCounterShapeUtil, SelectionClearingNoteShapeUtil] — a replace, not an add.
3 rules from this sentence
shapeUtils depends on MtgCardShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgZoneShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgCounterShapeUtil
HoldsTablePage.tsx shapes
Command zones now add a further check: armedZoneIdSignal (zoneHitTest.ts) only returns the hit id for hit.zone === "command" when a new private helper, allDraggedCardsAreOwnersCommander(editor, hit.seatId), returns true — which filters editor.getSelectedShapes() to mtg-cards and requires every one of them to have props.owner === hit.seatId && props.isCommander.
allDraggedCardsAreOwnersCommander is internal to its module
Holds
ZoneHit grew a field to make this possible: topmostZoneAt's return type is now {id, zone, seatId}, not {id, zone} — seatId comes straight off the winning mtg-zone candidate's props.seatId and is threaded through to both callers (zoneAt()'s drag-settle check ignores the new field; armedZoneIdSignal's live-drag check is what actually reads it).
armedZoneIdSignal depends on topmostZoneAt
Holds
A second consumer shape hit the same fact from the server side (2026-08-20): RoomEntry.stackCardCount(owner) (apps/tabletop/src/server/rooms.ts) takes a point-in-time snapshot read (this.room.getCurrentSnapshot().documents) of which mtg-card shapes currently sit inside stackBounds(), to derive a card.played arrival's cascade slot
RoomEntry has a stackCardCount method
Holds
nextIndex is now used only by the two card-minting seams (cardArrival.ts, seatJoined.ts's commander/ghost mints — both already only called it for mtg-card shapes); every furniture-minting call inside ensurePlayerArea/ensureStackDrawn calls nextFurnitureIndex instead.
2 rules from this sentence
ensurePlayerArea depends on nextFurnitureIndex
Holds
ensureStackDrawn depends on nextFurnitureIndex
Holds
A pointer-keyed check placed ahead of handleTranslateEnd inside onTranslateEnd can pre-empt it entirely — and inherits the obligation to re-derive whichever of its side effects still apply. (The library portal, 2026-08-20.) MtgCardShapeUtil.onTranslateEnd now checks topmostZoneAt(editor, editor.inputs.currentPagePoint)
2 rules from this sentence
MtgCardShapeUtil depends on topmostZoneAt
checks “MtgCardShapeUtil.onTranslateEnd now checks topmostZoneAt(editor, editor.inputs.currentPagePoint)”
Holds
MtgCardShapeUtil depends on handleTranslateEnd
Holds
swallowCard (cardSwallow.ts) has to call evictPassengers (now exported from cardZoneEntry.ts, was private) itself before animating the swallow, or a counter/note riding the card would be silently deleted with its host, orphaned, or left parented to a deleted shape — none of which the skipped handleTranslateEnd branch was ever going to catch on this path.
2 rules from this sentence
swallowCard depends on evictPassengers
Holds
evictPassengers is exported
Holds
gameCardIndex: number | null is a new required mtg-card prop, threaded via the canonical route watch point 16 already established (mtgCardShape()'s signature in tableFurniture.ts, not per call site) — read from envelope.payload.gameCardIndex in cardArrival.ts (already on the wire, previously dropped), null by default for seatJoined.ts's commander/ghost mints.
MtgCardShapeProps has gameCardIndex
Holds
Fix: beat MenuClickCapture to the punch — a document-level capture-phase pointerdown listener (apps/tabletop/src/client/ closeContextMenuBeforeOutsideClick.ts, registered from onTldrawMount in TablePage.tsx) dispatches a synthetic Escape keydown first, whenever a menu is open and the click is a left-button click landing outside the menu's own DOM
2 rules from this sentence
onTldrawMount depends on closeContextMenuBeforeOutsideClick
checks “a document-level capture-phase pointerdown listener (apps/tabletop/src/client/ closeContextMenuBeforeOutsideClick.ts, registered from onTldrawMount in TablePage.tsx) dispatches a synthetic Escape keydown first, whenever a menu is open and the click is a left-button click landing outside the menu's own DOM”
Holds
closeContextMenuBeforeOutsideClick is in apps/tabletop/src/client
checks “apps/tabletop/src/client/ closeContextMenuBeforeOutsideClick.ts”
Holds
This is now a second, independent implementation of "evict a card's passengers," and the two are deliberately not shared. evictPassengers (client-side, cardZoneEntry.ts) spot-finds open positions near a zone's edge and detaches to the page — appropriate when the card is landing somewhere else on the table (graveyard/exile/library) and a passenger needs a place to land too.
evictPassengers is in apps/tabletop/src/client
Holds
Everything under apps/tabletop/src/client/shapes/ — MtgCardShapeUtil.tsx, MtgZoneShapeUtil.tsx, MtgCounterShapeUtil.tsx, MtgCounterTool.ts, plus the pure seams zoneHitTest.ts and openSpotNearZoneEdge.ts — and their interaction with tldraw's own SelectTool child states (PointingShape, Translating, in node_modules/tldraw/src/lib/tools/SelectTool/childStates/).
4 rules from this sentence
MtgCardShapeUtil is in apps/tabletop/src/client/shapes
checks “Everything under apps/tabletop/src/client/shapes/ — MtgCardShapeUtil.tsx”
Holds
MtgZoneShapeUtil is in apps/tabletop/src/client/shapes
checks “Everything under apps/tabletop/src/client/shapes/”
Holds
MtgCounterShapeUtil is in apps/tabletop/src/client/shapes
checks “Everything under apps/tabletop/src/client/shapes/”
Holds
MtgCounterTool is in apps/tabletop/src/client/shapes
checks “Everything under apps/tabletop/src/client/shapes/”
Holds
Editable deck title (.scratch/editable-deck-title/plan.md, landed 2026-08-12, 96551ef) added a fifth custom shape type, mtg-title (apps/tabletop/src/shared/mtgTitleShape.ts, apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx), replacing the stock locked text seat-name label so the title can be edited in place.
2 rules from this sentence
MtgTitleShape is in apps/tabletop/src/shared
checks “apps/tabletop/src/shared/mtgTitleShape.ts”
Holds
MtgTitleShapeUtil is in apps/tabletop/src/client/shapes
checks “apps/tabletop/src/client/shapes/MtgTitleShapeUtil.tsx”
Holds
It is the second locked-interactive shape after mtg-life-counter — a BaseBoxShapeUtil with no interaction hooks whose component() hosts a live DOM <input> writing to its own text prop through editor.run(..., { ignoreShapeLock: true }) (watch point 22), and shielding keystrokes from tldraw's tool hotkeys (watch point 10b, always-live-input case).
MtgTitleShapeUtil has a component method
Holds
What component() / getIndicatorPath() bodies + tap catch-up animation, Where apps/tabletop/src/client/shapes/cardRender.tsx ( CardFace , cardIndicatorPath )
2 rules from this sentence
MtgCardShapeUtil has a component method
Holds
MtgCardShapeUtil has a getIndicatorPath method
Holds
What onClick body — tap/untap toggle + ticket 16's multi-untap propagation, Where apps/tabletop/src/client/shapes/cardTapClick.ts ( handleCardClick )
2 rules from this sentence
MtgCardShapeUtil has onClick
checks “onClick body”
Holds
MtgCardShapeUtil depends on handleCardClick
Holds
What Passenger hosting — PASSENGER_TYPES , the two can gates, onDragShapesIn / onDragShapesOut bodies, Where apps/tabletop/src/client/shapes/cardPassengers.ts
2 rules from this sentence
MtgCardShapeUtil has onDragShapesIn
Holds
MtgCardShapeUtil has onDragShapesOut
Holds
What onTranslateEnd body — zone-entry detection, passenger eviction, stack-landing collision avoidance, Where apps/tabletop/src/client/shapes/cardZoneEntry.ts ( handleTranslateEnd , plus zoneAt / evictPassengers — the latter exported — and private nudgeOffAnotherCard )
3 rules from this sentence
MtgCardShapeUtil has onTranslateEnd
checks “onTranslateEnd body”
Holds
evictPassengers is exported
checks “evictPassengers — the latter exported”
Holds
nudgeOffAnotherCard is internal to its module
checks “private nudgeOffAnotherCard”
Holds
What Library-portal swallow — pointer-keyed check ahead of handleTranslateEnd , send-then-commit delete, Where apps/tabletop/src/client/shapes/cardSwallow.ts ( swallowCard ), checked from MtgCardShapeUtil.onTranslateEnd itself
2 rules from this sentence
MtgCardShapeUtil depends on swallowCard
checks “Where apps/tabletop/src/client/shapes/cardSwallow.ts ( swallowCard ), checked from MtgCardShapeUtil.onTranslateEnd itself”
Holds
MtgCardShapeUtil depends on handleTranslateEnd
Holds
What Library-portal arming visual (first TLComponents.InFrontOfTheCanvas use), Where apps/tabletop/src/client/shapes/LibraryPortalOverlay.tsx , wired in TablePage.tsx
LibraryPortalOverlay is in apps/tabletop/src/client/shapes
Holds
What ShapeUtil registration (client), Where apps/tabletop/src/client/TablePage.tsx ( shapeUtils = [...defaultShapeUtils, MtgCardShapeUtil, MtgZoneShapeUtil, MtgCounterShapeUtil, MtgLifeCounterShapeUtil] passed to both useSync and <Tldraw> — since ticket 05, defaultShapeUtils is spread in whole no filtering, no SelectionClearing subclasses)
5 rules from this sentence
shapeUtils depends on MtgCardShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgZoneShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgCounterShapeUtil
HoldsTablePage.tsx shapes
shapeUtils depends on MtgLifeCounterShapeUtil
HoldsTablePage.tsx shapes
TablePage is in apps/tabletop/src/client
Holds
What Centralized stale-selection fix (ticket 05, supersedes every per-shape onTranslateEnd / commit() clear), Where apps/tabletop/src/client/clearStaleSelectionOnPointerDown.ts , registered in TablePage.tsx 's onTldrawMount (formerly aimCameraAtTheTable )
2 rules from this sentence
onTldrawMount depends on clearStaleSelectionOnPointerDown
Holds
clearStaleSelectionOnPointerDown is in apps/tabletop/src/client
Holds
twoFaced: boolean — whether the card has a separate back image (drives the flip button)
CardDefinition has twoFaced
Holds
cardTypes: string[] — the union of every face's/part's types (e.g. ["Legendary","Creature","Planeswalker"])
CardDefinition has cardTypes
Holds
Plus cardSource?: "scryfall" | "archidekt-custom" — optional, absent means scryfall, always read through cardSourceOf(card);
CardDefinition has cardSource
Holds
currentFace: "front" | "back" — which face is currently showing
GameCard has currentFace
Holds
Persisted version also stores currentFace.
PersistedGameCard has currentFace
Holds
ArchidektDeckToDeckAdapter.convertCustomCard reads the deck API's customCards array (types in archidektTypes.ts, ArchidektCustomCard).
2 rules from this sentence
ArchidektDeckToDeckAdapter depends on ArchidektCustomCard
Holds
ArchidektDeckToDeckAdapter has convertCustomCard
checks “ArchidektDeckToDeckAdapter.convertCustomCard reads”
Holds
cardDefinitionId = customCardDefinitionId(id) = uuidv5("archidekt-custom:<id>", fixed namespace) (hand-rolled src/uuidv5.ts) — stable across re-downloads, uuid-shaped for the contracts
customCardDefinitionId depends on uuidv5
Holdsport-deck-retrieval uuidv5.ts
twoFaced = multiFace && isDoubleSidedLayout(layout) — only genuinely double-sided layouts
ArchidektDeckToDeckAdapter depends on isDoubleSidedLayout
HoldsarchidektAdapter twoFacedLayouts.ts
twoFaced = isDoubleSidedLayout(mtgjsonCard.layout) (shared with Archidekt)
MtgjsonDeckAdapter depends on isDoubleSidedLayout
HoldsmtgjsonAdapter twoFacedLayouts.ts
wraps card in formatFlippingContainer() with flip animation structure
formatCardContainer depends on formatFlippingContainer
Holds
Signature is (gameCard: GameCard, flipRequest: FlipRequest).
formatFlippingContainer depends on GameCard
Holdsview domain-types.ts
getCardImageUrl(card: CardDefinition, format, face) — the one views call.
getCardImageUrl depends on CardDefinition
Holds
imageUris?: CardImageUris (front/only face) and backImageUris?: CardImageUris (present only when twoFaced).
2 rules from this sentence
CardDefinition has imageUris
Holds
CardDefinition has backImageUris
checks “backImageUris?: CardImageUris”
Holds
CardImageUris = Partial<Record<ImageFormat, string>>, storing only the formats the app uses (normal, large, png, art_crop).
CardImageUris depends on ImageFormat
Holds
CardImagesPort / FetchedCardImages ({front, back?}) — types.ts
2 rules from this sentence
FetchedCardImages has front
Holds
FetchedCardImages has back
Holds
Archidekt adapter (optional injected imagesPort, wired in server.ts + download-deck script), and the fetch-mtgjson-precons script after conversion.
ArchidektDeckToDeckAdapter depends on CardImagesPort
Holdsport-deck-retrieval port-card-images
The MTGJSON adapter's convertMtgjsonToDeck stays synchronous (enrichment is a separate post-pass).
MtgjsonDeckAdapter has convertMtgjsonToDeck
Holds
The Shuffler sends it only for non-scryfall cards (cardSourceField(card) in apps/shuffler/src/types.ts), so a scryfall card's payload is byte-identical to before.
cardSourceField is in apps/shuffler/src
Holds
any transition out of the Shuffler's own Table location (the Return button, or a future put-in-hand/top/bottom), via buildCardReturnedEvent + sendCardReturnedToSpineBestEffort in apps/shuffler/src/port-tabletop/types.ts / apps/shuffler/src/port-spine/sendToSpine.ts.
buildCardReturnedEvent is in apps/shuffler/src/port-tabletop
Holds
buildCardDiscardedEvent in apps/shuffler/src/port-tabletop/types.ts, using the same cardFaceFields(gameCard) private helper card.played/card.played-face-down already used (see interactions.md watch point 25) — so the face/image computation is not a third copy-paste of the twoFaced-gate.
2 rules from this sentence
buildCardDiscardedEvent depends on cardFaceFields
checks “buildCardDiscardedEvent in apps/shuffler/src/port-tabletop/types.ts, using the same cardFaceFields(gameCard) private helper card.played/card.played-face-down already used (see interactions.md watch point 25)”
Holds
buildCardDiscardedEvent is in apps/shuffler/src/port-tabletop
checks “buildCardDiscardedEvent in apps/shuffler/src/port-tabletop/types.ts”
Holds
It's a documentation-only schema change — no receiver has read the field for a while (applyCardArrival in apps/tabletop/src/server/cardArrival.ts has placed every arriving card on the Stack regardless of zoneHint since 2026-08-16, and card.discarded.v1 — the schema graveyard traffic moved to, ticket 08 above — never carried zoneHint at all).
applyCardArrival is in apps/tabletop/src/server
Holds
the Shuffler's sendCardBeforeMutate (apps/shuffler/src/app.ts) stopped setting a "zone.hint" span attribute, and the Tabletop's cardArrival.ts stopped destructuring zoneHint off the envelope and setting its own "zone.hint" span attribute — its local ZoneHint type and CardPlayedPayload.zoneHint field are gone (CardPlayedPayload is now just an alias for CardArrivalPayloadCommon).
CardPlayedPayload depends on CardArrivalPayloadCommon
Holds
On the Shuffler side (ticket 03): CardPlayedFaceDownPayload/ buildCardPlayedFaceDownEvent in apps/shuffler/src/port-tabletop/types.ts are a deliberate duplicate of CardPlayedPayload/buildCardPlayedEvent, except for name (card.played-face-down) and origin (shuffler.playCardFaceDownSubmit). The face/image computation (face/frontImageUrl/backImageUrl, including the twoFaced-gate on backImageUrl) is factored into one shared private helper, cardFaceFields(gameCard), called by both builders — so that invariant lives in one place even though the two builders themselves stay separate, divergeable functions.
2 rules from this sentence
buildCardPlayedFaceDownEvent depends on cardFaceFields
Holds
buildCardPlayedEvent depends on cardFaceFields
Holds
CardPlayedFaceDownPayload/ buildCardPlayedFaceDownEvent in apps/shuffler/src/port-tabletop/types.ts are a deliberate duplicate of CardPlayedPayload/buildCardPlayedEvent, except for name (card.played-face-down) and origin (shuffler.playCardFaceDownSubmit).
2 rules from this sentence
CardPlayedFaceDownPayload is in apps/shuffler/src/port-tabletop
Holds
buildCardPlayedFaceDownEvent is in apps/shuffler/src/port-tabletop
Holds
Image URLs are stored on the card (imageUris/backImageUris), fetched from Scryfall at ingestion via src/port-card-images/ (ScryfallCardImagesGateway → POST /cards/collection). getCardImageUrl(card, format, face) prefers the stored URL; constructCardImageUrl(scryfallId, format, face) is the fallback.
2 rules from this sentence
getCardImageUrl depends on constructCardImageUrl
checks “getCardImageUrl(card, format, face) prefers the stored URL; constructCardImageUrl(scryfallId, format, face) is the fallback.”
Holds
ScryfallCardImagesGateway is in apps/shuffler/src/port-card-images
checks “fetched from Scryfall at ingestion via src/port-card-images/ (ScryfallCardImagesGateway”
Holds
All outbound Scryfall calls go through fetchScryfall() in src/scryfall-http.ts, which sets it; /proxy-image shipped without one and 400'd every card copy until JES-136.
fetchScryfall is in apps/shuffler/src
Holds
If Scryfall's path scheme changes, the stored URLs still work (verbatim from Scryfall); only the fallback constructCardImageUrl() in src/domain-types.ts would need updating.
constructCardImageUrl is in apps/shuffler/src
Holds
Every Scryfall-specific path must branch on cardSourceOf(card): getCardImageUrl, enrichDeckWithImages, /proxy-image, the Gatherer link.
2 rules from this sentence
enrichDeckWithImages depends on cardSourceOf
Holdsport-card-images types.ts
getCardImageUrl depends on cardSourceOf
Holds
Both adapters share src/port-deck-retrieval/twoFacedLayouts.ts (isDoubleSidedLayout() / DOUBLE_SIDED_LAYOUTS) — the single source of truth for what's flippable
isDoubleSidedLayout and DOUBLE_SIDED_LAYOUTS are in apps/shuffler/src/port-deck-retrieval
Holds
twoFaced = isDoubleSidedCustomCard(hasBack, backImageUrl) (same file);
isDoubleSidedCustomCard is in apps/shuffler/src/port-deck-retrieval
Holds
The Gatherer + Copy utility block comes from one helper, formatCardModalUtilityLinks(card, face) (src/view/play-game/game-modals.ts), called by all three modal routes (/card-modal, /prep-card-modal, /flip-card-modal).
formatCardModalUtilityLinks is in apps/shuffler/src/view/play-game
Holds
formatCardContainer() branches on card.twoFaced to decide between simple <img> and formatFlippingContainer()
formatCardContainer depends on formatFlippingContainer
Holds
formatCommandZoneHtmlFragment() calls formatCardContainer() which handles two-faced commanders
formatCommandZoneHtmlFragment depends on formatCardContainer
Holds
PersistedGameCard includes currentFace
PersistedGameCard has currentFace
Holds
GameState.flipCard() mutates currentFace on the GameCard
3 rules from this sentence
GameState depends on GameCard
Holds
GameState has a flipCard method
Holds
GameCard has currentFace
checks “currentFace on the GameCard”
Holds
src/port-tabletop/types.ts buildCardPlayedEvent is the ONE door where a GameCard is serialized for the table.
buildCardPlayedEvent depends on GameCard
Holdsport-tabletop domain-types.ts
As of cards-come-and-go ticket 08 (2026-08-23), buildCardPlayedEvent, buildCardPlayedFaceDownEvent, and the new buildCardDiscardedEvent all share one private helper, cardFaceFields(gameCard), for the face/frontImageUrl/backImageUrl computation — see watch point 19 and 25.
3 rules from this sentence
buildCardPlayedEvent depends on cardFaceFields
Holds
buildCardPlayedFaceDownEvent depends on cardFaceFields
Holds
buildCardDiscardedEvent depends on cardFaceFields
Holds
CardDefinition changes: CardDefinition is intentionally minimal — identity fields, twoFaced, cardTypes, plus the optional imageUris/backImageUris (image URLs) and cardSource (absent = scryfall; read via cardSourceOf, never card.cardSource directly).
5 rules from this sentence
CardDefinition has a twoFaced field
checks “CardDefinition is intentionally minimal — identity fields, twoFaced, cardTypes, plus the optional imageUris/backImageUris (image URLs) and cardSource (absent = scryfall”
Holds
CardDefinition has a cardTypes field
checks “CardDefinition is intentionally minimal — identity fields, twoFaced, cardTypes, plus the optional imageUris/backImageUris (image URLs) and cardSource (absent = scryfall”
Holds
CardDefinition has an imageUris field
Holds
CardDefinition has a backImageUris field
checks “CardDefinition is intentionally minimal — identity fields, twoFaced, cardTypes, plus the optional imageUris/backImageUris (image URLs) and cardSource (absent = scryfall”
Holds
CardDefinition has a cardSource field
Holds
If you touch loadCardDatabase(), keep it streaming — a whole-file read will throw RangeError: Invalid string length.
loadCardDatabase may not use readFile
Holds
GameState.mulligan() resets each returning hand card's currentFace to "front" as it goes back to the library, so a redrawn two-faced card starts on its front (matching newGame).
GameState has a mulligan method
Holds
Face-down is modeled only on the Tabletop — and both the gesture and both renderings are now built. Ticket 02 (2026-08-07, c956949) gave it a home: faceDown: boolean in the mtg-card shape's props.
MtgCardShapeProps has faceDown
Holds
Physics ticket 17 (2026-08-09, eb24a4f) built the rest: the shape gained cardBackImageUrl: string | null, baked at mint from playerArea.cardBackImageUrl (same game-constant argument), and the unsleeved faceDown branch now renders it as an <img> — falling back to a flat #3a3a3a rectangle when no card back was baked in (a seat that predates the prop, or redeploy-wiped seat memory).
MtgCardShapeProps has cardBackImageUrl
Holds
Rendering as decided (three branches in MtgCardShapeUtil.component()): sleeved face-down / library pile = solid sleeve rectangle; face-up sleeved card = image centered inside the sleeve frame (proportional padding w*0.03; square corners since e53a27e, 2026-08-09 — Jess: "sleeves are rectangular", the ticket-17 w*0.05 radius was removed);
MtgCardShapeUtil has a component method
Holds
mtg-card gained owner and isCommander — table-layout ticket 18 (2026-08-09). mtg-card.props gained owner: string (seatId) and isCommander: boolean (apps/tabletop/src/shared/mtgCardShape.ts)
2 rules from this sentence
MtgCardShapeProps has owner
checks “mtg-card.props gained owner: string”
Holds
MtgCardShapeProps has isCommander
checks “mtg-card.props gained”
Holds
buildCardPlayedEvent (apps/shuffler/src/port-tabletop/types.ts) sets isCommander: gameCard.isCommander.
buildCardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
CardPlayedPayload in apps/shuffler/src/port-tabletop/types.ts made it a required TS field, and buildCardPlayedEvent populates it from gameCard.gameCardIndex on every send — so every card.played event now actually carries the card's alphabetical rank in the initial decklist array (not library order, which is shuffled).
2 rules from this sentence
buildCardPlayedEvent depends on CardPlayedPayload
checks “CardPlayedPayload in apps/shuffler/src/port-tabletop/types.ts made it a required TS field, and buildCardPlayedEvent populates it from gameCard.gameCardIndex on every send”
Holds
CardPlayedPayload has a gameCardIndex field
Holds
card.played-face-down is a third sender site bound by the backImageUrl-derived- from-twoFaced rule — built card-played-face-down ticket 03, 2026-08-21. apps/shuffler/src/port-tabletop/types.ts gained CardPlayedFaceDownPayload + buildCardPlayedFaceDownEvent alongside CardPlayedPayload/buildCardPlayedEvent
3 rules from this sentence
CardPlayedFaceDownPayload is in apps/shuffler/src/port-tabletop
Holds
buildCardPlayedFaceDownEvent is in apps/shuffler/src/port-tabletop
Holds
CardPlayedPayload is in apps/shuffler/src/port-tabletop
Holds
Ticket 08 (2026-08-23) followed this advice for the fourth face-carrying sender site: buildCardDiscardedEvent also calls cardFaceFields(gameCard), so card.played, card.played-face-down, and card.discarded now all share the one computation in src/port-tabletop/types.ts.
2 rules from this sentence
cardFaceFields is in apps/shuffler/src/port-tabletop
Holds
buildCardDiscardedEvent is in apps/shuffler/src/port-tabletop
Holds
Trigger: a "Play Face Down" button on the hand card modal only (formatModalCardActionsForHand, apps/shuffler/src/view/play-game/game-modals.ts) — not on Revealed, per spec.md — sends req.body["face-down"] === "true" through sendCardBeforeMutate → sendCardPlayedToSpineBestEffort's new trailing faceDown param (apps/shuffler/src/port-spine/sendToSpine.ts), which picks the builder.
formatModalCardActionsForHand is in apps/shuffler/src/view/play-game
Holds
zonehint-deprecation, 2026-08-23.** Every played card has landed on the Stack regardless of zoneHint since 2026-08-16 (applyCardArrival in apps/tabletop/src/server/cardArrival.ts always calls stackCardPosition), and card.discarded.v1 never carried the field at all — so no receiver has read zoneHint for a while;
applyCardArrival depends on stackCardPosition
Holds
apps/tabletop/src/server/cardArrival.ts no longer destructures zoneHint off the incoming envelope or sets a "zone.hint" span attribute, and its now-unused local ZoneHint type and CardPlayedPayload.zoneHint field were deleted (CardPlayedPayload is now just a type alias for CardArrivalPayloadCommon, which never had zoneHint). No behavior change.
CardPlayedPayload depends on CardArrivalPayloadCommon
Holds
Card identity is cardDefinitionId, fleet-wide — a clean break (branch card-definition-id: c9b5e942 contracts, 70b10265 Tabletop, 0a6c52dd Shuffler). The field that names our card identity is cardDefinitionId everywhere: CardDefinition, PersistedGameCard, the card repository's card_definition_id column, the mtg-card shape prop, and card.cardDefinitionId in the v2 schemas.
2 rules from this sentence
CardDefinition has a cardDefinitionId field
Holds
PersistedGameCard has a cardDefinitionId field
Holds
Shuffler persistence: game state 12, prep 4, deck 4 (PersistedDeck.version stays 2). Older state is rejected, not migrated; prep adapters throw IncompatiblePrepVersionError before hydrating, and /prep-table-look maps it to
PersistedDeck has version
Holds
GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath), snapshotted from prep.sleeveColor/prep.playmatImagePath at both /start-game and /restart-game call sites in src/app.ts, stored as new optional fields directly on GameState/PersistedGameState, and rendered: formatLibraryStack() takes an optional third sleeveColor param and (via new helper formatLibraryCardBack()) renders a sleeved back as a flat background-color rectangle instead of the CARD_BACK <img>;
5 rules from this sentence
GameState has a newGame method
checks “GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath)”
Holds
GameState has a sleeveColor field
checks “GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath), snapshotted from prep.sleeveColor/prep.playmatImagePath at both /start-game and /restart-game call sites in src/app.ts, stored as new optional fields directly on GameState/PersistedGameState”
Holds
GameState has a playmatImagePath field
checks “GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath), snapshotted from prep.sleeveColor/prep.playmatImagePath at both /start-game and /restart-game call sites in src/app.ts, stored as new optional fields directly on GameState/PersistedGameState”
Holds
PersistedGameState has a sleeveColor field
checks “GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath), snapshotted from prep.sleeveColor/prep.playmatImagePath at both /start-game and /restart-game call sites in src/app.ts, stored as new optional fields directly on GameState/PersistedGameState”
Holds
PersistedGameState has a playmatImagePath field
checks “GameState.newGame() gained two trailing optional params (sleeveColor, playmatImagePath), snapshotted from prep.sleeveColor/prep.playmatImagePath at both /start-game and /restart-game call sites in src/app.ts, stored as new optional fields directly on GameState/PersistedGameState”
Holds
formatLibraryStack() takes an optional third sleeveColor param and (via new helper formatLibraryCardBack()) renders a sleeved back as a flat background-color rectangle instead of the CARD_BACK <img>;
formatLibraryStack depends on formatLibraryCardBack
Holds
mtg-zone props gained sleeveColor: string | null (set only on a sleeved seat's library zone), MtgZoneShapeUtil renders a sleeved pile as the bare sleeve rectangle, and both renderings share LIBRARY_PILE_INSET = 12 from apps/tabletop/src/shared/mtgZoneShape.ts.
3 rules from this sentence
MtgZoneShapeProps has sleeveColor
checks “mtg-zone props gained sleeveColor: string | null”
Holds
MtgZoneShapeUtil depends on LIBRARY_PILE_INSET
checks “sleeveColor: string | null (set only on a sleeved seat's library zone), MtgZoneShapeUtil renders a sleeved pile as the bare sleeve rectangle, and both renderings share LIBRARY_PILE_INSET = 12 from apps/tabletop/src/shared/mtgZoneShape.ts.”
Holdsclient shared
LIBRARY_PILE_INSET is in apps/tabletop/src/shared
checks “LIBRARY_PILE_INSET = 12 from apps/tabletop/src/shared/mtgZoneShape.ts”
Holds
Shuffler — tracks currentFace on each GameCard, renders flip buttons, sends the current face when a card leaves its boundary.
GameCard has currentFace
Holds
card.played's scaffolding imageUrl field is gone, replaced by frontImageUrl + backImageUrl: string | null (buildCardPlayedEvent in apps/shuffler/src/port-tabletop/types.ts).
buildCardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
A card entering the library resets both axes to face:'front', faceDown:false in MtgCardShapeUtil.onTranslateEnd.
MtgCardShapeUtil has onTranslateEnd
Holds
Aspect State mutation, Details GameState.flipCard() in src/GameState.ts
GameState has a flipCard method
Holds
Aspect View rendering, Details formatFlippingContainer(gameCard, flipRequest) in src/view/common/shared-components.ts FlipRequest says which page is asking (game POST vs prep GET)
formatFlippingContainer is in apps/shuffler/src/view/common
Holds
Aspect Card source, Details CardDefinition.cardSource "scryfall" \
CardDefinition has cardSource
Holds
Aspect Image URLs, Details getCardImageUrl(card, format, face) (prefers stored) + constructCardImageUrl(scryfallId, format, face) (Scryfall-only fallback) in src/domain-types.ts stored in CardDefinition.imageUris / backImageUris A non-scryfall card never reaches constructCardImageUrl
4 rules from this sentence
getCardImageUrl is in apps/shuffler/src
Holds
constructCardImageUrl is in apps/shuffler/src
Holds
CardDefinition has imageUris
checks “CardDefinition.imageUris”
Holds
CardDefinition has backImageUris
Holds
Aspect Image fetch, Details src/port-card-images/ ( ScryfallCardImagesGateway , enrichDeckWithImages ) — fetches Scryfall image URLs at ingestion skips non-scryfall cards
2 rules from this sentence
ScryfallCardImagesGateway is in apps/shuffler/src/port-card-images
Holds
enrichDeckWithImages is in apps/shuffler/src/port-card-images
Holds
Aspect Persistence, Details SqliteCardRepositoryAdapter keys on card_definition_id and stores card_types , image_uris , back_image_uris as JSON, plus card_source (nullable no back_face column) PersistedGameCard.currentFace
PersistedGameCard has currentFace
Holds
Aspect Card modal Copy / Gatherer, Details formatCardModalUtilityLinks(card, face) in src/view/play-game/game-modals.ts — used by all three modal routes Copy passes cardDefinitionId + face Gatherer hidden for non-scryfall cards
formatCardModalUtilityLinks is in apps/shuffler/src/view/play-game
Holds
CardDefinition or type changes: Does it add/remove/rename fields on CardDefinition? There is no CardFace/backFace (removed in f76b49c); don't re-add per-face card text. Card identity is cardDefinitionId — don't reintroduce scryfallId except at Scryfall edges. Also check if PersistedGameCard or hydration logic needs updating.
CardDefinition has cardDefinitionId
Holds
Game state or persistence changes: currentFace is persisted in PersistedGameCard. Version migrations must preserve or default it. The flipCard() method on GameState must stay consistent with the persisted format.
2 rules from this sentence
PersistedGameCard has currentFace
checks “currentFace is persisted in PersistedGameCard”
Holds
GameState has a flipCard method
checks “The flipCard() method on GameState”
Holds
shared shape-building helpers (regionShape, nextIndex, pageIdOf, ensurePlayerArea) live in apps/tabletop/src/server/tableFurniture.ts, and geometry (playmat/library/ graveyard/exile/Stack bounds) lives in apps/tabletop/src/server/cardLayout.ts
4 rules from this sentence
nextIndex is in apps/tabletop/src/server
checks “shared shape-building helpers (regionShape, nextIndex, pageIdOf, ensurePlayerArea) live in apps/tabletop/src/server/tableFurniture.ts”
Holds
pageIdOf is in apps/tabletop/src/server
checks “shared shape-building helpers (regionShape, nextIndex, pageIdOf, ensurePlayerArea) live in apps/tabletop/src/server/tableFurniture.ts”
Holds
ensurePlayerArea is in apps/tabletop/src/server
checks “shared shape-building helpers (regionShape, nextIndex, pageIdOf, ensurePlayerArea) live in apps/tabletop/src/server/tableFurniture.ts”
Holds
stackBounds is in apps/tabletop/src/server
checks “geometry (playmat/library/ graveyard/exile/Stack bounds) lives in apps/tabletop/src/server/cardLayout.ts”
Holds
The shared logic below — dedup, ensurePlayerArea self-heal, placement, and the two-faced-card face/frontImageUrl/backImageUrl handling this file documents — is unchanged in behavior but now lives in cardArrival.ts's applyCardArrival.
applyCardArrival is in apps/tabletop/src/server
Holds
a distinct event kind, card.played-face-down (own contract schema, own builder buildCardPlayedFaceDownEvent), sent by a "Play Face Down" button on the hand card modal only (formatModalCardActionsForHand in apps/shuffler/src/view/play-game/game-modals.ts) — not on Revealed, per spec.md.
formatModalCardActionsForHand is in apps/shuffler/src/view/play-game
Holds
A card is a genuine custom tldraw shape type, mtg-card extending BaseBoxShapeUtil (apps/tabletop/src/shared/mtgCardShape.ts for the validated props schema, apps/tabletop/src/client/shapes/MtgCardShapeUtil.tsx for the util), and it renders its own image.
MtgCardShapeUtil is in apps/tabletop/src/client/shapes
Holds
mtgCardShapeMigrations (createShapePropsMigrationIds("mtg-card", { RenameScryfallId: 1 }), up/down rename) in apps/tabletop/src/shared/mtgCardShape.ts, registered in rooms.ts and on MtgCardShapeUtil.migrations.
3 rules from this sentence
MtgCardShapeUtil depends on mtgCardShapeMigrations
Holdsclient shared
mtgCardShapeMigrations is in apps/tabletop/src/shared
checks “in apps/tabletop/src/shared/mtgCardShape.ts”
Holds
MtgCardShapeUtil has migrations
Holds
The value is read from the optional wire field card.cardSource via cardSourceOf() (apps/tabletop/src/shared/cardSource.ts; absent = "scryfall").
cardSourceOf is in apps/tabletop/src/shared
Holds
Going the other way, card.returned (sendCardReturned.ts) sends card.cardSource only for non-scryfall cards — the same omit-when-scryfall rule as the Shuffler's cardSourceField().
cardSourceField is in apps/shuffler/src
Holds
Spans that set card.definition_id now set card.source too, through cardSpanAttributes() in the same file.
cardSpanAttributes is in apps/tabletop/src/shared
Holds
owner/isCommander added — table-layout ticket 18 (2026-08-09). First-class, schema'd, synced props, set via the ordinary card-arrival path (buildCardPlayedEvent on the Shuffler) and also via seat.joined's new commanders array for cards that start in the Command Zone before anything is played.
buildCardPlayedEvent is in apps/shuffler/src
Holds
Since the card holds both URLs and renders its own <img> in MtgCardShapeUtil.component(), Transform is now a pure shape-prop change — no asset mutation, clean undo.
MtgCardShapeUtil has a component method
Holds
mtg-card props now carry sleeveColor: string | null, baked from seat memory at mint time in cardArrival.ts, and cardBackImageUrl remains the rendering for unsleeved seats only.
MtgCardShapeProps has sleeveColor
Holds
and zone stays deliberately out of props — it's tracked in meta.zone instead (written by MtgCardShapeUtil.onTranslateEnd, per ticket 01's zone-entry detection), so ticket 13 (the ownership-boundary/zone-shape-type question) can decide it rather than inherit it.
MtgCardShapeUtil has onTranslateEnd
Holds
buildCardPlayedEvent reads getCardImageUrl(card, "normal", "back"), not a path-swapped scryfallId — bare constructed Scryfall URLs 404 for freshly-released cards, the whole reason backImageUris is stored on CardDefinition (commit eb48f4f).
CardDefinition has backImageUris
Holds
buildCardPlayedEvent in apps/shuffler/src/port-tabletop/types.ts (field-by-field comment block kept in sync — it is the de-facto spec of F0) and, on the Tabletop side,
buildCardPlayedEvent is in apps/shuffler/src/port-tabletop
Holds
MtgZoneShapeUtil renders the pile as the bare sleeve rectangle inset LIBRARY_PILE_INSET = 12 — a constant moved into src/shared/mtgZoneShape.ts so the server (card-back image geometry) and client (sleeve geometry) share it.
2 rules from this sentence
LIBRARY_PILE_INSET is in apps/tabletop/src/shared
Holds
MtgZoneShapeUtil depends on LIBRARY_PILE_INSET
checks “MtgZoneShapeUtil renders the pile as the bare sleeve rectangle inset LIBRARY_PILE_INSET = 12”
Holdsclient shared
Identity (cardDefinitionId, cardName, both image URLs) stays in props on a face-down card.
2 rules from this sentence
MtgCardShapeProps has cardDefinitionId
Holds
MtgCardShapeProps has cardName
Holds
cardArrival.ts's applyCardArrival(tableName, body) peeks at body.name via a small isFaceDownEnvelope() helper before validating, picks the right expectedName for validateIncomingEvent, and mints faceDown: true on the mtg-card shape instead of the previous hard-coded false
2 rules from this sentence
applyCardArrival depends on isFaceDownEnvelope
Holds
applyCardArrival depends on validateIncomingEvent
Holds
getCardImageUrl always returns a string (it falls back to constructCardImageUrl), so gating on twoFaced is safe;
getCardImageUrl depends on constructCardImageUrl
Holds
712 rules from 38 docs

More open-source reports

Every report →

Other public repositories whose docs Striff read and checked against their code.