Skip to content

Commit cadc593

Browse files
Hubert Pyskloclaude
authored andcommitted
Document the Service enum registration step in AGENTS.md
Add it as step 5 in the "Adding a New Service" section so future service authors don't forget to widen the Pydantic enum — skipping it leaves initEnv returning a validation error even after the router is mounted and templates are seeded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f5382b8 commit cadc593

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

AGENTS.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,23 @@ myservice_router = Router(myservice_routes)
410410
app.mount("/api/env/{env_id}/services/myservice", myservice_router)
411411
```
412412

413-
**5. Write a seed script** in `backend/utils/seed_myservice_template.py` that:
413+
**5. Register the service with the platform API** in `src/platform/api/models.py`.
414+
Add it to the `Service` enum so `initEnv` (and other platform endpoints that take
415+
a `templateService`) will accept the new value:
416+
417+
```python
418+
class Service(str, Enum):
419+
slack = "slack"
420+
linear = "linear"
421+
calendar = "calendar"
422+
box = "box"
423+
myservice = "myservice" # ← add this
424+
```
425+
426+
If you skip this step, `POST /api/platform/initEnv` returns a Pydantic enum
427+
validation error even though the template rows exist and the router is mounted.
428+
429+
**6. Write a seed script** in `backend/utils/seed_myservice_template.py` that:
414430
- Creates the PostgreSQL schema (e.g. `myservice_default`)
415431
- Uses `Base.metadata.create_all()` to create tables
416432
- Inserts seed data from a JSON file
@@ -419,10 +435,10 @@ app.mount("/api/env/{env_id}/services/myservice", myservice_router)
419435
Follow `seed_slack_template.py` as a reference — it shows the full pattern including
420436
schema creation, table ordering, and template registration.
421437

422-
**6. Add seed data** in `examples/myservice/seeds/myservice_default.json` and copy to
438+
**7. Add seed data** in `examples/myservice/seeds/myservice_default.json` and copy to
423439
`backend/seeds/myservice/` for Docker builds.
424440

425-
**7. Register the seed script** in the Docker startup command in `ops/docker-compose.yml`:
441+
**8. Register the seed script** in the Docker startup command in `ops/docker-compose.yml`:
426442

427443
```yaml
428444
command: >

0 commit comments

Comments
 (0)