--- id: CB-WP-0024 kind: product title: "The table you can watch: the piles, the other seats' moves, the score that carries" status: done state_hub_workstream_id: "5f17b6f9-cd4b-4c31-a8af-712313149cf2" --- # Purpose ``` structural tier S (renders state the projection already carries, inside cb-render-html and cb-play — no new port, no canonical interface, no dependency) chaos d8 = 6 → no override declared tier S ``` Declaration 7 of chaos window 2. ## Five remarks from play, and what is actually true of each The maintainer played several games and reported five things. Four are this pass. Each was checked against the code before being written down, because **two findings have already reached `ground-game` on wrong premises** (CB-WP-0023 T01, GROUND-WP-0004 T02) and the rule now is that a claim names the line that makes it true. | # | reported | what the code says | |---|---|---| | 1 | *"the button next to new game says 'I need to read this' — why? the UI is not closing"* | `doc.rs:825` renders `close — I have read this`. `hotseat.rs:248` reads it as **shut the server down**. The label describes a reading; the control ends a process. And nothing closes: a page cannot close a tab it did not open, so the tab sits there showing a dead game against a dead port. | | 4 | *"following the other players is only possible in the log"* | Wrong by degree, not in kind. `player_card` (`doc.rs:385`) draws each seat, and `selections` are `Shown` for every seat once `step != Select` (`view.rs`) — so the data is there and is being drawn as words. What is missing is that a seat's *play* is not drawn **as a card on the table**. | | 4b | *"visualise the draw stack and the discard stack"* | Both already project: `solution_deck_len` and `solution_discard` (`view.rs`). `body()` prints them as one line of text (`doc.rs:575`). Nothing is missing from the model; the whole gap is rendering. | | 5 | *"if we calculate scores, show them — and a cumulative score over several games"* | Per-game scores exist and **are already drawn**: `OutcomeView.personal`, `.mastery`, `.winners`, `.total`/`.threshold` (`doc.rs:582–628`). Cumulative does not exist at all: `table.rs:241` loops `run_game` and returns **only the last summary**. | Remarks 2 (*how could we have won*) and 3 (*difficulty*) are **not this pass** — they need a search and a measurement, not a renderer. They are CB-WP-0025. **So this pass is smaller than the remarks make it sound.** One control is mislabelled, one number is missing, and three things that already project are being written as text where a picture would read better. That is why it is S: no new state leaves the aggregate, and `view.rs` gains nothing except where task T04 says so explicitly. ## Task: the ending control says what it does, and the page acts on it ```task id: CB-WP-0024-T01 status: done priority: high state_hub_task_id: "acb4231c-35df-490f-93fd-be71c0abf1dc" ``` Two defects behind one button. **The label lies about the mechanism.** `done` does not mean *I have read this*; it means *stop serving*. Rename it to what it does — the session ends, the process exits — and drop the first-person reading claim. The `data-drop` key stays `done`: `hotseat.rs:248` matches on the body and the tests in `hotseat.rs:524` drive it. **The page does not change.** After the POST the server replies `closed` and breaks its loop; the tab keeps showing a live-looking table with a `play again` control that now hits a closed port. Replace the page body on acknowledgement with a terminal state that says the session has ended and this tab can be closed — and **disable `play again` at the same moment**, because a control that can no longer work must not look like it can. **Controls:** - a test asserts the acknowledged page no longer offers `again` — not just that it shows different words; - `hotseat.rs`'s existing `play_again_deals_a_second_game` must still pass unchanged, or the key was renamed and the server was not told; - the label change must be mutation-visible: assert the rendered text, so reverting the wording turns a test red. **Done 2026-08-05.** Label is now `end session — stops the game server`; the reply is `closed — the session has ended and the server has stopped. You can close this tab.`; and the script **seals** the page on a `closed` reply — `removeAttribute('data-drop')` on every control, so they stop being droppable by the same rule that made them droppable. `sealed` CSS is how that reads, not the mechanism. **`removeAttribute`, not `setAttribute(_, null)`** — the latter writes the literal string `"null"` in a browser, which is truthy, so the control would stay live while the stub reported it sealed. **The reply path had never been executable in a test.** `jsrun`'s `fetch` stub returned `{then: function(){return this}}`, which never invoked its callbacks — so every line of the script that reacts to what the server said was unreachable from every test in the project. **That is why this defect survived**: a page that ignores the server looked identical to one that acts on it. The stub now delivers a real then-chain, and `gesture_with_reply` reports the page's surviving controls. Three tests, and the seal is mutation-proven: deleting the `closed` branch turns exactly one red. The negative control (`ok: dealing` must NOT seal) exists because a seal that fired on every reply would pass the first test and break `play again`. `cb-play`: 22 passed, including `play_again_deals_a_second_game`. ## Task: the piles are objects on the table ```task id: CB-WP-0024-T02 status: done priority: high state_hub_task_id: "37b16a87-e791-4c85-9f60-671812f6dd2e" ``` Draw the draw stack and the discard stack as stacks, with their counts on top, replacing the text line at `doc.rs:575`. `problem_svg` and `relations_svg` are the precedent for how this repo draws — follow them rather than inventing a second idiom. The maintainer asked for one thing the model does not yet do: **when the draw stack runs out, the discard shows a shuffle**. Before drawing that, establish whether it happens. Search the aggregate for the reshuffle: if `solution_deck` is refilled from `solution_discard` anywhere, render the moment; **if it is not, that is a finding, not a rendering task** — the deck can be exhausted and the rules do not say what then. Raise it through CB-WP-0022's register as *underdetermined* and report it to `ground-game`. Do not implement a reshuffle. Inventing rules is what CB-WP-0023 exists to stop. **Controls:** - the drawn counts come from `solution_deck_len` and `solution_discard.len()`, asserted against the view, never recomputed; - a discard of zero cards renders as an empty pile, not as a missing one — an absent slot reads as "no discard exists in this game"; - the shuffle question is answered in the task record with the line number that settles it, either way. **Done 2026-08-05.** Both piles are drawn as offset stacks with their counts, replacing the text line. Depth suggests *a pile exists*; the number is the truth — 17 cards is not seventeen rectangles. **The shuffle question is settled and the answer is that it already works.** `games/ground/src/lib.rs:1419-1435` (`draw_solution`) implements the **U4 default**: deck empty → deterministic reshuffle of the discard via a `DeckReshuffled` event seeded from `seed ^ round`; both empty → skip the draw. ground-game **confirmed U4 on 2026-08-03**, so this is a ruled rule, not an invented one. Nothing to raise. The event already reads out in the log (`hotseat.rs:374`). What the piles add is the *state before it fires*: deck 0 with a non-empty discard draws an arrow and says **"shuffles in on next draw"**. That is derivable from the view; a claim that a reshuffle *has happened* would not be, and is not made. **The coverage gate caught the probe going stale** — removing the `17 remaining` text broke `solution_deck_len`'s classification. Fixed by putting the count in the pile's `