Skip to content

Conversation

@marcodejongh
Copy link
Owner

  • Add user_hold_classifications database table to store user ratings for individual holds
  • Create hold classification wizard component with:
    • Zoomed-in view of each hold on the board
    • Hold type selector (jug, edge, sloper, pinch, crimp, pocket, sidepull, undercling)
    • 5-star difficulty rating for how hard each hold is to grip
    • Navigation controls to move through all holds
    • Progress tracking and completion state
  • Add API endpoints (GET/POST) at /api/internal/hold-classifications
  • Integrate wizard into header menu (both desktop and mobile) for logged-in users
  • Feature can be used to build personalized climb recommendations later

claude added 2 commits January 3, 2026 11:08
- Add user_hold_classifications database table to store user ratings for individual holds
- Create hold classification wizard component with:
  - Zoomed-in view of each hold on the board
  - Hold type selector (jug, edge, sloper, pinch, crimp, pocket, sidepull, undercling)
  - 5-star difficulty rating for how hard each hold is to grip
  - Navigation controls to move through all holds
  - Progress tracking and completion state
- Add API endpoints (GET/POST) at /api/internal/hold-classifications
- Integrate wizard into header menu (both desktop and mobile) for logged-in users
- Feature can be used to build personalized climb recommendations later
@vercel
Copy link

vercel bot commented Jan 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
boardsesh Building Building Preview, Comment Jan 3, 2026 0:23am

@claude
Copy link

claude bot commented Jan 3, 2026

Claude Review

⚠️ Needs attention - Missing unique constraint enforcement, input validation gaps, CSS uses hardcoded colors instead of design tokens.

Issues

Database Schema

  • packages/db/src/schema/app/hold-classifications.ts:62-68 - The "unique" index user_hold_classifications_unique_idx is created as a regular btree index, not a unique constraint. This means duplicate classifications per user/hold can be inserted. Should use uniqueIndex() instead of index().

API Route

  • packages/web/app/api/internal/hold-classifications/route.ts:41-42 - No validation that layoutId and sizeId are valid integers before parseInt(). Passing non-numeric strings will result in NaN.
  • packages/web/app/api/internal/hold-classifications/route.ts:82 - No validation on holdType value - should validate against the enum values to prevent invalid data insertion.
  • packages/web/app/api/internal/hold-classifications/route.ts:82 - No validation on difficultyRating range (should be 1-5 per UI).

Component Issues

  • packages/web/app/components/hold-classification/hold-classification-wizard.tsx:119 - useEffect has missing dependencies: loadClassifications is called but not in the dependency array. This could cause stale closure issues.

CSS

  • packages/web/app/components/hold-classification/hold-classification-wizard.module.css - Uses hardcoded colors (#e5e7eb, #6b7280, #f9fafb, #06b6d4, #10b981, etc.) instead of design tokens per CLAUDE.md guidelines.

Migration Scope

  • packages/db/drizzle/0025_lovely_omega_sentinel.sql - This migration creates many tables beyond user_hold_classifications (board_attempts, board_climbs, board_circuits, etc.). Verify this is intentional and not unintentionally bundled from other uncommitted schema changes.

Tests

  • No tests for the new API endpoints or component. Consider adding tests for the classification save/load functionality.

- Change uniqueClassification index to uniqueIndex to enforce unique constraint
- Add comprehensive input validation for API endpoints:
  - Validate layoutId/sizeId are valid integers
  - Validate holdType against allowed enum values
  - Validate difficultyRating is between 1-5
- Fix useEffect missing dependency by making loadClassifications a useCallback
- Replace hardcoded CSS colors with CSS custom properties (design tokens)
- Add --semantic-selected and --color-success CSS variables
@claude
Copy link

claude bot commented Jan 3, 2026

Claude Review

⚠️ Needs attention - Migration contains unrelated schema changes; potential race condition in save operations; missing tests for new feature.

Issues

  1. Migration scope creep (packages/db/drizzle/0025_lovely_omega_sentinel.sql): The migration creates many tables unrelated to hold classifications (board_attempts, board_beta_links, board_circuits, etc.) and alters playlist tables. These changes should be separate migrations for clarity and safe rollback.

  2. Race condition in classification save (hold-classification-wizard.tsx:193-218): handleHoldTypeSelect and handleRatingChange update state and call saveClassification without awaiting. Rapid user interactions could cause stale reads of classifications map. Consider debouncing or using functional state updates.

  3. API validation: updatedAt type mismatch (route.ts:193-195): Schema expects timestamp column but code passes ISO string. The createdAt/updatedAt columns use mode: string which should work, but the insert at line 225 also manually sets these - verify timestamps are not duplicated or conflicting with defaultNow().

  4. Missing tests: No tests for the new API endpoints or wizard component. Critical paths like classification save/update, validation edge cases, and concurrent updates should be tested.

  5. Unused type export (types.ts:98-102): HoldClassificationState interface is defined but never used.

  6. Error handling UX (hold-classification-wizard.tsx:174-176): Save failures show toast but do not revert optimistic state update, leaving UI and server state potentially out of sync.

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.

3 participants