Backend infers play direction; UI previews words and gates submit on legality #44

Merged
developer merged 2 commits from feature/auto-play-direction into development 2026-06-11 21:02:47 +00:00
Owner

What

A single tile that only extends a word perpendicular to the client-declared direction was rejected. The UI always sent dir=H for one-tile plays (the dirOverride/Controls toggle was orphaned in the Stage 7 game rework, commit 2c96c19), so placing "А" above "БАК" to form "АБАК" failed the solver's main-word-length check even though the word is in the dictionary. Diagnosed against the contour game 019eb0e1-….

How

  • Engine infers a play's orientation from the placed tiles + board (internal/engine.resolveDirection): ≥2 tiles by the line they share; a lone tile by the axis it abuts (longer word wins, horizontal on a tie). Exhaustive unit tests + the АБАК regression.
  • Direction becomes a response field, not a request field: dropped from the SubmitPlay/Eval wire requests, added to EvalResult. Journal replay keeps trusting the stored "H"/"V" (SubmitPlayDir) so a rebuilt game matches the committed one.
  • UI stops computing/sending direction; the preview now shows the words a move forms with its total score (game.previewWords); the make-move control is disabled until the play is confirmed legal; the "your turn" label hides while tiles are pending. Orphaned Controls.svelte deleted.
  • Regenerated the FlatBuffers bindings (Go + TS); updated the gateway transcode and the loadtest edge client; baked the decision into ARCHITECTURE.md (§5/§9.1), FUNCTIONAL.md (+ _ru) and the backend README.

Tested locally

backend unit + integration (testcontainers), gateway, loadtest (build/vet/test), UI check + unit (153) + build + e2e (100, Chromium + WebKit); gofmt clean.

## What A single tile that only extends a word **perpendicular** to the client-declared direction was rejected. The UI always sent `dir=H` for one-tile plays (the `dirOverride`/`Controls` toggle was orphaned in the Stage 7 game rework, commit 2c96c19), so placing "А" above "БАК" to form "АБАК" failed the solver's main-word-length check even though the word is in the dictionary. Diagnosed against the contour game `019eb0e1-…`. ## How - **Engine** infers a play's orientation from the placed tiles + board (`internal/engine.resolveDirection`): ≥2 tiles by the line they share; a lone tile by the axis it abuts (longer word wins, horizontal on a tie). Exhaustive unit tests + the АБАК regression. - **Direction becomes a response field, not a request field**: dropped from the `SubmitPlay`/`Eval` wire requests, added to `EvalResult`. Journal replay keeps trusting the stored "H"/"V" (`SubmitPlayDir`) so a rebuilt game matches the committed one. - **UI** stops computing/sending direction; the preview now shows the words a move forms with its total score (`game.previewWords`); the make-move control is **disabled until the play is confirmed legal**; the "your turn" label hides while tiles are pending. Orphaned `Controls.svelte` deleted. - Regenerated the FlatBuffers bindings (Go + TS); updated the gateway transcode and the loadtest edge client; baked the decision into `ARCHITECTURE.md` (§5/§9.1), `FUNCTIONAL.md` (+ `_ru`) and the backend README. ## Tested locally backend unit + integration (testcontainers), gateway, loadtest (build/vet/test), UI `check` + unit (153) + `build` + e2e (100, Chromium + WebKit); gofmt clean.
developer added 1 commit 2026-06-11 20:43:02 +00:00
Backend infers play direction; UI previews words and gates submit on legality
CI / changes (pull_request) Successful in 1s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 12s
CI / ui (pull_request) Successful in 44s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m9s
92f48a3b12
A single tile that only extended a word perpendicular to the client-declared
direction was rejected: the UI always sent dir=H for one-tile plays (the
dirOverride/Controls toggle was orphaned in the Stage 7 game rework), so placing
"А" above "БАК" to form "АБАК" failed the solver's main-word-length check even
though the word is in the dictionary.

Make the backend infer a play's orientation from the placed tiles and the board
(internal/engine.resolveDirection): two or more tiles by the line they share, a
lone tile by the axis it abuts (longer word wins, horizontal on a tie). Direction
becomes an output, not an input: drop dir from the SubmitPlay/Eval wire requests
and add it to EvalResult. Journal replay keeps trusting the stored "H"/"V"
(SubmitPlayDir) so a rebuilt game matches the one committed.

UI: stop computing/sending direction; the preview now shows the words a move
forms with its total score (game.previewWords); the make-move control is disabled
until the play is confirmed legal; the "your turn" label hides while tiles are
pending. Delete the orphaned Controls.svelte.

Regenerate the FlatBuffers bindings (Go + TS) and update the gateway transcode
and the loadtest edge client to the new contract. Bake the decision into
ARCHITECTURE.md (§5/§9.1), FUNCTIONAL.md (+ _ru) and the backend README.
developer added 1 commit 2026-06-11 20:58:42 +00:00
UI: remove the lobby game-row tap highlight
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 8s
CI / integration (pull_request) Successful in 12s
CI / ui (pull_request) Successful in 44s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 56s
883212f9d1
A tap/click on a lobby game row flashed a highlight on both tappable areas (the
open body and the right chevron/kebab), and the .open:active background lingered
while the finger was held — pointless feedback that only spoiled the look. Drop
the held :active background and set -webkit-tap-highlight-color: transparent on
the row's buttons.
owner approved these changes 2026-06-11 21:01:44 +00:00
developer merged commit 5648f4a0bb into development 2026-06-11 21:02:47 +00:00
developer deleted branch feature/auto-play-direction 2026-06-11 21:02:47 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/scrabble-game#44