Files
cwshed-clone/structure_and_data.md
T

4.8 KiB

Structure and Data

Repository Layout

  • .gitlab-ci.yml: existing single-stage GitLab pipeline targeting the Belki image.
  • Dockerfile: Python 3.12 runtime image for the calculator web service and shared static assets.
  • app/: calculation domain, report templates, JSON API, HTTP server, and VK Bots Long Poll adapter.
  • web/: calculator frontend plus legacy CatWar userscript assets.
  • deploy/k8s/: not-yet-applied namespace, web/bot Deployments, ClusterIP Service, and Secret example.
  • tests/: standard-library unit tests for calculation, reports, API, and VK parsing.
  • docs/staging/: working specification and implementation plan for the Belki calculator.
  • AGENTS.md: repo-specific instructions for future coding agents.
  • .gitignore: ignores Python bytecode/caches, virtual environments, test output, and local editor noise.
  • MEMORY.md: durable notes about the current CI/runtime decision.

Runtime / Deployment

  • GitLab CI runs the build job.
  • The job builds through docker:dind with DOCKER_HOST=tcp://docker:2375 and DOCKER_TLS_CERTDIR="".
  • The job waits for docker info to succeed before starting the build, because the daemon may need a few seconds to come up.
  • The runner does not need the host Docker socket mounted for this repo.
  • The local image is currently belki-calculator:test; the CI target is now $DOCKER_REGISTRY/belki:latest.
  • Local validation was performed with python3 -m unittest discover -s tests -v (28 tests), compileall, JavaScript syntax check, a local browser/API smoke test, and container health/API smoke.
  • The VK dialog layer is covered by tests for step-by-step entry, bulk detection, clarification, confirmation, and cancellation.
  • Bulk input accepts a natural one-line format without pipes, e.g. 15.08 11:00 11:20 Дикая Вишня 1604614 Серолап 1617140; the web form calls /api/inspect-bulk and fills recognized fields.
  • Training and inspection have the same stepwise/bulk flow. Character identity can be resolved through /api/resolve-identity and the persistent SQLite directory; missing pairs produce an explicit prompt instead of guessed data.
  • Character name/ID pairs are persisted automatically in the SQLite file from BELKI_IDENTITIES_DB (default data/belki.sqlite3); the database is local runtime data and ignored by Git.
  • The VK dialog onboards each author once, stores their profile by from_id, greets them by name, and keeps the profile in the same SQLite database across bot restarts.
  • Every confirmed calculation is persisted by app/belki/history.py to PostgreSQL from BELKI_DATABASE_URL; SQLite is only a local fallback. Records include actor, source, mode, input, result, rendered message, and timestamp.
  • VK photo attachments received during an active dialog are normalized into input.attachments and persisted with the calculation; /admin renders their thumbnails. With BELKI_IMAGE_HOST_API_URL, the bot mirrors each photo through image-hosting-web and stores mirror_url; Google Sheets export remains deferred.
  • /admin and /api/admin/calculations expose the calculation history for review. The API requires X-Admin-Password matching BELKI_ADMIN_PASSWORD; the web page supports sorting by kitten ID or name and does not persist the password in browser storage.
  • VK messages.send responses include a serialized context-aware keyboard; button payloads are translated back into the same dialog commands, while text commands remain supported.
  • No k3s deployment or cluster state change has been made. The SSH tunnel used for read-only service inventory was stopped.
  • Remote runner host: root@10.3.1.236 (docker-03.homelab.local), GitLab Runner stage-zone-runner, Docker executor, privileged, with docker:29.6.1-dind as the service image.
  • 2026-08-16 prevent-eol check: python:3.12-slim is currently maintained through 2028-10-31; Docker 29.6.1-cli was unknown to the EOL catalog (no finding). Docker/CI references remain tag-pinned rather than digest-pinned.

Change Log

  • 2026-06-27: updated the Docker CI image to docker:29.6.1-cli and aligned the pipeline to docker:dind with DOCKER_HOST=tcp://docker:2375.
  • 2026-06-27: verified the working runner on docker-03.homelab.local and confirmed docker:29.6.1-dind is reachable from the job network.
  • 2026-08-16: added the Belki calculator domain, report templates, local web form, VK Long Poll adapter, and draft k3s manifests. Deployment remains intentionally deferred.
  • 2026-08-16: made bulk entry conversational and separator-free; added API/web inspection and clarification flow.
  • 2026-08-16: rewrote VK help, welcome, and web hints as a concise neutral FAQ; command behavior is unchanged.