Repository navigation
feat(devex): support running multiple dev stacks in parallel - #1391
Merged
Merged
Conversation
Every port the local stack binds is now resolved in one place
(utils/dev-ports.js) and derived from CUTTLE_PORT_OFFSET, so a second
checkout -- e.g. a git worktree -- can be booted alongside the first
without the ports colliding:
# .env.local
CUTTLE_PORT_OFFSET=1 -> client on 8081, server on 1338
The client, the vite proxy, sails, and cypress all read the same
resolver, so they can't drift onto different ports. Individual ports can
still be pinned with CUTTLE_CLIENT_PORT / PORT, and real environment
variables win over .env.local.
Along the way:
- the dev session cookie is named after the server port, since cookies
ignore port and parallel stacks would otherwise clobber each other's
login
- the e2e specs reach the server through Cypress.env('apiUrl') instead
of a hardcoded localhost:1337, so they follow whichever stack is
running. `e2e:server` now selects its target with CUTTLE_E2E_TARGET
rather than overloading VITE_API_URL
- the sails unit tests lift on an OS-assigned free port instead of 1337,
so `npm run test:unit` works while a dev stack is up
- worktrees/ and .claude/worktrees/ are git-ignored
Resolves #1390
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
itsalaidbacklife
added a commit
that referenced
this pull request
Oct 6, 2026
#1391 added worktrees/ and .claude/worktrees/ to .gitignore so parallel dev stacks don't show up as untracked, but eslint doesn't read .gitignore. Each worktree holds a full checkout, so `npm run lint` walked into them and reported errors for code belonging to another stack -- 30 of them locally, none from this one's source. CI never sees this because no worktree exists there, so it only breaks the local run that AGENTS.md asks for before finishing. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
itsalaidbacklife
added a commit
that referenced
this pull request
Oct 8, 2026
* feat: show the current user's ongoing games on the home page
A player who closed the tab on an in-progress game had no way back in from
the UI: open games are CREATED-only, the spectate list drops anything idle
for 5 minutes, and game history is FINISHED-only. Abandoned games sat at
STARTED forever, reachable only by whoever still had the /game/:id URL.
Adds a "My Current Games" section to the top of the home page's Play tab,
with Continue (a push to /game/:id, which is already the whole rejoin
mechanism) and Archive.
The data rides along on GET /api/game, which the home page already calls on
mount and on socket reconnect, so there is no extra round trip and no new
endpoint. It therefore lives in the gameList store rather than myGames.
Archiving writes GameStatus.ARCHIVED, which already existed in the enum and
was already read as a synonym for FINISHED -- moves are rejected and both
players are demoted to spectators -- but had never been written by anything.
Two guards keep DELETE /api/game/:gameId honest, shared with the list's
canArchive flag via sails.helpers.canArchiveGame so the disabled button and
the 403 cannot disagree:
- the requester must be a player in the game
- ranked games created inside the current season week are blocked, since
they still bear on this week's match
- the game must be dormant, reusing findSpectatableGames' threshold, so a
game can never be pulled out from under an opponent who is still playing
Note that lockGame writes lock/lockedAt to the Game row and so bumps
updatedAt -- the very signal dormancy is measured by. The archive action
validates against the unlocked record and locks only to re-check status.
The season week boundary is extracted out of findOrCreateCurrentMatch into
sails.helpers.getCurrentSeasonWeek so both callers share one implementation.
Resolves #1387
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* refactor(home): tighten the current-games row and label both game lists
Two design fixes from PR review.
The Archive button crowded its row: at the width the home card gives it, an
icon plus a text label left the name column squeezed enough that game names
wrapped. Dropping the label and keeping just an icon frees the space. The
button keeps its accessible name via aria-label, and the tooltip now fires
in both states -- naming the action when archiving is available, explaining
the block when it isn't -- so losing the visible label costs no clarity.
The "No Active Games" placeholder contradicted the new section directly
above it, since a user's current games are plainly active. That list is
specifically games awaiting a second player, so it is now labelled "Open
Games" with a "No Games to Join" placeholder, which names the absent action
rather than a state. Renames home.noGameslist to home.noOpenGames across all
five locales, fixing that key's odd casing on the way past.
Both lists now carry a header, so the Play tab reads as two labelled
sections instead of one labelled list above an anonymous one.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* style(home): give the game-list section headers the app's h2 style
The two section headers rendered smaller than the game names beneath them,
inverting the hierarchy they exist to establish.
Part of that was a stale rule. HomeView carried a scoped `h2 { font-size:
1.25rem }` that was dead on main -- the template had no h2 at all -- so the
headers added in 8c24a34 were the first elements to hit it. Being scoped,
it compiles to `h2[data-v-...]`, which outranks a plain class selector and
clamped the headers to 20px against the game names' 24px. Removing it also
clears the trap for the next h2 added to this view.
The headers now use .text-label-lg (Changa 32px/700), which is already the
h2 section style across the Rules page, so this adds no new CSS and keeps
the Play tab consistent with the rest of the app. Same family as the game
name, so the two read as one voice a size apart rather than as competing
typefaces.
Luckiest Guy was considered and set aside: it is reserved for page titles
here -- #home-card-title renders GAME FINDER in it at 5rem directly above
this card -- so reusing it two levels down flattens the hierarchy instead of
clarifying it.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* refactor: address review feedback on archive flow
Two points from review.
api/controllers/game/archive.js: replace the switch over p0/p1 with an
includes check against the player ids, matching set-is-ranked.js.
src/plugins/sockets/inGameEvents.js: drop the raw `i18n.global.t()` call in
favour of the composable. It can't be used in this module directly --
useI18n() throws MUST_BE_CALL_SETUP_TOP outside a component setup, and
socket handlers run from io.socket.on with no component instance -- so the
handler now hands Home the i18n key through `query.error` instead of a
translated string. HomeView's $route watcher already reads that key and runs
it through the composable's t(), which is how router.js bounces failed game
loads, so the translation happens in a component the way it does elsewhere
and the raw import goes away entirely.
Moves the message from game.snackbar.global to home.snackbar alongside the
other "bounced back to Home" strings (cannotJoin, cantFindGame,
cannotSpectate), since that is now where it is displayed.
Adds a test pinning the key handover, so renaming the key cannot silently
degrade the message to a raw dotted string.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* feat(announcement): announce My Current Games on the home page
Replaces the Topdeck Nines announcement with one covering the new
My Current Games section: where in-progress games now appear, that Continue
drops you back into the game, and that the × archives an abandoned one.
The second paragraph states the two archive restrictions deliberately, since
both are cases where the button is visibly disabled with no inline
explanation -- games still being played, and ranked games from the current
week.
Illustrated with a screenshot of the real section, showing both the enabled
and disabled archive states. Note the image is English for every locale;
the surrounding copy is translated.
Bumps the id so everyone who dismissed the Nines announcement sees this one.
Drops the now-unused patreonLink key from all five translation files.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* refactor: address second round of review feedback
archive.js: chain the filter and includes into a single isPlayerInGame
variable used by the conditional, per review. Keeps the filter -- an unset
p0/p1 would otherwise let an undefined session user match -- and says so in
the comment, since the question came up twice. Also applies the suggested
wording on the lock comment.
gameList.js: requestArchiveGame could reject with a bare string, an Error, or
whatever non-string `message` the response body happened to carry, and threw
outright on a null body. Normalises every failure path to an Error carrying a
string, which is the shape CurrentGameListItem already reads.
CurrentGameListItem.vue: replace the v-tooltip component and its activator
slot with the tooltip directive.
The directive binds to the span wrapper rather than the button itself. A
disabled v-btn renders as <button disabled> with pointer-events:none, so a
real pointer never reaches it and binding there would leave the blocked-state
tooltip permanently invisible -- while still passing a test that triggers
mouseenter on the button directly, since that dispatches straight to the
element. The two new tests hover the wrapper for that reason, and assert the
pointer-events:none that makes it necessary.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* refactor(home): fold CurrentGameListItem into GameListItem
Per review: GameListItem already served both join and spectate, so the
current-games row becomes a third mode rather than a second component.
Replaces the isSpectatable boolean with an explicit `mode` prop
(join | spectate | current), exported as GAME_LIST_ITEM_MODE from a companion
<script> block since <script setup> cannot carry named exports. Three
booleans would have been three ways to express the same one-of-three choice,
including invalid combinations.
Converts the component to <script setup>, per AGENTS.md. That was the main
cost of merging: the existing component was Options API, and the new one had
to be script setup, so one of the two had to move.
Drops the p0ready/p1ready props. They only ever fed a numPlayersReady
computed that the template never referenced -- dead since before this branch,
and surfaced by having to account for every prop while merging.
Keeps distinct root data-cy values per mode: tests counting
[data-cy=game-list-item] would otherwise pick up current games too.
Verified across the full out-of-game suite (139 tests), since this component
backs the join, spectate and current lists.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* chore(lint): ignore the in-repo worktree directories
#1391 added worktrees/ and .claude/worktrees/ to .gitignore so parallel dev
stacks don't show up as untracked, but eslint doesn't read .gitignore. Each
worktree holds a full checkout, so `npm run lint` walked into them and
reported errors for code belonging to another stack -- 30 of them locally,
none from this one's source.
CI never sees this because no worktree exists there, so it only breaks the
local run that AGENTS.md asks for before finishing.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* style(home): drop the list headings, fill the Continue button
The two section headings cost ~80px at the top of a list pinned to 50vh,
which pushed the first joinable game below the scroll fold -- the heading was
visible with nothing under it, so an empty-looking section read as "no open
games" rather than "scroll for more". Measured at a 760px viewport: the
first join row ended at 380px inside a 308px window; without the headings it
ends at 296px and clears it.
Removing them needs the two groups to stay distinguishable, which the rows
already half-managed through their secondary line and button verb ("vs
<name>" + Continue against "n / 2 players" + Join). Filling the Continue
button finishes the job: filled-against-outlined separates the groups at a
glance, and resuming a game you're part-way through outranks browsing for a
new one, so the weight sits in the right place.
Drops home.myCurrentGames and home.openGames across all five locales, now
that nothing references them.
Known trade-off: against a filled button the disabled archive icon is much
fainter, so on a blocked row the control is easy to miss entirely. Left as
is -- it only affects rows where the action is unavailable anyway, and the
opacity is adjustable on its own if it proves a problem.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* fix(announcement): refresh the screenshot and drop the stale heading reference
The announcement shipped a screenshot of the previous design -- section
headings, outlined Continue -- which 3cbf5d4 replaced. Recaptures it against
the current layout, and now frames two in-progress games above a joinable one
so the image shows the arrangement the copy describes.
The copy pointed readers at a heading that no longer exists ("at the top of
the Play tab, under My Current Games"). Drops that clause in all five
locales; the rest of the paragraph still holds.
Leaves the announcement id alone: the content is the same announcement
corrected, not a new one, and it has not shipped yet, so nobody has a
dismissal to reset.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* chore: use explicit .json requires in the archive helpers
#1397 made backend JSON imports explicit so the editor can resolve them;
these three files predate that merge and still used the extensionless form.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* refactor(find-current-games-for-user.js): use spread
Co-authored-by: Henry Aviles <[email protected]>
* docs: say what currentWeek actually is in canArchiveGame
Per review, the input description named its source helper but never said what
the value holds or why it is needed. Now states both: the running season with
its current week's bounds, used to block archiving a ranked game created
inside that week.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
* fix(security): keep populated user records out of the current-games payload
f82ec05 replaced the explicit field list with `...game`, which also spreads
the populated p0/p1 User records. User has an encryptedPassword attribute and
no customToJSON, so GET /api/game began returning both players' bcrypt hashes
to the client on every home page load:
p0 keys: createdAt, encryptedPassword, id, isBot, pNum, rank, updatedAt, username
Keeps the spread, but destructures p0/p1 away first, along with the lock and
lockedAt concurrency fields. The `opponent` key below already carries the only
user data the client needs, and nothing on the frontend read the populated
records.
Verified against the running endpoint: encryptedPassword no longer appears in
the response.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAEzsNrfdmwzM36fzPWxV9
---------
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Henry Aviles <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue number
What this does
Every port the local stack binds is now resolved in one place (
utils/dev-ports.js) and derived from a singleCUTTLE_PORT_OFFSET, so a second checkout — e.g. a git worktree — can be booted alongside the first without the ports colliding:The client, the vite proxy, sails, and cypress all read the same resolver, so they can't drift onto different ports. Individual ports can still be pinned with
CUTTLE_CLIENT_PORT/PORT, and a real environment variable (CUTTLE_PORT_OFFSET=2 npm run start:dev) wins over.env.local.Along the way:
cuttle.sidlogin. The dev cookie is now named after the server port.http://localhost:1337strings becameCypress.env('apiUrl').e2e:serverselects its target withCUTTLE_E2E_TARGET=serverinstead of overloadingVITE_API_URL; the CI workflow sets the same variable, so it stays pinned to 1337.npm run test:unitworks while a dev stack is up — it used to fail outright withEADDRINUSE.worktrees/and.claude/worktrees/..envis unchanged. Vite prioritizes realVITE_*process env over env files, so the derived urls win in dev while deploy environments still win everywhere else. Local sails now getsVITE_API_URL/VITE_FRONTEND_URLbackfilled, which also makes local OAuth redirects resolve — they previously evaluated toundefined/api/....Out of scope (happy to follow up):
docker-compose.ymlstill has fixedcontainer_names and host port mappings, and storybook still hardcodes-p 6006, so two dockerized stacks or two storybooks will still collide.Please check the following
Please describe additional details for testing this change
Verified by actually booting a second stack rather than only reading config:
CUTTLE_PORT_OFFSET=1in.env.local, thennpm run start:server+npm run start:client→ sails bound 1338, vite bound 8081,8081/api/...proxied through to 1338, the served client module carried"VITE_API_URL": "http://localhost:1338", and the server replied withSet-Cookie: cuttle.sid.1338.npx cypress runagainst that stack with no extra flags:health.spec.js2/2 andauthentication.spec.js18/18 — the latter exercises both the socket url andwipeDatabasethroughCypress.env('apiUrl').npm run lintclean andnpm run test:unit83/83, run while another server held port 1337.To try it: copy
.env.local.exampleto.env.localin one checkout, start both stacks, and confirm you can be logged in as different users in each at the same time. See the new "Running several stacks at once" section indocs/setup-development.md.🤖 Generated with Claude Code