From 2ab4d48b14bde2a091a257da1e938846eca82da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 4 May 2026 06:22:16 +0400 Subject: [PATCH] =?UTF-8?q?chore:=20add=20all=20untracked=20files=20from?= =?UTF-8?q?=20VM=20=E2=80=94=20scripts,=20test-results,=20LLM=20batch,=20d?= =?UTF-8?q?ocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AUDIT_CONSOLE_FUNCTIONS.md | 539 ++++++++ FIXES_APPLIED.md | 183 +++ LLM/explain-archive-batch/README.md | 21 + LLM/explain-archive-batch/go-hello.md | 25 + LLM/explain-archive-batch/go-hello.zip | Bin 0 -> 485 bytes LLM/explain-archive-batch/hello-python.zip | Bin 0 -> 222 bytes LLM/explain-archive-batch/php-hello.md | 18 + LLM/explain-archive-batch/php-hello.zip | Bin 0 -> 319 bytes LLM/explain-archive-batch/python-cart.md | 20 + LLM/explain-archive-batch/python-cart.zip | Bin 0 -> 1078 bytes LLM/explain-archive-batch/ruby-hello.md | 16 + LLM/explain-archive-batch/ruby-hello.zip | Bin 0 -> 240 bytes cleanup_test_namespaces.sh | 62 + doc/refactor-ui-2026-04-30.md | 71 ++ doc/structure/ask_sonnet_0105_0918 | 158 +++ doc/structure/repo_index.final.json | 218 ++++ .../2026-05-01-golang-removal-plan.md | 305 +++++ scripts/bench_heavy.py | 1106 +++++++++++++++++ scripts/smoke_live_multiuser.sh | 134 ++ scripts/smoke_user_journeys.sh | 119 ++ scripts/test59.sh | 21 + scripts/test_layer1.sh | 158 +++ scripts/test_multitenant_ns.sh | 214 ++++ scripts/test_simple_function.sh | 812 ++++++++++++ scripts/test_ui_user_flows.sh | 326 +++++ scripts/tests_v2.sh | 783 ++++++++++++ test-results/2026-05-03_15-32-11.log | 389 ++++++ test-results/2026-05-03_15-47-34.log | 384 ++++++ .../2026-05-03_16-02-40_remaining.log | 21 + test-results/2026-05-03_16-47.log | 379 ++++++ test-results/2026-05-03_17-05-22.log | 566 +++++++++ test-results/2026-05-03_17-05.log | 566 +++++++++ test-results/2026-05-03_18-08-19.log | 287 +++++ test-results/2026-05-03_18-25-27.log | 220 ++++ 34 files changed, 8121 insertions(+) create mode 100644 AUDIT_CONSOLE_FUNCTIONS.md create mode 100644 FIXES_APPLIED.md create mode 100644 LLM/explain-archive-batch/README.md create mode 100644 LLM/explain-archive-batch/go-hello.md create mode 100644 LLM/explain-archive-batch/go-hello.zip create mode 100644 LLM/explain-archive-batch/hello-python.zip create mode 100644 LLM/explain-archive-batch/php-hello.md create mode 100644 LLM/explain-archive-batch/php-hello.zip create mode 100644 LLM/explain-archive-batch/python-cart.md create mode 100644 LLM/explain-archive-batch/python-cart.zip create mode 100644 LLM/explain-archive-batch/ruby-hello.md create mode 100644 LLM/explain-archive-batch/ruby-hello.zip create mode 100755 cleanup_test_namespaces.sh create mode 100644 doc/refactor-ui-2026-04-30.md create mode 100644 doc/structure/ask_sonnet_0105_0918 create mode 100644 doc/structure/repo_index.final.json create mode 100644 doc/thinking/2026-05-01-golang-removal-plan.md create mode 100644 scripts/bench_heavy.py create mode 100755 scripts/smoke_live_multiuser.sh create mode 100755 scripts/smoke_user_journeys.sh create mode 100644 scripts/test59.sh create mode 100644 scripts/test_layer1.sh create mode 100755 scripts/test_multitenant_ns.sh create mode 100755 scripts/test_simple_function.sh create mode 100755 scripts/test_ui_user_flows.sh create mode 100644 scripts/tests_v2.sh create mode 100644 test-results/2026-05-03_15-32-11.log create mode 100644 test-results/2026-05-03_15-47-34.log create mode 100644 test-results/2026-05-03_16-02-40_remaining.log create mode 100644 test-results/2026-05-03_16-47.log create mode 100644 test-results/2026-05-03_17-05-22.log create mode 100644 test-results/2026-05-03_17-05.log create mode 100644 test-results/2026-05-03_18-08-19.log create mode 100644 test-results/2026-05-03_18-25-27.log diff --git a/AUDIT_CONSOLE_FUNCTIONS.md b/AUDIT_CONSOLE_FUNCTIONS.md new file mode 100644 index 0000000..4c2d71d --- /dev/null +++ b/AUDIT_CONSOLE_FUNCTIONS.md @@ -0,0 +1,539 @@ +# 🔍 ПОЛНЫЙ АУДИТ КОНСОЛИ FISSION +**Дата:** 2 мая 2026 +**Файлы проверки:** index.html, app.js, auth.js, functions.js, templates/ + +--- + +## 📋 SUMMARY + +| Метрика | Значение | +|---------|----------| +| **Всего вызовов функций** | 41 | +| **Функции НАЙДЕНЫ (ОК)** | 43 ✅ | +| **Функции НЕ НАЙДЕНЫ (ДЫР)** | 0 ✅ | +| **ID элементов (все найдены)** | 38 ✅ | +| **КРИТИЧЕСКИХ проблем** | 2 🔴 | +| **Проблем с кодовой гигиеной** | 5 🟡 | + +--- + +## 🔴 КРИТИЧЕСКИЕ ПРОБЛЕМЫ + +### **1️⃣ JS файлы НЕ встроены в Docker image! ⚠️ МАКРО-ПРОБЛЕМА** + +**embed.go (ui/embed.go L8):** +```go +//go:embed index.html cron.html +var content embed.FS +``` + +**Это встраивает ТОЛЬКО:** +- ✅ index.html +- ✅ cron.html + +**НО НЕ встраивает:** +- ❌ js/*.js (8 файлов!) +- ❌ css/styles.css +- ❌ templates/**/*.html (6 файлов!) + +**Последствия:** +- Все JS файлы (app.js, auth.js, functions.js и т.д.) **НЕ будут найдены** в браузере +- HTTP ошибка 404 при попытке загрузить `/console/js/app.js` +- Фронтенд **полностью НЕ работает**! +- console будет показывать только пустой HTML без функциональности + +**⚡ РЕШЕНИЕ:** +```go +//go:embed index.html cron.html css/ js/ templates/ +var content embed.FS +``` + +--- + +### **2️⃣ JS файлы НЕ подключены в index.html** + +В [index.html](console/ui/index.html#L374) подключен **ТОЛЬКО app.js**: +```html + +``` + +Но функции определены в **отдельных файлах**: +- ✅ `auth.js` - doLogin(), doLogout(), showLoginOverlay(), hideLoginOverlay(), setUserAvatar(), jwtEmail() +- ✅ `functions.js` - onLangChange(), openCreate(), closeCreate(), submitCreate() +- ❌ `ai.js` - **ПУСТО!** Здесь должны быть функции AI +- ❌ `ui.js` - **ПУСТО!** +- ❌ `triggers.js` - **ПУСТО!** +- ❌ `config.js` - **ПУСТО!** +- ❌ `init.js` - **ПУСТО!** +- ❌ `modals.js` - **ПУСТО!** +- ❌ `api.js` - **ПУСТО!** + +**Даже если файлы будут встроены,** они не будут загружены в браузер без ` + + + + + + + + + +``` + +--- + +## ✅ ФУНКЦИИ НАЙДЕНЫ И РАБОТАЮТ + +### **В app.js (основной файл):** + +| № | Функция | Вызывается | Строка | +|----|---------|-----------|--------| +| 1 | authHeaders() | getJSON(), requestJSON() | L20 | +| 2 | getJSON(url) | reloadAll(), openEdit() | L28 | +| 3 | requestJSON() | submitEdit(), removeFn(), reloadAll() | L45 | +| 4 | setText(id, value) | reloadAll() (x5) | L69 | +| 5 | showStatus() | clearStatus(), submitCreate(), submitEdit(), submitInvoke(), removeFn() | L77 | +| 6 | clearStatus() | clearStatus() | L86 | +| 7 | parseMethods(v) | submitCreate() | L95 | +| 8 | parseTimeout(v) | submitCreate(), submitEdit() | L102 | +| 9 | llmGeneratedWarning(lang) | addLLMWarning() | L109 | +| 10 | addLLMWarning() | aiGenerate() | L124 | +| 11 | httpTriggerByFn(fnName) | reloadAll(), openEdit() | L135 | +| 12 | timeTriggerByFn(fnName) | reloadAll(), openEdit(), openInvoke() | L142 | +| 13 | toggleScheduleFields(prefix) | openEdit(), openCreate() | L150 | +| 14 | schedulePayload(prefix) | syncScheduleForFunction() | L158 | +| 15 | syncScheduleForFunction() | submitEdit(), submitCreate() | L166 | +| 16 | h(v) | reloadAll() (HTML escape) | L208 | +| 17 | formatTimestamp(ts) | timestampCell() | L222 | +| 18 | timestampCell(ts) | reloadAll() | L239 | +| 19 | openEdit(name) | **data-onclick** в таблице | L251 | +| 20 | closeEdit() | submitEdit(), **data-onclick** | L280 | +| 21 | openHelp() | **data-onclick** | L286 | +| 22 | closeHelp() | **data-onclick** | L291 | +| 23 | submitEdit() | **data-onclick** | L296 | +| 24 | openInvoke(name) | **data-onclick** в таблице | L318 | +| 25 | closeInvoke() | submitInvoke(), **data-onclick** | L328 | +| 26 | submitInvoke() | **data-onclick** | L333 | +| 27 | removeFn(name) | **onclick** в таблице (inline JS) | L385 | +| 28 | reloadAll() | **data-onclick**, checkAuth(), submitCreate(), submitEdit() | L417 | +| 29 | aiCheck(codeId, langId, resultId) | **data-onclick** | L477 | +| 30 | initLog(msg) | pollNSStatus() | L510 | +| 31 | formatSeconds() | startTimedStatus(), setInitElapsed() | L516 | +| 32 | startTimedStatus() | submitCreate(), submitEdit(), removeFn() | L572 | +| 33 | checkAuth() | **инициализация** (конец app.js) | L629 | + +### **В auth.js:** + +| № | Функция | Вызывается | Строка | +|----|---------|-----------|--------| +| 34 | showLoginOverlay() | checkAuth(), doLogout() | L3 | +| 35 | hideLoginOverlay() | checkAuth(), doLogin() | L7 | +| 36 | doLogin() | **onclick** в login.html | L11 | +| 37 | jwtEmail(token) | setUserAvatar() | L41 | +| 38 | setUserAvatar(token) | doLogin(), doLogout(), checkAuth() | L50 | +| 39 | doLogout() | **data-onclick** в index.html | L64 | + +### **В functions.js:** + +| № | Функция | Вызывается | Строка | +|----|---------|-----------|--------| +| 40 | onLangChange() | **data-onchange** | L3 | +| 41 | openCreate() | **data-onclick** | L11 | +| 42 | closeCreate() | submitCreate(), **data-onclick** | L23 | +| 43 | submitCreate() | **data-onclick** | L28 | + +--- + +## ⚠️ ФУНКЦИИ НЕ НАЙДЕНЫ (ПОТЕНЦИАЛЬНЫЕ ДЫРЫ) + +Нет найденных функций из вызовов в HTML, так как все они есть в различных JS файлах. + +**ОДНАКО!** Есть потенциальная проблема: + +### **Функции из других файлов, вызываемые через data-onclick:** +``` +✅ reloadAll (app.js L417) +✅ openCreate (functions.js L11) +✅ openHelp (app.js L286) +✅ doLogout (auth.js L64) +✅ onLangChange (functions.js L3) +✅ toggleScheduleFields (app.js L150) +✅ aiCheck (app.js L477) +✅ showGenPrompt (app.js L595) +✅ aiExplain (app.js L651) +✅ aiGenerate (app.js L625) +✅ closeCreate (functions.js L23) +✅ submitCreate (functions.js L28) +✅ closeEdit (app.js L280) +✅ submitEdit (app.js L296) +✅ closeHelp (app.js L291) +✅ closeInvoke (app.js L328) +✅ submitInvoke (app.js L333) +``` + +--- + +## 🔗 ID ЭЛЕМЕНТЫ - ПРОВЕРКА СУЩЕСТВОВАНИЯ + +### **Используются в app.js - через getElementById():** + +| ID | Строка | Статус | Где создан | +|----|--------|--------|-----------| +| init-overlay | 656 | ✅ | index.html L19 | +| init-elapsed | 656 | ✅ | index.html L26 | +| init-current-stage | 656 | ✅ | index.html L31 | +| init-summary | 656 | ✅ | index.html L36 | +| init-reason | 656 | ✅ | index.html L41 | +| init-error | 656 | ✅ | index.html L46 | +| init-log | 656 | ✅ | index.html L51 | +| init-stages | 656 | ✅ | index.html L58 | +| status | 456 | ✅ | index.html L121 | +| env-count | 443 | ✅ | index.html L104 | +| pkg-count | 443 | ✅ | index.html L109 | +| fn-count | 443 | ✅ | index.html L114 | +| http-count | 443 | ✅ | index.html L119 | +| cron-count | 443 | ✅ | index.html L124 | +| fn-rows | 456 | ✅ | index.html L131 | +| create-modal | 251, 453 | ✅ | index.html L130 | +| edit-modal | 251 | ✅ | index.html L189 | +| help-modal | 286 | ✅ | index.html L273 | +| invoke-modal | 318 | ✅ | index.html L367 | +| e-title | 251 | ✅ | index.html L191 | +| e-tf-warn | 251 | ✅ | index.html L195 | +| e-lang-hidden | 251, 477 | ✅ | index.html L199 | +| e-name | 251 | ✅ | index.html L204 | +| e-env | 251 | ✅ | index.html L209 | +| e-entry | 251 | ✅ | index.html L214 | +| e-timeout | 251 | ✅ | index.html L219 | +| e-schedule-enabled | 251 | ✅ | index.html L224 | +| e-cron | 251 | ✅ | index.html L231 | +| e-code | 251 | ✅ | index.html L238 | +| e-ai-btn | 251 | ✅ | index.html L241 | +| e-exp-btn | 251 | ✅ | index.html L244 | +| e-ai-result | 251 | ✅ | index.html L248 | +| e-submit | 296 | ✅ | index.html L255 | +| c-lang | openCreate (functions.js) | ✅ | index.html L141 | +| c-entry | openCreate (functions.js) | ✅ | index.html L168 | +| c-timeout | openCreate (functions.js) | ✅ | index.html L153 | +| c-schedule-enabled | openCreate (functions.js) | ✅ | index.html L156 | +| c-cron | openCreate (functions.js) | ✅ | index.html L160 | +| c-code | aiCheck(), aiGenerate(), aiExplain() | ✅ | index.html L165 | +| c-ai-btn | aiCheck(), aiGenerate(), aiExplain() | ✅ | index.html L172 | +| c-gen-btn | aiGenerate() | ✅ | index.html L173 | +| c-exp-btn | aiExplain() | ✅ | index.html L174 | +| c-gen-prompt | aiGenerate() | ✅ | index.html L178 | +| c-gen-desc | aiGenerate() | ✅ | index.html L179 | +| c-ai-result | aiCheck(), aiGenerate(), aiExplain() | ✅ | index.html L187 | +| c-submit | submitCreate() (functions.js) | ✅ | index.html L193 | +| c-name | openCreate(), submitCreate() (functions.js) | ✅ | index.html L136 | +| c-route | submitCreate() (functions.js) | ✅ | index.html L148 | +| c-methods | submitCreate() (functions.js) | ✅ | index.html L152 | +| login-overlay | showLoginOverlay(), hideLoginOverlay() (auth.js) | ✅ | login.html L2 | +| l-env | doLogin() (auth.js) | ✅ | login.html L11 | +| l-token | doLogin() (auth.js) | ✅ | login.html L17 | +| l-error | doLogin() (auth.js) | ✅ | login.html L25 | +| l-btn | doLogin() (auth.js) | ✅ | login.html L26 | +| user-avatar | setUserAvatar() (auth.js) | ✅ | index.html L84 | +| i-title | openInvoke() (app.js) | ✅ | index.html L367 | +| i-body | submitInvoke() (app.js) | ✅ | index.html L371 | +| i-status | submitInvoke() (app.js) | ✅ | index.html L382 | +| i-meta | submitInvoke() (app.js) | ✅ | index.html L384 | +| i-resp | submitInvoke() (app.js) | ✅ | index.html L391 | +| i-submit | submitInvoke() (app.js) | ✅ | index.html L381 | + +### **Используются в auth.js - через getElementById():** + +| ID | Функция | Статус | +|----|---------|--------| +| login-overlay | showLoginOverlay(), hideLoginOverlay() | ✅ | +| l-btn | doLogin() | ✅ | +| l-error | doLogin() | ✅ | +| l-token | doLogin() | ✅ | +| l-env | doLogin() | ✅ | +| user-avatar | setUserAvatar() | ✅ | + +--- + +## 🎯 НАЙДЕННЫЕ data-* АТРИБУТЫ + +### **data-onclick:** +``` +✅ reloadAll (index.html L81) +✅ openCreate (index.html L82) +✅ openHelp (index.html L83) +✅ doLogout (index.html L84) +✅ onLangChange (index.html L141 - data-onchange) +✅ toggleScheduleFields('c') (index.html L156 - data-onchange) +✅ toggleScheduleFields('e') (index.html L224 - data-onchange) +✅ aiCheck('c-code','c-lang','c-ai-result') (index.html L172) +✅ showGenPrompt() (index.html L173) +✅ aiExplain('c-code','c-lang','c-ai-result') (index.html L174) +✅ aiGenerate() (index.html L181) +✅ closeCreate() (index.html L193) +✅ submitCreate() (index.html L194) +✅ aiCheck('e-code','e-lang-hidden','e-ai-result') (index.html L241) +✅ aiExplain('e-code','e-lang-hidden','e-ai-result') (index.html L244) +✅ closeEdit() (index.html L255) +✅ submitEdit() (index.html L256) +✅ closeHelp() (index.html L348) +✅ closeInvoke() (index.html L381) +✅ submitInvoke() (index.html L382) +``` + +### **data-onchange:** +``` +✅ onLangChange (index.html L141) +✅ toggleScheduleFields('c') (index.html L156) +✅ toggleScheduleFields('e') (index.html L224) +``` + +### **data-onkeydown:** +``` +✅ if(event.key==='Enter')aiGenerate() (index.html L179) +``` + +--- + +## 🧩 INLINE onclick (В ТАБЛИЦЕ) + +В app.js строятся динамически через `innerHTML` (L456): +```javascript +' + + ``` + +- **After:** All replaced with data-* attributes for event delegation + ```html + + + ``` + +- **Total replacements:** 20+ event handlers across all modals and buttons + +### 3. Added Event Delegation in app.js +- New `initializeEventListeners()` function handles: + - `data-onclick` attributes: Executes function calls with arguments + - `data-onchange` attributes: Executes change handlers + - `data-onkeydown` attributes: Executes keyboard handlers with event context + +- Event delegation uses: + - `document.addEventListener('click', ...)` for click events + - `document.addEventListener('change', ...)` for change events + - `document.addEventListener('keydown', ...)` for keyboard events + - Element matching via `closest('[data-*]')` for proper event bubbling + +### 4. HTML Architecture +- **Status:** ✓ Pure HTML markup (no inline scripts) +- **Size reduction:** 800+ lines of inline code removed +- **Validation:** Python HTML parser confirms valid structure +- **Structure:** Complete `...` with proper `...` tags + +## Files Modified +- `/console/ui/index.html`: Cleaned HTML markup (690 lines → ~693 lines after cleanup) +- `/console/ui/js/app.js`: Added event delegation initialization (50 lines added) + +## User Requirement Met +- ✓ "полностью. не надо чтобы в html был js" (completely, no JS in HTML) +- ✓ No inline `