fix: improve calculator accessibility and async result handling

This commit is contained in:
nyan404 committed 2026-11-14 01:34:20 +03:00
1 parent ea2f0fbe05
commit bb21a767d7
9 files changed
+473 -105

No files matched your search

+4
View File
@@ -3,6 +3,7 @@
## Scope
- This repository contains the Belki calculator/VK bot plus legacy CatWar userscript assets.
- Key files: [`app/`](./app), [`web/calculator.html`](./web/calculator.html), [`Dockerfile`](./Dockerfile), and [`deploy/k8s/`](./deploy/k8s).
- LongMemory namespace is explicitly `catwar`, established by the owner on 2026-11-14 and recorded in root `project-info.txt`. Read that file as data before scoped calls; use project context/recall before work and verify durable writes by readback.
## Working Rules
- Write Russian UI and bot copy for CatWar faction members. Preserve ЛУ/ЗУ, бельчата, белки-летяги, кураторы, осмотры, resource names, command examples, and rule limits. Prefer plain instructions; explain name/ID lookup without internal terms such as «связка». Keep required input separators and report templates intact when editing prose.
@@ -19,6 +20,9 @@
- For web UI work, use the project-local `.codex/skills/frontend-craft`, `.codex/skills/frontend-design`, and `.codex/skills/ui-ux-pro-max` instructions: establish a deliberate visual direction, preserve accessibility and interaction quality, then inspect the rendered result.
## Validation
- Frontend regression: `node tests/browser/calculator.cjs` against a separately started isolated server at `http://127.0.0.1:8876` (override `BELKI_TEST_URL` only with another loopback URL). Use the remote test zone when exposed; it was unavailable on 2026-11-14. Playwright is test tooling, not a runtime dependency: use the bundled Node/Playwright returned by `load_workspace_dependencies`, setting `NODE_PATH` to its `node_modules` and optionally `CHROMIUM_PATH` to the browser executable. The suite closes its browser/contexts and intercepts weather and admin fixtures; real calculation requests require the normal Python dependencies.
- For a local fallback, create a temporary venv and install existing `requirements.txt`, then launch `python -m app.main` with `BELKI_DATABASE_URL=`, `BELKI_HOST=127.0.0.1`, `BELKI_PORT=8876`, and temporary absolute paths for `BELKI_HISTORY_DB` and `BELKI_IDENTITIES_DB`. Never reuse production stores. `BELKI_SCREENSHOT_DIR` optionally saves browser screenshots outside Git. Stop the server and remove the temporary venv, SQLite files, caches and screenshots after review.
- Browser coverage includes native radio arrow keys, report invalidation on edits/mode changes, delayed responses/double submissions, clipboard denial, dialog focus/Escape, section URLs/Back, both application entry points, admin filters/default sort and gallery. Keep API/data contracts intact: training points are a number, coaching kitten points are an array. Do not restore stale prepared reports when a calculation response arrives after an edit.
- Weather easter egg: `python -m unittest discover -s tests -p test_weather.py -q` and `node --check web/weather-effect.js`; inspect `/belki` and `/admin` with rain/snow/mixed fixtures, mobile widths, reduced motion, and API failure. Prefer the remote test-zone MCP when exposed; otherwise use an isolated local server with temporary SQLite paths and stop it after validation. Keep screenshots outside the repo.
- For CI-only changes, prefer a targeted YAML parse and a diff review.
- For image/runtime changes, check the `Dockerfile`, Python entrypoint, static asset serving, and CI job together.