A member whose account has not accepted the terms in force now gets one dialog on the action they attempted instead of a dead-end refusal. The client handler is the single TermsGate, wired into every Http POST helper so the four optimistic controllers cannot swallow the gate into an error flash, and the original request is replayed once the acceptance is recorded. Reading the site and deleting an account stay unblocked. apple.md is the source brief the compliance research documents reference. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
17 lines
1.8 KiB
Markdown
17 lines
1.8 KiB
Markdown
---
|
|
description: Add a background BaseService - the service class with config_fields and run_once, registration in main.py, init_db columns if it stores state, and docs.
|
|
argument-hint: <what the service should do>
|
|
allowed-tools: Read, Grep, Edit, Write, Bash(python *)
|
|
---
|
|
Add a background service: **$ARGUMENTS**
|
|
|
|
Mirror an existing service - read `devplacepy/services/base.py` (BaseService) and `NewsService` first.
|
|
|
|
1. Create `devplacepy/services/<name>_service.py` extending `BaseService`: declare `config_fields` (the `ConfigField` specs are rendered on `/admin/services`), and implement `async def run_once(self) -> None` with extensive INFO and DEBUG logging and specific (not bare) exception handling. Full type hints; no comments or docstrings.
|
|
2. If it stores state, ensure the table columns and indexes in `init_db()` (dataset auto-syncs the schema; `CREATE INDEX IF NOT EXISTS`; if the table is soft-deletable, write born-live `deleted_at`/`deleted_by` on insert and add the index).
|
|
3. Register it in `main.py` startup: `service_manager.register(YourService())`, under the same `DEVPLACE_DISABLE_SERVICES` guard as the others. It then auto-appears on `/admin/services`.
|
|
4. If it calls an LLM, default its endpoint to `config.INTERNAL_GATEWAY_URL` and authenticate with the internal gateway key, like the other AI consumers.
|
|
5. Emit audit events via `record_system` for any state change it makes.
|
|
6. Document it in `devplacepy/services/CLAUDE.md` (Background services base machinery section, or the service's own nested `CLAUDE.md` if it has one) and in `README.md` if user-visible.
|
|
7. Validate the touched files with the per-language checks (`python -m py_compile` + `pyflakes` for Python, `node --check` for JS, brace balance for CSS, tag and `{% %}` balance for templates) and `python -c "from devplacepy.main import app"`.
|