Skip to content

Add backend logging for opening drill sessions#104

Merged
kevinjosethomas merged 3 commits into
devfrom
copilot/fix-103
Jul 19, 2025
Merged

Add backend logging for opening drill sessions#104
kevinjosethomas merged 3 commits into
devfrom
copilot/fix-103

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 18, 2025

This PR implements backend logging for opening drill sessions to track user practice patterns and performance data.

Changes Made

New API Endpoints

  • POST /opening/select_opening_drills - Called when user clicks "Start Drilling"
    • Logs opening selections, opponent choice, and drill configuration
    • Returns session ID for tracking the drill session
  • POST /opening/submit_opening_drill - Called when each drill is completed
    • Logs moves played, opening position, and links to session

Implementation Details

API Layer (src/api/opening/)

// New API functions with proper TypeScript interfaces
export const selectOpeningDrills = async (request: SelectOpeningDrillsRequest)
export const submitOpeningDrill = async (request: SubmitOpeningDrillRequest)

Frontend Integration

  • Modified OpeningSelectionModal to call backend when "Start Drilling" is clicked
  • Updated useOpeningDrillController to submit drill data on completion
  • Added session ID tracking throughout the drill flow

Data Flow

  1. User configures openings → selectOpeningDrills API → receives session ID
  2. User completes drill → submitOpeningDrill API with moves and session ID
  3. Process repeats for each drill in the session

Key Features

  • Graceful Degradation: Drill flow continues even if backend calls fail
  • Session Tracking: Session ID maintained throughout entire drill session
  • Type Safety: Full TypeScript support with proper request/response interfaces
  • Minimal Changes: Surgical modifications that preserve existing functionality

Example API Requests

Starting a drill session:

POST /opening/select_opening_drills
{
  "openings": [
    { "opening_fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", "side_played": "white" }
  ],
  "opponent": "maia_kdd_1500",
  "num_moves": 10,
  "num_drills": 5
}

Submitting completed drill:

POST /opening/submit_opening_drill
{
  "session_id": "session_12345",
  "opening_fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
  "side_played": "white", 
  "moves_played_uci": ["e2e4", "e7e5", "g1f3", "b8c6"]
}

Fixes #103.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: node /home/REDACTED/work/maia-platform-frontend/maia-platform-frontend/node_modules/.bin/next build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

kevinjosethomas and others added 2 commits July 18, 2025 12:41
Cleanup, tests, bug fixes, and optimizations
@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
maia-platform-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 8:21pm

Co-authored-by: kevinjosethomas <46242684+kevinjosethomas@users.noreply.github.com>
Copilot AI changed the title [WIP] Add backend logging to opening page Add backend logging for opening drill sessions Jul 18, 2025
Copilot AI requested a review from kevinjosethomas July 18, 2025 20:24
@kevinjosethomas kevinjosethomas changed the base branch from main to dev July 19, 2025 00:44
@kevinjosethomas kevinjosethomas marked this pull request as ready for review July 19, 2025 00:44
@kevinjosethomas kevinjosethomas merged commit 9f4a893 into dev Jul 19, 2025
11 checks passed
@kevinjosethomas kevinjosethomas deleted the copilot/fix-103 branch July 19, 2025 16:45
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.

Add backend logging to opening page

2 participants