Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Important: Read PROJECT_CONTEXT.md First
## Important: Read These Documents First

**Before working on this codebase, read [PROJECT_CONTEXT.md](PROJECT_CONTEXT.md)** for:
- Project overview and directory structure
- Local development setup (Docker and non-Docker)
- Service URLs, ports, and deployment information
- CI/CD pipeline and infrastructure requirements
**Before working on this codebase, read these documents in order:**

This file (CLAUDE.md) contains **additional** architecture patterns, coding conventions, and development practices specific to this codebase that are not covered in PROJECT_CONTEXT.md.
1. **[PROJECT_CONTEXT.md](PROJECT_CONTEXT.md)** - Project overview, setup, deployment
- Directory structure and service architecture
- Local development setup (Docker and non-Docker)
- Service URLs, ports, and deployment information
- CI/CD pipeline and infrastructure requirements

2. **[docs/CLI_OBJECT_LIFECYCLE.md](docs/CLI_OBJECT_LIFECYCLE.md)** - **CRITICAL for CLI work**
- How objects (configs, rows, notifications) are created, loaded, and saved
- State vs Manifest distinction
- Registry.Set() rules (ONLY for new objects!)
- Mapper timing and execution order
- Pull/Push operation flows
- Common pitfalls and how to avoid them

**When to read CLI_OBJECT_LIFECYCLE.md:**
- Working on mappers (`internal/pkg/mapper/*/`)
- Working on state management (`internal/pkg/state/`)
- Adding new object types (configs, rows, notifications, etc.)
- Debugging "already exists" errors
- Debugging validation errors during pull/push

This file (CLAUDE.md) contains **additional** architecture patterns, coding conventions, and development practices specific to this codebase that are not covered in the documents above.

## Architecture Patterns

Expand Down Expand Up @@ -76,14 +93,23 @@ task tests

### Testing (Run Specific Tests)

**Run specific test** (recommended approach for local development):
**CRITICAL: E2E tests MUST be run in Docker Compose dev container**

E2E tests require a complete environment with etcd, dependencies, and proper tooling. Always run them inside the Docker Compose dev container:

```bash
# Start dev container
docker compose run --rm -u "$UID:$GID" --service-ports dev bash

# Inside container, run E2E tests
task e2e -- test/cli/path/to/test
```

**Run specific unit test** (can run locally or in Docker):
```bash
# Run specific test by name
go test -race -v ./path/to/pkg... -run TestName
go test -race -v ./path/to/pkg... -run TestName/SubTest

# Run specific E2E test
task e2e -- test/cli/path/to/test
```

**Verbose testing** (shows HTTP requests, ENVs, etcd operations):
Expand Down
12 changes: 9 additions & 3 deletions PROJECT_CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ The project uses ETCD for distributed storage and synchronization, with a custom

For Docker-based development, see [Development Guide](docs/development.md).

**Important**: E2E tests MUST be run inside the Docker Compose dev container:
```bash
docker compose run --rm -u "$UID:$GID" --service-ports dev bash
# Then run: task e2e -- test/cli/path/to/test
```

### Local Machine Setup
For development directly on your local machine without Docker, see [Local Development Guide](docs/local_development.md).

Expand Down Expand Up @@ -80,9 +86,9 @@ docker-compose up -d
## CI/CD Pipeline

### Testing
- Unit tests: `task tests`
- Integration tests: `task tests`
- E2E tests: `task tests-cli`
- Unit tests: `task tests` (can run locally or in Docker)
- Integration tests: `task tests` (can run locally or in Docker)
- E2E tests: `task tests-cli` or `task e2e -- test/cli/path/to/test` (MUST run in Docker Compose dev container)

### Build Process
1. Code validation
Expand Down
Loading
Loading