DOCS: architecture-next update + opus frontend/instance/review prompts
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
# Prompt for Opus — Code Review v1.2.0
|
||||
|
||||
Проект: Nubes Autotest (Flask + vanilla JS + PostgreSQL)
|
||||
План: `/home/naeel/nubes/autotest/DOCS/opus-plan-2026-07-31.md`
|
||||
Вопросы/ответы: `/home/naeel/nubes/autotest/DOCS/opus-questions-2026-07-31.md`
|
||||
|
||||
## Что сделано
|
||||
|
||||
Реализованы Фазы 1-3 + начало Фазы 4. Модальный редактор сценариев НЕ сделан.
|
||||
|
||||
## Изменённые/новые файлы (для ревью)
|
||||
|
||||
### Новые файлы:
|
||||
|
||||
**1. `/home/naeel/nubes/autotest/app-autotest/site/api/utils.py`**
|
||||
- `find_uid(resp)` — поиск UUID по верхнему уровню + вложенным dict
|
||||
- `uid_from_location(loc)` — UUID из Location-заголовка
|
||||
- Заменяет 2 разные реализации из api_test.py + scenario.py
|
||||
|
||||
**2. `/home/naeel/nubes/autotest/app-autotest/site/operations/executor.py`**
|
||||
- `execute_operation(client, service_id, operation, instance_uid, params, svc_op_id=None, display_name=None)`
|
||||
- Делает всё до /run: POST /instances → POST /instanceOperations → send_params_terraform → /run
|
||||
- Ветвится по operation=="create" (свой payload, без svcOperationId)
|
||||
- Возвращает dict {ok, error, failed_step, instance_uid, op_uid, display_name}
|
||||
- НЕ поллит
|
||||
|
||||
**3. `/home/naeel/nubes/autotest/app-autotest/site/operations/poll.py`**
|
||||
- `poll_until_done(client, op_uid, timeout=1800)` → {status, is_successful, error_log, stages, duration, svc}
|
||||
- Общий цикл для async (_finish_op) и sync (run_scenario)
|
||||
|
||||
**4. `/home/naeel/nubes/autotest/app-autotest/site/static/js/params-render.js`**
|
||||
- `renderParamRow(p, allInst)` — рендер параметра
|
||||
- `renderMapFixedRow(p, dfl)` — рендер map-fixed с вложенными полями
|
||||
- `collectParams(containerSelector)` — сбор параметров из DOM
|
||||
- Вынесено из operations.js, используется обоими (ручной + сценарный)
|
||||
|
||||
### Изменённые файлы:
|
||||
|
||||
**5. `/home/naeel/nubes/autotest/app-autotest/site/operations/scenario.py`**
|
||||
- Удалены _find_uid, _uid_from_location
|
||||
- Добавлен import из executor, poll
|
||||
- `_resolve_instance_uid(step, bindings, instance_map)` — приоритет: uid > ref > service_id
|
||||
- `_update_bindings(scenario_run_id, bindings)` — персист в scenario_runs.instance_bindings
|
||||
- `run_scenario` — create/non-create через executor, поллинг через poll_until_done, output→bindings
|
||||
|
||||
**6. `/home/naeel/nubes/autotest/app-autotest/site/routes/api_test.py`**
|
||||
- Удалены _find_uid, _uid_from_location (импорт из api.utils)
|
||||
- CREATE и non-CREATE флоу заменены на execute_operation
|
||||
- _finish_op заменён на poll_until_done
|
||||
- CMDB delete оставлен как предпроверка (не через executor)
|
||||
|
||||
**7. `/home/naeel/nubes/autotest/app-autotest/site/routes/api_scenario_defs.py`**
|
||||
- `_validate_steps` расширен: output (уникальность, только create), instance_ref (ссылка на output), instance_uid
|
||||
- Старый формат (без новых ключей) проходит валидацию (обратная совместимость)
|
||||
|
||||
**8. `/home/naeel/nubes/autotest/app-autotest/site/db/init_db.py`**
|
||||
- Startup cleanup: `UPDATE scenario_runs SET status='TIMEOUT' WHERE status='RUNNING' AND created_at < NOW() - INTERVAL '1 hour'`
|
||||
|
||||
**9. `/home/naeel/nubes/autotest/app-autotest/site/static/js/operations.js`**
|
||||
- Удалены renderParamRow, renderMapFixedRow, collectParams (теперь в params-render.js)
|
||||
|
||||
**10. `/home/naeel/nubes/autotest/app-autotest/site/templates/index.html`**
|
||||
- Добавлен `<script src="js/params-render.js">` перед instances.js
|
||||
|
||||
**11. `/home/naeel/nubes/autotest/app-autotest/site/app.py`**
|
||||
- VERSION = "1.2.0"
|
||||
|
||||
## Вопросы для ревью
|
||||
|
||||
1. **executor.py**: корректно ли обрабатываются все ошибки? Не потерялся ли tracker_add (в старом коде был ДО params/run, в executor его нет — он вызывается в api_test.py после executor)?
|
||||
2. **scenario.py**: правильно ли резолвится instance_uid? Не сломается ли старый dummy_test без output/instance_ref?
|
||||
3. **api_test.py**: CMDB delete остался как предпроверка — ок ли это?
|
||||
4. **init_db.py**: startup cleanup — не затрёт ли легитимные долгоиграющие сценарии?
|
||||
5. **params-render.js**: `collectParams` теперь с параметром `containerSelector` — не сломает ли это существующие вызовы без аргумента?
|
||||
6. Общая архитектура: все ли зависимости корректны? Нет ли циклических импортов?
|
||||
Reference in New Issue
Block a user