Skip to content

Sprint 2 — UX fixes, staging env, admin tools, player sync improvements#177

Merged
saggacce merged 17 commits into
mainfrom
develop
May 14, 2026
Merged

Sprint 2 — UX fixes, staging env, admin tools, player sync improvements#177
saggacce merged 17 commits into
mainfrom
develop

Conversation

@saggacce
Copy link
Copy Markdown
Owner

Sprint PR — Sprint 2

Cambios incluidos

Player Scouting

  • Auto-sync al abrir un perfil sin snapshot (datos aparecen sin Refresh)
  • Refresh visible para todos los roles (no solo pred.gg OAuth)
  • Refresh ahora sincroniza perfil + partidas recientes + event stream

Platform Admin

  • Reset de contraseña de usuarios desde el panel
  • Sync endpoints usan credenciales almacenadas como fallback (no requieren OAuth activo)

Infraestructura

  • Entorno de staging local: ./serve.sh staging — nginx + build real desde rama develop
  • Sprint testing issue se crea automáticamente al abrir sprint PR
  • Issue de testing reabre si se cierra con checkboxes pendientes
  • nginx timeout en producción → 1800s (sync masivo no da 504)

Organización

  • Roadmap migrado a GitHub Issues con labels, milestones y Project
  • future_features_roadmap.md eliminado (GitHub es la fuente de verdad)
  • Ramas limpias: solo main y develop

Testing

Issue de testing se creará automáticamente al abrir este PR.

🤖 Generated with Claude Code

saggacce and others added 10 commits May 14, 2026 14:45
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All roadmap items migrated to GitHub Issues #160-#172 with labels,
milestones (Sprint 2, Sprint 3, Backlog) and GitHub Project board.
GitHub is now the single source of truth for roadmap management.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- POST /admin/users/:id/reset-password with bcrypt hash
- KeyRound button in user list (disabled for own account)
- Modal with password field (min 8 chars) and confirmation
- resetPassword() added to apiClient.admin

Closes #173

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- serve.sh staging: build frontend + start Express :3002 + nginx :8080
- serve.sh staging-stop / staging-status
- .env.staging template (gitignored)
- Mirrors production config: NODE_ENV=production, nginx proxy, PM2-like

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
./serve.sh staging now fetches origin/develop and runs from
/tmp/riftline-staging — always reflects the real develop state,
not local uncommitted changes. Worktree cleaned up on staging-stop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…redentials

- POST /players/sync falls back to stored predgg_refresh_token when no
  user OAuth token (allows MANAGER/COACH/PLAYER to refresh player profiles)
- Refresh button shown for internalAuthenticated (any logged-in user)
  instead of authenticated (pred.gg OAuth only)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a player profile is opened and has no snapshot data (generalStats
empty), automatically triggers the same sync as the Refresh button.
User sees data appear without having to click anything.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
POST /players/sync now:
1. Syncs player profile and creates snapshot (immediate, blocking)
2. Syncs recent matches + event stream in background (non-blocking)

After clicking Refresh on a player profile, all new matches and their
timeline/analysis data appear automatically within seconds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a19e57df0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +84 to +89
if (!userToken) {
try {
const cred = await db.platformCredential.findUnique({ where: { key: 'predgg_refresh_token' } });
if (cred) {
const result = await exchangeToken({ grant_type: 'refresh_token', refresh_token: cred.value });
if (result.ok && result.data.access_token) userToken = result.data.access_token;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Require auth before using platform sync token

Because /players/sync is still registered without requireAuth, this fallback lets any unauthenticated caller exchange the stored predgg_refresh_token and run player + recent-match syncs against the database. The rest of the app mounts playersRouter directly (apps/api/src/index.ts) with no global auth, so a public POST can now consume the platform credential/quota and write arbitrary synced players; gate this fallback/route behind internal auth or admin authorization before reading the stored credential.

Useful? React with 👍 / 👎.

Comment thread serve.sh
Comment on lines +327 to +328
"$STAGING_DIR/node_modules/.bin/tsx" "$STAGING_DIR/apps/api/src/index.ts" \
>> "$STAGING_LOG" 2>&1 &
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass staging env values when launching the API

The staging command advertises API :3002 and a production-like built frontend, but this launch relies on .env.staging to provide PORT and NODE_ENV; copying from .env.example leaves both unset. In that common setup the API uses its default process.env.PORT ?? '3001' (apps/api/src/index.ts:41) and skips the production static serving//api rewrite, so wait_for_port 3002 fails or staging serves the wrong mode. Prefix the command with PORT=$STAGING_API_PORT NODE_ENV=production (or export them explicitly) instead of relying on hidden env file keys.

Useful? React with 👍 / 👎.

saggacce and others added 7 commits May 14, 2026 16:49
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…precise check

- Remove internalAuthenticated check (race condition with async auth state)
- Check typeof matches === 'number' instead of Object.keys empty check
  (handles partial snapshots with favRole/favHero but missing numeric stats)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… missing

When no snapshot exists or snapshot has no match data, calculate MATCHES,
WIN RATE, KDA and HERO DAMAGE directly from the MatchPlayer records already
loaded for the profile. This works without pred.gg API call and shows
data immediately on first load.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace IIFE with explicit variable computed before the return statement.
The IIFE was silently returning {} despite matchPlayers being available.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing start

- Compute generalStats as explicit variable before return (IIFE had tsx cache issue)
- Clear ~/.cache/tsx on each staging start to ensure latest code runs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
BUG-001: generalStats empty (tsx cache + IIFE issue)
BUG-002: staging serving old code (tsx cache)
BUG-003: upgrade-insecure-requests blocks fetch on HTTP
BUG-004: secure cookies rejected over HTTP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

🧪 Testing requerido

Se ha creado el issue de testing: #179

Completa el checklist y cierra el issue antes de aprobar el deploy en producción.

#179

@saggacce saggacce merged commit 819094e into main May 14, 2026
5 checks passed
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