Files
cwshed-clone/MEMORY.md
T

40 lines
8.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# MEMORY
- The repository packages a static site under `web/` with an Nginx-based `Dockerfile`.
- The GitLab pipeline builds and pushes the Belki image from `.gitlab-ci.yml`; current target is `$DOCKER_REGISTRY/belki:latest`.
- Docker builds are expected to run through `docker:dind` with `DOCKER_HOST=tcp://docker:2375` and `DOCKER_TLS_CERTDIR=""`.
- The build job now waits for `docker info` before running `docker login` and `docker build` because `docker:29.6.1-dind` can take ~20 seconds to finish initialization on `docker-03`.
- Current CI image: `docker:29.6.1-cli`.
- The runner host at `root@10.3.1.236` is `docker-03.homelab.local`; its GitLab Runner is `stage-zone-runner` and successfully reaches `docker:29.6.1-dind`.
- 2026-08-16: the repository now contains a local-only Belki calculator MVP under `app/` with a standard-library Python HTTP service, shared calculation/report domain, browser form at `/`, and VK Bots Long Poll adapter.
- Confirmed local acceptance: 28 unittest cases pass; local browser smoke generated a 20-minute ЛУ report; `belki-calculator:test` built and its `/health`, `/api/calculate`, `/api/inspect-bulk`, and `/api/resolve-identity` endpoints responded.
- Draft k3s manifests live under `deploy/k8s/` but have not been applied. No VK token, group ID, service IP, or cluster Secret is stored in the repository.
- VK input is now conversational: `BelkiDialog` stores per-peer state, supports `/лу`/`/зу` step-by-step prompts, detects bulk messages, asks for missing skill/status or confirmation, and clears with `/отмена`.
- The preferred bulk input is a natural line without pipes, such as `15.08 11:00 11:20 Дикая Вишня 1604614 Серолап 1617140`; `/api/inspect-bulk` and the web form fill recognized fields and show only missing questions.
- `/урок` and `/осмотр` use the same dialog; character name/ID may be entered separately and resolved from the persistent SQLite directory at `BELKI_IDENTITIES_DB` (default `data/belki.sqlite3`), otherwise the dialog asks for the missing half and remembers the completed pair.
- `.gitignore` now excludes Python bytecode/cache and local test/editor artifacts; generated `__pycache__` directories were removed from the working tree.
- `prevent-eol` checked `Dockerfile` and `.gitlab-ci.yml`: Python 3.12 is maintained through 2028-10-31; Docker 29.6.1 was unknown to the lifecycle catalog, with no EOL finding. Images are not digest-pinned yet.
- VK onboarding asks first-time authors for `Имя [ID]`, stores the profile by `from_id` in SQLite, greets by name on later conversations, and accepts `сам`/`несам` as independence shortcuts.
- VK `/help` is a neutral FAQ: it explains step-by-step entry, complete commands, separator-free one-line input, confirmation, screenshots, and `/отмена` without audience-specific wording.
- Confirmed calculations are persisted through `BELKI_DATABASE_URL` by `app/belki/history.py`; PostgreSQL is the intended production store and SQLite is only a local fallback.
- The admin history is served at `/admin`; `/api/admin/calculations` requires `BELKI_ADMIN_PASSWORD` via `X-Admin-Password` and supports sorting by kitten ID/name. The password is configured out-of-band and is not stored in browser localStorage.
- 2026-08-16: `docs/staging/specs/2026-08-16-krylany-calculator-rules.md` supersedes the older Belki draft: Krylan equals Belka (the escort role); kittens always receive `minutes/5`, while the escort receives `minutes/5` or `minutes/5*1.5` for non-self-sufficient ЛУ; ZU always uses self-sufficient rules.
- 2026-08-16 production deployment: namespace `belki` is live in k3s. Web and bot use `reg.nyan404.ru/cwshed-clone/belki:6b74dfa`; the migrated cwshed Nginx gateway keeps MetalLB `10.12.0.204` and routes `/belki`, `/admin`, and `/api/*` to web `10.12.0.212`; PostgreSQL uses the amd64 mirror `reg.nyan404.ru/library/postgres:16-alpine-amd64` on Longhorn. Runtime credentials remain only in the cluster Secret `belki-runtime`.
- GitLab CI/CD now builds SHA/latest tags and deploys `deploy/k8s/production.yaml` from `main`. The ignored `.gitlab.variables.env` is a local handoff for GitLab Variables; CI uses namespace-scoped ServiceAccount `belki/gitlab-deploy`, not cluster-admin credentials.
- 2026-08-21: applications use a separate store/table from calculator history. `/applications` and VK `/заявка` collect typed data; `/admin` accepts it. The bot can automatically notify only VK submissions, because a web form has no known reply peer.
- 2026-08-21: Google Sheets export is intentionally disabled by default. Application create/accept events go to a durable outbox and will be delivered through an explicitly configured Apps Script Web App endpoint once the feature flag is enabled.
- 2026-08-21: CI final images use immutable registry base images. Any runtime dependency change requires rebuilding/pushing the matching base (`Dockerfile.base` for `requirements.txt`, `Dockerfile.gateway-base` for `nginx.conf`) and changing the tag used by the final Dockerfile.
- 2026-08-21: use Context7 for fresh official integration documentation and `prevent-eol` before dependency changes; lifecycle status is not a vulnerability verdict.
- 2026-08-21: project-local frontend instructions include `frontend-craft`, `frontend-design`, and `ui-ux-pro-max`; use them together for UI work.
- 2026-08-21: `/belki` is the single public Belki workspace: both reports and its “Заявки” tab are open without a password. The old `/applications` route remains only as a direct legacy entry point. `/admin` is the only password-protected surface.
- 2026-08-21: `/admin` now keeps a server-memory `HttpOnly` cookie session across page refreshes instead of retaining an admin password in the browser. Its authenticated WebSocket sends a refresh signal every 25 seconds; this needs the cwshed Nginx `/api/` Upgrade proxy settings.
- 2026-08-21: `img.nyan404.ru` is only the image-host viewer/frontend; Belki uploads must use the image-host API `https://nyan.nyan404.ru`. The API rejects the default Python `urllib` user agent, so `ImageHostClient` identifies requests as `BelkiCalculator/1.0`. Upload failures are converted to actionable API errors rather than a generic calculator 500.
- 2026-08-21: Belki Python base image `reg.nyan404.ru/cwshed-clone/belki-base:py312-d6c42c4497ce` pins `pip==26.2.1`; CI upgrades to the same version before installing requirements.
- 2026-08-25: Belki fixes: natural bulk parsing now extracts `Имя ID` and `Имя [ID]` before a `HH:MM-HH:MM` range; web quick input is coaching-only; inspection resources use `+N название`; reports decline `раз/раза`; VK image mirroring defaults to `https://nyan.nyan404.ru`; `/belki` has a standalone goal calculator backed by `mode=goal`.
- 2026-08-25: VK now exposes the goal calculator in the main keyboard and through `/цель`/`/калькулятор`; its interactive state collects points, session duration, skill, independence, and kitten count, then confirms the calculated result without screenshots.
- 2026-08-25: public goal calculations reject non-finite scores and bound session length to 1–1440 minutes and kitten count to 1–50, consistently across domain, API, and VK input.
- 2026-08-25: screenshot uploads are public by product design but are bounded before JSON parsing (20 MiB) and after base64 decoding (15 MiB); only verified PNG/JPEG/WebP bytes and basename-only filenames reach image hosting.
# 2026-08-16 — несколько котят в прокачке
`CoachingSession.extra_kittens` теперь влияет на баллы сопровождающего через количество подопечных: 1-й ×1, 2-й ×1,5, каждый последующий ×1,15 (коэффициенты перемножаются), вместо сложения полной прибыли. Базовый коэффициент самостоятельности основного котёнка сохраняется. Веб-форма отправляет список `extra_kittens`; VK принимает `доп. котята: ...` в pipe-команде.