# TASK ARCHIVE: settings-ui-and-runtime-logs

## METADATA

| Поле | Значение |
|------|----------|
| **Task ID** | `settings-ui-and-runtime-logs` |
| **Complexity** | Level 4 |
| **VAN** | 2026-06-12 |
| **PLAN** | 2026-06-12 |
| **BUILD complete** | 2026-06-12 |
| **REFLECT** | 2026-06-12 |
| **ARCHIVE** | 2026-06-12 |

---

## SUMMARY

Два связанных улучшения control plane:

1. **Tenant settings UI** — единый модуль `/tenant-settings` (BIRD, ревизии, custom KV); `/settings` только для браузера.
2. **Runtime logs** — API и UI для файлов `*.log` от sidecar `stack-runtime-logs`: list, tail, sync cleanup, audit в БД; FS только на `evobgp-all` с volume.

---

## REQUIREMENTS (resolved)

| # | Решение |
|---|---------|
| `/settings` vs tenant | Раздельные модули |
| Cleanup | Синхронный HTTP, не jobs |
| FS API | Только `evobgp-all` + mount |
| Audit | `runtime_log_cleanup_audit` в postgres/sqlite |

---

## IMPLEMENTATION

### Backend

| Компонент | Путь |
|-----------|------|
| OpenAPI tag `RuntimeLogs` | `docs/openapi.yaml` |
| Миграция 000026 | `migrations/postgres/`, `migrations/sqlite/` |
| Store | `internal/store/runtime_logs.go`, `memory_runtime_logs.go`, `postgres_runtime_logs.go` |
| FS layer | `internal/runtimelogs/` (config, safe, list, tail, cleanup) |
| HTTP | `internal/httpapi/routes_runtime_logs.go`, `server.go` wiring |
| Config/docs | `internal/config/config.go`, `docs/access.md` |

**API paths:** `GET/DELETE /v1/runtime-logs/files`, `GET .../files/{filename}`, `GET /v1/runtime-logs/cleanup-audit`

### Deploy

| Файл | Изменение |
|------|-----------|
| `deploy/compose/stack.microvps-full.yaml` | env + mount на `evobgp-all`, `EVOBGP_RUNTIME_LOGS_HOST_DIR` |
| `deploy/compose/docker-compose.microvps-full.yaml` | overlay mount/env |
| `deploy/compose/docker-compose.production.example.yaml` | полный prod example для `/opt/evobgp` |
| `deploy/compose/.env.production.example` | host dir для runtime-logs |
| `docs/quickstart.md` | секция runtime logs |
| `.gitignore` | `deploy/compose/runtime-logs/` |

### Web UI

| Область | Путь |
|---------|------|
| Tenant settings | `web/src/routes/tenant-settings/`, `web/src/lib/components/tenant-settings/*` |
| Nav «Параметры» | `web/src/lib/ui/app/layout/nav.ts` |
| Operations | убран tab `system`, редирект `?tab=system` |
| Network | `NetworkBirdSettingsSummaryCard.svelte` |
| Runtime logs UI | `web/src/lib/runtime-logs/runtime-logs-api.ts`, `RuntimeLogsTab.svelte` |
| Monitoring | `?tab=runtime-logs`, URL sync |

**Удалено:** `OperationsSystemSettingsTab.svelte`, `BirdSettingsForm.svelte`

### Docs (Phase 7)

- `docs/api.md` — RuntimeLogs
- `docs/manual.md` — Web UI tenant-settings + monitoring runtime logs

---

## TESTING

| Gate | Результат |
|------|-----------|
| `go test ./... -count=1` | pass |
| `scripts/lint-go.ps1` | pass |
| `go test ./internal/httpapi/... -run RuntimeLogs` | pass |
| `go test ./internal/runtimelogs/...` | pass |
| `npx @redocly/cli lint docs/openapi.yaml` | pass |
| `npm run check && npm run lint` | pass |
| E2E manual prod | **не выполнен** (чеклист в tasks Phase 7) |

---

## LESSONS LEARNED

См. [reflection-settings-ui-and-runtime-logs.md](../reflection/reflection-settings-ui-and-runtime-logs.md).

Кратко: deploy mount обязателен для FS API; audit не зависит от FS; production compose example критичен; phased BUILD + creative снижают риск откатов.

---

## POST-DEPLOY (оператор)

1. Обновить `/opt/evobgp/docker-compose.yaml` (или скопировать `docker-compose.production.example.yaml`).
2. `mkdir -p /opt/evobgp/runtime-logs`
3. `docker compose pull evobgp-all evobgp-web && docker compose up -d evobgp-all`
4. E2E: list → tail → truncate → audit row; `/tenant-settings` PATCH.

---

## REFERENCES

| Документ | Путь |
|----------|------|
| Reflection | `memory-bank/reflection/reflection-settings-ui-and-runtime-logs.md` |
| CP-1 Tenant UI | `memory-bank/creative/creative-tenant-settings-ui.md` |
| CP-2 Runtime logs UI | `memory-bank/creative/creative-runtime-logs-ui.md` |
| CP-3 Cleanup | `memory-bank/creative/creative-runtime-logs-cleanup.md` |
| CP-4 Path safety | `memory-bank/creative/creative-runtime-logs-path-safety.md` |
| HTTP contract | `docs/openapi.yaml` (tag RuntimeLogs) |
| Access / env | `docs/access.md` |
