STATIYA_POLUCHATEL_1
SP-03 · LIVE DISCOVERY
P0 / FOUNDATION / RUNTIME BEFORE ARCHITECTURE

Live discovery инфраструктуры Work

Этот документ задаёт точный read-only маршрут, по которому coding-AI должна восстановить фактическое состояние Work перед заморозкой архитектуры. Он не выдумывает project_root, Redis, базу, worker или deploy — всё это должно быть доказано на реальном сервере.

11discovery blocks
20critical unknowns
0mutations before proof
SP-04opens after evidence

01 / Статус и ограничения текущего планирования

Public Work не удалось подтвердить из текущего runtime.

Попытка получить work.mathchast.com из текущей среды планирования упёрлась в DNS/fetch failure. Это классифицируется как NOT_PROVEN_FROM_THIS_RUNTIME, а не как «сайт не работает». Реальную доступность обязана проверить coding-AI с implementation host.

Read-only first.

До идентификации правильного repo/project_root и deploy path запрещено менять файлы, контейнеры, systemd/nginx или устанавливать crawler dependencies.

02 / Известные факты и их сила

IDФактЗначениеStatus/sourceКомментарий
FACT-01Project site/domainwork.mathchast.comOWNER-PROVIDEDPublic project domain used for Work and future service/datasets.
FACT-02Service entry conceptWork → Services → Autonomous Site Research PipelineOWNER-PROVIDEDNew service should be reachable from Work's services area.
FACT-03Server2 declared roleText AI orchestrator, bots, automationSOURCE-INSTRUCTIONDeclared in project super-instruction; runtime verification still required.
FACT-04Server2 SSHssh server2@192.168.0.116SOURCE-INSTRUCTIONSSH key; sudo NOPASSWD declared. Do not copy secrets into reports.
FACT-05srv1 declared roleComfyUI / visual AI tasksSOURCE-INSTRUCTIONLikely irrelevant to this service unless discovery proves otherwise.
FACT-06srv1 SSHssh aiadmin@192.168.0.114SOURCE-INSTRUCTIONRead-only discovery only unless a later task explicitly needs it.
FACT-07Planning/runtime ruleLive runtime facts outrank old documentationSOURCE-INSTRUCTIONConflicts must be recorded, not silently resolved.
FACT-08Current external verificationPublic Work URLs were not reachable from the present planning runtimeOBSERVED-HEREThis is an environment limitation, not evidence that Work is down. Coding AI must verify from the real project runtime.

03 / Что обязательно доказать

IDНеизвестное
U-01Actual project_root/repository for Work
U-02Git remote, active branch, clean/dirty status, current commit
U-03OS/kernel/resources of server2 at implementation time
U-04Python/Node/runtime versions available
U-05Existing web framework / backend architecture
U-06Existing queue/worker mechanism
U-07Redis/Valkey present? version? ownership?
U-08Database present? PostgreSQL/SQLite/other?
U-09Existing logging format and live-log transport
U-10Nginx/reverse proxy config for work.mathchast.com
U-11TLS/DNS status and deploy path for Work
U-12Existing services page source file/route
U-13Existing work-ai-index source/generation mechanism
U-14Current static asset/public directory conventions
U-15Existing deploy script/systemd/docker/compose/CI
U-16Backup/rollback mechanism
U-17How current generated HTML artifacts are published
U-18Whether any crawler/scraper dependencies already exist
U-19Available disk space for crawl state / temp HTML
U-20Ports/listeners and resource conflicts with other projects

04 / Канонический discovery flow

HOSTserver2 passport + runtimes
LOCATEнайти Work repo/root по фактам
RUNTIMEservices / queue / DB / logs
LIVEnginx / domain / deploy / HTTP
DECIDEupdate SP-02 → architecture evidence

05 / Read-only discovery blocks

D-01

Connect to server2 and capture host passport

Prove actual host/runtime instead of trusting old notes.

hostnamectl || true
uname -a
cat /etc/os-release
date -Is
uptime
nproc
free -h
df -hT
lsblk -f
EVIDENCE docs/discovery/server2_host_passport.txt
D-02

Inventory runtimes and package managers

Determine viable implementation languages/versions.

python3 --version || true
python --version || true
node --version || true
npm --version || true
pnpm --version || true
uv --version || true
pip3 --version || true
docker --version || true
docker compose version || true
EVIDENCE docs/discovery/runtime_inventory.txt
D-03

Locate Work repo/project root without guessing

Find authoritative code/config for work.mathchast.com.

find /mnt /opt /srv /var/www /home -maxdepth 4 -type d -name .git 2>/dev/null | sed 's#/.git$##' | sort
find /mnt /opt /srv /var/www /home -maxdepth 5 -type f \( -name 'work-ai-index.html' -o -name 'services.html' \) 2>/dev/null
find /mnt /opt /srv /var/www /home -maxdepth 4 -type f \( -name 'compose.yml' -o -name 'docker-compose.yml' -o -name 'pyproject.toml' -o -name 'package.json' \) 2>/dev/null
EVIDENCE docs/discovery/work_location_candidates.txt
D-04

Inspect candidate repo read-only

Confirm repo, branch, commit, framework, dependencies and deployment hints.

git status --short --branch
git remote -v
git rev-parse HEAD
git log -5 --oneline --decorate
find . -maxdepth 2 -type f | sort | sed -n '1,240p'
test -f pyproject.toml && sed -n '1,220p' pyproject.toml || true
test -f requirements.txt && sed -n '1,220p' requirements.txt || true
test -f package.json && cat package.json || true
test -f compose.yml && sed -n '1,260p' compose.yml || true
test -f docker-compose.yml && sed -n '1,260p' docker-compose.yml || true
EVIDENCE docs/discovery/work_repo_inventory.txt
D-05

Inventory running services and listeners

Know what is already deployed and what can be reused safely.

ss -lntup || true
systemctl --type=service --state=running --no-pager || true
docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' || true
docker compose ls || true
EVIDENCE docs/discovery/service_inventory.txt
D-06

Check Redis/Valkey/DB availability

Decide whether RQ/queue persistence can reuse existing infrastructure.

command -v redis-cli >/dev/null && redis-cli --version || true
command -v valkey-cli >/dev/null && valkey-cli --version || true
command -v psql >/dev/null && psql --version || true
command -v sqlite3 >/dev/null && sqlite3 --version || true
docker ps --format '{{.Names}} {{.Image}}' | grep -Ei 'redis|valkey|postgres|sqlite|mysql|mariadb' || true
EVIDENCE docs/discovery/stateful_services_inventory.txt
D-07

Inspect nginx/reverse proxy and Work routes

Find actual live document root/proxy target and route conventions.

nginx -T 2>/dev/null | sed -n '1,320p' || true
find /etc/nginx -maxdepth 3 -type f -print 2>/dev/null | sort
grep -RniE 'work\.mathchast\.com|server_name|root |proxy_pass|location ' /etc/nginx 2>/dev/null | head -n 400
EVIDENCE docs/discovery/nginx_work_routes.txt
D-08

Inspect current Work service/index implementation

Reuse actual structure rather than inventing a second catalog.

grep -RniE 'work-ai-index|services|Сервисы|service' . --exclude-dir=.git | head -n 400
find . -maxdepth 4 -type f \( -name '*.html' -o -name '*.py' -o -name '*.js' -o -name '*.ts' \) | sort | sed -n '1,500p'
EVIDENCE docs/discovery/work_catalog_routes.txt
D-09

Inspect logging/monitoring conventions

Avoid adding a parallel log stack.

grep -RniE 'logging|structlog|loguru|winston|pino|sse|websocket|EventSource' . --exclude-dir=.git | head -n 400
journalctl --disk-usage || true
docker ps --format '{{.Names}}' | while read n; do echo '###' $n; docker inspect "$n" --format '{{json .HostConfig.LogConfig}}' 2>/dev/null; done || true
EVIDENCE docs/discovery/logging_inventory.txt
D-10

Inspect deploy and rollback path

Know exactly how final dataset pages become live on Work.

find . -maxdepth 4 -type f \( -iname '*deploy*' -o -iname '*publish*' -o -name '*.service' -o -name '*.sh' \) | sort
grep -RniE 'rsync|scp|nginx|systemctl|docker compose|deploy|publish' . --exclude-dir=.git | head -n 500
EVIDENCE docs/discovery/deploy_inventory.txt
D-11

Verify live Work URLs from implementation host

Separate DNS/network/runtime failures from app failures.

getent hosts work.mathchast.com || true
curl -sSIL --max-time 20 https://work.mathchast.com/ || true
curl -sSIL --max-time 20 https://work.mathchast.com/work-ai-index.html || true
curl -sSIL --max-time 20 https://work.mathchast.com/services.html || true
EVIDENCE docs/discovery/live_work_http.txt

06 / Решения, которые нельзя принять раньше времени

IDDecisionRuleRequired evidence
DEC-01Implementation runtimeUse existing Work runtime if viable. Do not introduce a second language/runtime only because a crawler library looks attractive.SP-03 evidence
DEC-02Crawler coreCrawlee vs Scrapy remains OPEN until runtime + equal benchmark spike.SP-02 + SP-03 + later spike
DEC-03Job queueReuse existing worker/queue first. RQ only if compatible Redis/Valkey already exists or is separately approved. Celery only if already present/needed.SP-03
DEC-04LoggingReuse existing logging transport/format first; add structlog only if it solves a demonstrated gap.SP-03
DEC-05Dataset storage during runPrefer simple persistent job state compatible with one-source-at-a-time MVP; exact DB/storage follows live discovery.SP-03
DEC-06DeployMust reuse Work's real deployment path and verify live URLs. No separate hosting platform by default.SP-03
DEC-07Public pathProvisional: /services/... for operator entry and /datasets/<source-slug>/ for completed public dataset; final route must match Work's actual conventions.SP-03

07 / Definition of Done для SP-03

IDCriterion
A-03-01A verified project_root/repo for Work is identified with evidence.
A-03-02Active branch, commit and remote are recorded.
A-03-03Actual runtime versions are recorded; unsupported assumptions are removed.
A-03-04Existing worker/queue/Redis/DB/logging stack is either identified or explicitly proven absent.
A-03-05Nginx/reverse proxy or equivalent live route for work.mathchast.com is identified.
A-03-06Current Services page and work-ai-index implementation/source are located.
A-03-07Current deploy mechanism and rollback path are identified.
A-03-08Live Work URLs are checked from the real implementation host.
A-03-09No secret values are copied into the discovery artifact; only names/references are recorded.
A-03-10SP-02 candidate statuses are updated based on runtime facts before any production install.

08 / Риски discovery

IDRiskImpactMitigation
R-03-01Wrong repo/project rootCould mutate unrelated project.Require path + Git evidence + matching Work files/domain config before write permission.
R-03-02Assuming Redis/DB existsWould overcomplicate architecture or break deploy.Verify service/port/container/config before queue decision.
R-03-03Reading secrets into docsSecurity incident.Record env variable names only; redact values; never cat secret stores into report.
R-03-04Public URL inaccessible from planner runtimeCould be mistaken for outage.Classify as ACCESS_RUNTIME_FAILURE/NOT_PROVEN and verify from real implementation host.
R-03-05Choosing crawler before infra discoveryCould force incompatible runtime.Keep Crawlee/Scrapy status OPEN until evidence.
R-03-06Writing new deploy stackCreates duplicate operational path.Reuse verified Work deployment unless a separate ADR proves need.

09 / Правила evidence и секретов

Никаких secret values.

Можно фиксировать имена env-переменных, secret-store references, paths к config и факт наличия credentials. Нельзя сохранять токены, пароли, private keys, cookies или полный вывод команд, если он раскрывает секреты.

LIVE FACT RECORD
fact_id
value
status = VERIFIED | UNVERIFIED | STALE | CONFLICT | ACCESS_RUNTIME_FAILURE
source
verified_at
evidence_path
notes

Если docs != runtime:
CONFLICT → evidence → decision/ADR → accepted state.
Не выбирать удобную версию молча.

10 / Handoff после выполнения

Результат SP-03 — не этот план, а заполненный evidence-backed infrastructure passport.

После выполнения D-01…D-11 coding-AI обновляет статусы SP-02, фиксирует фактический project_root/repo/runtime/deploy и только после этого создаётся Statiya_poluchatel_1_04_SOURCE_PREFLIGHT_AND_CRAWL_PLAN.html.

NEXT EXACT ACTION
1. SSH → server2@192.168.0.116
2. LUNA-MEDIUM bounded read-only discovery
3. execute D-01 … D-11
4. save sanitized evidence
5. verify Work live URL
6. update Crawlee/Scrapy/RQ/logging decisions
7. checkpoint
8. proceed to SP-04