|
2 | 2 |
|
3 | 3 | This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
4 | 4 |
|
5 | | -## Important: Read PROJECT_CONTEXT.md First |
| 5 | +## Important: Read These Documents First |
6 | 6 |
|
7 | | -**Before working on this codebase, read [PROJECT_CONTEXT.md](PROJECT_CONTEXT.md)** for: |
8 | | -- Project overview and directory structure |
9 | | -- Local development setup (Docker and non-Docker) |
10 | | -- Service URLs, ports, and deployment information |
11 | | -- CI/CD pipeline and infrastructure requirements |
| 7 | +**Before working on this codebase, read these documents in order:** |
12 | 8 |
|
13 | | -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. |
| 9 | +1. **[PROJECT_CONTEXT.md](PROJECT_CONTEXT.md)** - Project overview, setup, deployment |
| 10 | + - Directory structure and service architecture |
| 11 | + - Local development setup (Docker and non-Docker) |
| 12 | + - Service URLs, ports, and deployment information |
| 13 | + - CI/CD pipeline and infrastructure requirements |
| 14 | + |
| 15 | +2. **[docs/CLI_OBJECT_LIFECYCLE.md](docs/CLI_OBJECT_LIFECYCLE.md)** - **CRITICAL for CLI work** |
| 16 | + - How objects (configs, rows, notifications) are created, loaded, and saved |
| 17 | + - State vs Manifest distinction |
| 18 | + - Registry.Set() rules (ONLY for new objects!) |
| 19 | + - Mapper timing and execution order |
| 20 | + - Pull/Push operation flows |
| 21 | + - Common pitfalls and how to avoid them |
| 22 | + |
| 23 | +**When to read CLI_OBJECT_LIFECYCLE.md:** |
| 24 | +- Working on mappers (`internal/pkg/mapper/*/`) |
| 25 | +- Working on state management (`internal/pkg/state/`) |
| 26 | +- Adding new object types (configs, rows, notifications, etc.) |
| 27 | +- Debugging "already exists" errors |
| 28 | +- Debugging validation errors during pull/push |
| 29 | + |
| 30 | +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. |
14 | 31 |
|
15 | 32 | ## Architecture Patterns |
16 | 33 |
|
@@ -76,14 +93,23 @@ task tests |
76 | 93 |
|
77 | 94 | ### Testing (Run Specific Tests) |
78 | 95 |
|
79 | | -**Run specific test** (recommended approach for local development): |
| 96 | +**CRITICAL: E2E tests MUST be run in Docker Compose dev container** |
| 97 | + |
| 98 | +E2E tests require a complete environment with etcd, dependencies, and proper tooling. Always run them inside the Docker Compose dev container: |
| 99 | + |
| 100 | +```bash |
| 101 | +# Start dev container |
| 102 | +docker compose run --rm -u "$UID:$GID" --service-ports dev bash |
| 103 | + |
| 104 | +# Inside container, run E2E tests |
| 105 | +task e2e -- test/cli/path/to/test |
| 106 | +``` |
| 107 | + |
| 108 | +**Run specific unit test** (can run locally or in Docker): |
80 | 109 | ```bash |
81 | 110 | # Run specific test by name |
82 | 111 | go test -race -v ./path/to/pkg... -run TestName |
83 | 112 | go test -race -v ./path/to/pkg... -run TestName/SubTest |
84 | | - |
85 | | -# Run specific E2E test |
86 | | -task e2e -- test/cli/path/to/test |
87 | 113 | ``` |
88 | 114 |
|
89 | 115 | **Verbose testing** (shows HTTP requests, ENVs, etcd operations): |
|
0 commit comments