Commit Graph

3 Commits

Author SHA1 Message Date
39aea34026 feat: Integrate Playwright into docker-compose
Some checks failed
Magnitude Tests / test (push) Failing after 2m2s
Adds Playwright service to docker-compose.yml for easier test execution
and better integration with existing database services.

## Changes

- Add `playwright` service to docker-compose.yml:
  - Uses official Playwright image (mcr.microsoft.com/playwright:v1.49.1-noble)
  - Runs as non-root user (pwuser) for security
  - Uses host networking to access dev server on localhost:3000
  - Loads environment variables from .env
  - Uses `profiles: [test]` to keep it optional
  - Mounts node_modules volume to prevent permission issues

- Update documentation in AGENTS.md:
  - Replace standalone Docker commands with docker-compose usage
  - Document two usage patterns: `docker compose run` and `--profile test`
  - Explain benefits of integrated setup

## Usage

```bash
# Start database services
docker compose up -d

# Start dev server
pnpm dev

# Run Playwright tests in Docker
docker compose run --rm playwright
```

Or with profiles:

```bash
# Run tests one-off
docker compose --profile test run --rm playwright
```

## Benefits

- Unified infrastructure setup (database + tests)
- No need for separate Dockerfile build step
- Easier for new developers to run tests
- Consistent with existing docker-compose workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 13:52:05 +00:00
a520814771 feat: Implement node deletion with shared modal and fix SurrealDB RecordId handling
Implements complete node deletion functionality for both galaxy view and debug panel:

**Core Changes:**
- Created shared DeleteNodeModal component used by both ThoughtGalaxy and UserMenu
- Modal provides consistent UX with proper confirmation messaging
- Deletion follows write-through cache pattern: ATproto first, then SurrealDB

**SurrealDB RecordId Fixes:**
- Fixed SELECT query to use type::thing($table, $recordId) for UUID-based RecordIds
- Fixed DELETE query to use type::thing() instead of db.delete() to handle dashes in UUIDs
- Without type::thing(), SurrealDB interprets dashes as subtraction operators

**Testing & Documentation:**
- Added comprehensive Magnitude tests for delete functionality (galaxy view and debug panel)
- Updated CLAUDE.md with complete testing workflow documentation
- Added pre-commit checklist requiring database verification and test execution
- Documented PlaywrightMCP manual testing process before Magnitude test writing

**Database Setup:**
- Configured docker-compose.yml to use environment variables for credentials
- Updated namespace/database to match .env configuration (ponderants/main)

**File Changes:**
- app/api/nodes/[id]/route.ts: Fixed RecordId query patterns (SELECT and DELETE)
- components/DeleteNodeModal.tsx: New shared modal component
- components/ThoughtGalaxy.tsx: Uses shared DeleteNodeModal
- components/UserMenu.tsx: Replaced browser confirm() with shared DeleteNodeModal
- tests/magnitude/03-delete-node.mag.ts: Added debug panel delete test
- AGENTS.md: Added testing workflow and pre-commit checklist documentation
- docker-compose.yml: Environment variable configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-10 13:25:01 +00:00
93ebb0948c feat: Complete Step 3 & 4 - OAuth + SurrealDB schema
Step 3: ATproto OAuth + SurrealDB JWT
- Implement database-backed OAuth state storage (lib/auth/oauth-state.ts)
- Add session helpers for JWT decoding (lib/auth/session.ts)
- Fix OAuth callback to properly handle state retrieval
- Create /chat page displaying authenticated user handle
- Configure headless mode for Magnitude testing

Step 4: SurrealDB Schema & Permissions
- Define JWT-based access control (HS512 algorithm)
- Create user table with DID-based identity
- Create node table with row-level security (users can only access their own data)
- Create links_to relation table for graph edges
- Define vector search index (1536 dimensions for gemini-embedding-001)
- Add Docker Compose for local SurrealDB development

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 23:51:19 +00:00