Skip to content

feat(config, tutor): reconcile environment separation, port map invariants, and AI tutor auth - #215

Open
ToldYO wants to merge 22 commits into
mainfrom
feature/ai-tutor-auth-remediated
Open

ToldYO wants to merge 22 commits into
mainfrom
feature/ai-tutor-auth-remediated

Conversation

@ToldYO

@ToldYO ToldYO commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements the forensic remediation plan for environment separation and port alignment:

  1. Replaces the hardcoded 8080 fallback port in development with the authoritative port map (chessServerURL: 3001, chessClientURL: 3002, middlewareURL: 8000, stockfishServerURL: 8080).
  2. Fixes environment.prod.js to enforce explicit build-time URL variables via requiredProductionEnv.
  3. Completes AI Tutor authentication reconciliation by passing JWT bearer tokens to /chat/session and /chat/chess-feedback.
  4. Adds build arguments to the root docker-compose.yml and updates the Dockerfile.
  5. Adds automated port invariant unit tests, middlewareNode CI testing, and a PR single-authorship check.

Type of Change

  • New feature
  • Bug fix
  • Refactor
  • Documentation update
  • Style/UI update
  • Performance improvement
  • Other: CI/CD & Docker configuration

Key Changes

  • Frontend Environment: Fixed fallback URLs in src/environments/environment.js, updated environment.prod.js, and added REACT_APP_CHESS_CLIENT_URL to Dockerfile.
  • AI Tutor Auth: Updated ChatWidget.tsx and StockfishTutor.tsx to forward cookies.login JWT token in Authorization headers.
  • Middleware Validation: Updated validateEnvironment.js with clear startup diagnostics for development and bypass for tests.
  • Docker Compose: Wired build args in canonical root docker-compose.yml and deleted dead deploy/dev/docker-compose.yml.
  • CI & Tests: Added Test middlewareNode step and PR single-authorship validation in .github/workflows/ci.yml. Added environment.test.js asserting port invariants and no temporary hack markers.

Testing

  • Unit tests added/updated (react-ystemandchess/src/environments/environment.test.js)
  • Integration tests added/updated
  • Manual testing performed
  • All tests pass:
    • react-ystemandchess: 30/30 suites passed (163 tests)
    • middlewareNode: 22/22 suites passed (264 tests)
    • chessServer: 4/4 suites passed (33 tests)
    • stockfishServer: 2/2 suites passed (12 tests)

Bugs Fixed (if applicable)

  • Fixed chessServerURL pointing to 8080 in dev config.
  • Fixed missing chessClientURL (port 3002) in frontend configs.
  • Fixed dead path secrets injection in CI.
  • Prevented silent Nginx upstream reverts.

Additional Notes

@ToldYO
ToldYO force-pushed the feature/ai-tutor-auth-remediated branch from 913ed71 to 793a501 Compare August 29, 2026 02:25
@sweksha-cloud sweksha-cloud mentioned this pull request Aug 30, 2026
5 of 13 tasks
sweksha-cloud added a commit that referenced this pull request Oct 9, 2026
…269)

B2 from the Saved Games, B2 and PR Cleanup Plan (v8). In development, chessServerURL pointed at port 8080 (stockfishServer); chessServer runs on 3001.

- StockfishTutor.tsx: the tutor's /api/analyze request uses stockfishServerURL only (Ahmad's b5311ed and 38bd2bd from #215). Without this, moving chessServerURL to 3001 would send tutor analysis to chessServer, which has no such route.
- environment.js: dev chessServerURL is now http://localhost:3001.

Development only. Production reads REACT_APP_CHESS_SERVER_URL (B2.4).

Co-authored-by: Ahmad Nakhala <ahmadnakhala2004@gmail.com>
Co-authored-by: sweksha-cloud <swekshas123@gmail.com>
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