Repository navigation
fix(frontend): point dev chessServerURL at chessServer on 3001 (B2) - #269
Merged
Merged
Conversation
ToldYO
approved these changes
Oct 9, 2026
ToldYO
left a comment
Collaborator
There was a problem hiding this comment.
PR Review: LGTM 👍
Thanks for putting this together! The changes look solid and address item B2 cleanly.
Key Highlights & Verification:
- Port Alignment:
chessServercorrectly runs on port3001(as configured inchessServer/src/index.jsanddocker-compose.yml), whilestockfishServerhandles analysis on port8080. - Decoupling in
StockfishTutor.tsx: RestrictingrawBaseinStockfishTutortostockfishServerURL/stockfishServeris essential here. Previously, it preferredurls.chessServerURL(which only worked whenchessServerURLwas erroneously pointed to8080). Directing analysis traffic tostockfishServerURLensures POST requests to/api/analyzehit the correct server instead of 404ing againstchessServeron3001. - Test Suite: Ran frontend tests locally (
npm test -- --watchAll=falseinreact-ystemandchess) — all 30/30 test suites passed (155 tests total).
Minor Nitpick:
- In
react-ystemandchess/src/environments/environment.js, there's a missing trailing newline at the end of the file (\ No newline at end of file). Adding a newline at EOF would keep git diffs clean.
Note on Merge:
Since this branch contains commits from both contributors, please make sure the squash commit message includes the co-author trailer:
Co-authored-by: Ahmad Nakhala <ahmadnakhala2004@gmail.com>
Co-authored-by: sweksha-cloud <swekshas123@gmail.com>
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.
Summary
B2 from the Saved Games, B2 and PR Cleanup Plan (v8). In development,
chessServerURLpointed at port 8080, which is stockfishServer. chessServer runs on 3001. This points it at 3001.That alone would break the AI tutor:
StockfishTutor.tsxreadchessServerURLbeforestockfishServerURLfor its/api/analyzecall, and it only worked because both were 8080. So this PR also carries @ToldYO's two tutor fixes from #215, which make the tutor usestockfishServerURLonly.Type of Change
Key Changes
StockfishTutor.tsx(Ahmad'sb5311ed9and38bd2bdbfrom feat(config, tutor): reconcile environment separation, port map invariants, and AI tutor auth #215, cherry-picked unchanged, authorship kept): the tutor's/api/analyzerequest usesstockfishServerURLonly.environments/environment.js: devchessServerURLis nowhttp://localhost:3001. Lessons (Lesson-overlay.tsx), puzzles (Puzzles.tsx) andStudent.tsxread this key, and all of them talk to chessServer.Testing
Unit tests added/updated
Integration tests added/updated
Manual testing performed
All tests pass
Frontend: 155/155 tests pass,
tsc --noEmitreports 0 errors (on currentmain, cc637f9).Routing check, with chessServer and stockfishServer run directly with Node (not docker, see below) and a socket.io client sending the same events the pages send:
newPuzzleon chessServer returnshost(student seat).newgamethenmovee2-e4 on chessServer updates the board.POST /api/analyzeon stockfishServer (8080) returns 200 withsuccess: true. The same request to chessServer returns 404, which is why the tutor fix has to ship with the port change.B2.2 check: backend in docker, frontend in dev mode
The frontend Docker image is always a production build (
npm run build), which readsenvironment.prod.js, neverenvironment.js. So a fully dockerized run can't exercise this change. The check ran the backend fromdeploy/devin docker (Mongo, middleware, chessServer on 3001, stockfishServer moved to 8080 to matchenvironment.js) and the frontend withnpm start, driven by a headless browser that logged every socket and request.localhost:3001,newPuzzleanswered withhost, and the puzzle'smoveandlastmovego to chessServer.POST localhost:8080/api/analyzeand gets 200 with an analysis.localhost:3001.Lessons: two existing problems found during the check
Lesson-overlay.tsxsendssetstateColorwithout ever sendingnewgame, so chessServer replies "game not found for this socket". Before this PR, the same messages went to stockfishServer on 8080, which ignored them, so lessons had no server-side game before either. Lessons need to callstartNewGame()first; that's a separate fix.getDb()inroutes/lessons.jsandroutes/activities.jsis hardcoded to theystemdatabase, but the dev stack stores data inystem_dev(fromMONGO_URI), so/lessons/getTotalPieceLessonreturns 500. It's the same hardcoded-name bug fixed forusers.jsin Puzzle themes #150.Both happen identically with the old
8080value, so this PR doesn't regress lessons.Follow-up
REACT_APP_CHESS_SERVER_URL; please confirm its value in the Container Apps config.b5311ed9and38bd2bdb(plan step 215.1).