Skip to content

Integrate PR #1: new client at /, original at /classic#2

Merged
samclearman merged 3 commits into
masterfrom
integrate-pr-1
Jul 14, 2026
Merged

Integrate PR #1: new client at /, original at /classic#2
samclearman merged 3 commits into
masterfrom
integrate-pr-1

Conversation

@samclearman

Copy link
Copy Markdown
Owner

Integrates the work from #1 while preserving the original hand-written client. Instead of replacing the client in place (as #1 did), this keeps the original untouched and adds the new one alongside it.

What's here

Server (5570df2) — merges the server-side changes from #1: bot players (add_bot/remove_bot, scheduled bot turns), an /api/create-game endpoint, and extraction of the camel-movement helpers into camel-movement.js. All changes are additive except one latent bug fix noted below. The original client was verified working against this server.

New client (4e3238f) — the React 19 + Vite client from #1, extracted into a new client_v2/ directory. The original client/ is left completely untouched. Regenerated package-lock.json (the PR shipped the stale create-react-app lockfile, which referenced react-scripts and no Vite).

Serving (e8ad23a) — one Express server hosts both:

  • new client (default) at /
  • original client at /classic

build.sh builds both into server/static (original built with PUBLIC_URL=/classic so its assets resolve under the prefix). No app.yaml change needed. Both clients key off the ?game= query string and connect their socket same-origin, so the original needs no code changes to run under /classic.

Heads up: server behavior change

The camel-movement extraction is not purely mechanical — moveCamel's guard changed from if (newPosition) to if (newPosition != null). This fixes a latent bug where a camel landing on position 0 (a black/white camel reversing to the start, or one pushed to 0 by a desert tile) was removed from the board and never replaced. Behavior at all other positions is unchanged.

Testing

Verified against a production-mode server: / and /classic both load, their assets return 200, and /api/create-game + socket.io work. Original client also manually tested against the updated server.

Co-authored with the original PR author (@nikhiljha).

🤖 Generated with Claude Code

samclearman and others added 3 commits July 13, 2026 14:25
Brings in the server-side portion of PR #1 by path, leaving the
original client/ untouched. Verified the original client still works
against this server.

- index.js: additive only — /api/create-game HTTP endpoint, bot
  players (add_bot/remove_bot socket events, bot_list updates,
  scheduled bot turns), guards against renaming/removing bots.
- reducer.js: camel-movement helpers extracted into camel-movement.js.
- New: bot.js, camel-movement.js, sim.js, sim-batch.js, words.js.
- .npmrc: min-release-age=7 (supply-chain safety for installs).

Note: the extraction is NOT purely mechanical. moveCamel's guard
changed from `if (newPosition)` to `if (newPosition != null)`,
fixing a latent bug where a camel landing on position 0 (a black/
white camel reversing to the start, or one pushed to 0 by a desert
tile) was removed from the board and never replaced. Behavior for
all other positions is unchanged; the original client renders the
corrected state fine.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Nikhil Jha <nikhiljha@users.noreply.github.com>
Extracts the new React 19 + Vite client from PR #1 into its own
client_v2/ directory, leaving the original hand-written client/
completely untouched. The new client will become the default
(served at /), with the original served at /classic (wired up next).

- Regenerated package-lock.json: the PR shipped the stale CRA lock
  (referenced react-scripts, no vite); npm install rebuilt it from
  the Vite package.json.
- Builds cleanly with vite build → client_v2/dist (root-absolute
  asset paths, correct for serving at /).
- .gitignore: ignore client_v2/node_modules and client_v2/dist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Nikhil Jha <nikhiljha@users.noreply.github.com>
Wires up the single Express server to host both clients:
- build.sh now builds client_v2 into server/static (root) and the
  original client into server/static/classic. The original is built
  with PUBLIC_URL=/classic so its CRA assets resolve under that path.
- index.js mounts static/classic at /classic ahead of the root
  static mount.

Both clients read the game id from the ?game= query string (not the
path) and connect their socket same-origin in production, so serving
the original under a /classic prefix needs no client code changes.

Verified against a production-mode server: / and /classic both load,
their assets return 200, /api/create-game and socket.io work.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Nikhil Jha <nikhiljha@users.noreply.github.com>
@samclearman samclearman merged commit e3b2e91 into master Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant