Skip to content

Commit c4663c1

Browse files
Matovidloclaude
andcommitted
docs: add comprehensive CLI object lifecycle documentation
Add docs/CLI_OBJECT_LIFECYCLE.md explaining the full lifecycle of CLI objects (branches, configs, rows, notifications) including: - State vs Manifest distinction and Registry.Set() rules - Mapper execution timing and ordering - Pull and Push operation flows with detailed steps - Common pitfalls (double-Set, wrong mapper event, etc.) Update CLAUDE.md, PROJECT_CONTEXT.md, CLI_CONTEXT.md to reference the new doc and add notification subscription context. Add notification-specific CLI docs and update e2e_tests.md with notification test patterns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a9eee47 commit c4663c1

5 files changed

Lines changed: 927 additions & 14 deletions

File tree

CLAUDE.md

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,32 @@
22

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

5-
## Important: Read PROJECT_CONTEXT.md First
5+
## Important: Read These Documents First
66

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:**
128

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.
1431

1532
## Architecture Patterns
1633

@@ -76,14 +93,23 @@ task tests
7693

7794
### Testing (Run Specific Tests)
7895

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):
80109
```bash
81110
# Run specific test by name
82111
go test -race -v ./path/to/pkg... -run TestName
83112
go test -race -v ./path/to/pkg... -run TestName/SubTest
84-
85-
# Run specific E2E test
86-
task e2e -- test/cli/path/to/test
87113
```
88114

89115
**Verbose testing** (shows HTTP requests, ENVs, etcd operations):

PROJECT_CONTEXT.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ The project uses ETCD for distributed storage and synchronization, with a custom
4141

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

44+
**Important**: E2E tests MUST be run inside the Docker Compose dev container:
45+
```bash
46+
docker compose run --rm -u "$UID:$GID" --service-ports dev bash
47+
# Then run: task e2e -- test/cli/path/to/test
48+
```
49+
4450
### Local Machine Setup
4551
For development directly on your local machine without Docker, see [Local Development Guide](docs/local_development.md).
4652

@@ -80,9 +86,9 @@ docker-compose up -d
8086
## CI/CD Pipeline
8187

8288
### Testing
83-
- Unit tests: `task tests`
84-
- Integration tests: `task tests`
85-
- E2E tests: `task tests-cli`
89+
- Unit tests: `task tests` (can run locally or in Docker)
90+
- Integration tests: `task tests` (can run locally or in Docker)
91+
- E2E tests: `task tests-cli` or `task e2e -- test/cli/path/to/test` (MUST run in Docker Compose dev container)
8692

8793
### Build Process
8894
1. Code validation

0 commit comments

Comments
 (0)