[COMBINE] P0.5 карантин 15 атрибутов, P0.6 retry 18380 URL, P0.7 junk report, P0.8 merge, страница отчётов /reports/
lint / hygiene (push) Failing after 16s
standard / check (push) Successful in 7s

This commit is contained in:
root committed 2026-11-18 15:02:05 +03:00
1 parent 39fca83f57
commit 1c04fa1511
17 files changed
+1242

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
"""Сборка страницы отчётов Комбайна/инфраструктуры для http://...:8096/reports/."""
import html
import os
import time
WEB = "/root/buryan-infra/ops/work/web"
OUT = os.path.join(WEB, "reports")
FILES = [
("LLM-аудит Комбайна (13:05)", "/root/buryan-infra/ops/audits/COMBINE-LLM-AUDIT-20261118-1305.md"),
("P0-stage отчёт", "/root/buryan-infra/ops/combine/P0-STAGE-REPORT-2026-11-18.md"),
("P0 diff", "/root/buryan-infra/ops/combine/P0-DIFF-2026-11-18.md"),
("Нормализация каталога", "/root/buryan-infra/ops/combine/NORMALIZATION-REPORT-2026-11-18.md"),
("Стратегия Комбайна", "/root/buryan-infra/ops/combine/STRATEGY-2026-11-18.md"),
("Вендоры research", "/root/buryan-infra/ops/combine/VENDORS-RESEARCH.md"),
("VPS fix", "/root/buryan-infra/ops/audits/VPS-FIX-2026-11-18.md"),
("Сценарии OpenClaw", "/root/buryan-infra/ops/openclaw/SCENARIOS.md"),
("Оценка (eval)", "/root/buryan-infra/ops/audits/EVAL-FINAL-2026-11-17.md"),
]
os.makedirs(OUT, exist_ok=True)
def page(title, body):
return """<!doctype html><html lang="ru"><head><meta charset="utf-8">
<title>%s</title><style>body{font:15px/1.5 system-ui;background:#0d1117;color:#e6edf3;margin:0;padding:24px}
pre{white-space:pre-wrap;background:#161b22;border:1px solid #30363d;border-radius:10px;padding:18px;overflow:auto}
a{color:#58a6ff} .nav{margin-bottom:16px} h1{font-size:22px}</style></head>
<body><div class="nav"><a href="/">Комбайн</a> · <a href="/reports/">Отчёты</a></div>
<h1>%s</h1>%s</body></html>""" % (html.escape(title), html.escape(title), body)
cards = []
for title, path in FILES:
if not os.path.exists(path):
continue
slug = os.path.basename(path).replace(".md", ".html")
txt = open(path, encoding="utf-8", errors="replace").read()
open(os.path.join(OUT, slug), "w", encoding="utf-8").write(
page(title, "<pre>%s</pre>" % html.escape(txt)))
cards.append('<li><a href="/reports/%s">%s</a></li>' % (slug, html.escape(title)))
open(os.path.join(OUT, "index.html"), "w", encoding="utf-8").write(
page("Отчёты", "<ul>%s</ul>" % "".join(cards)))
print("reports", len(cards), "->", OUT)
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""Собрать queue-retry.jsonl из пустых результатов LLM-сбора."""
import glob
import json
import os
OUT = "/opt/work-hub/research"
QUEUE = os.path.join(OUT, "queue-retry.jsonl")
seen = set()
rows = []
for f in glob.glob(os.path.join(OUT, "results-*.jsonl")):
if "retry" in f:
continue
for line in open(f, encoding="utf-8", errors="ignore"):
try:
r = json.loads(line)
except Exception:
continue
data = r.get("data") or []
empty = True
for x in data:
if not isinstance(x, dict):
continue
if x.get("device") or x.get("facts") or x.get("dependencies") or x.get("package"):
empty = False
break
if not empty:
continue
url = r.get("url")
if not url or url in seen:
continue
seen.add(url)
rows.append({"url": url, "product": r.get("product") or "",
"slug": r.get("slug") or "", "retry": True})
with open(QUEUE, "w", encoding="utf-8") as f:
for x in rows:
f.write(json.dumps(x, ensure_ascii=False) + "\n")
print("retry urls:", len(rows), "->", QUEUE)
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env python3
"""P0.7: отчёт по мусорным фактам (точные ключи)."""
import glob
import json
import collections
JUNK = {"pageviews", "downloads", "date", "support document type"}
counts = collections.Counter()
examples = []
for f in glob.glob("/opt/work-hub/research/results-*.jsonl"):
if "retry" in f:
continue
for line in open(f, encoding="utf-8", errors="ignore"):
try:
r = json.loads(line)
except Exception:
continue
for x in (r.get("data") or []):
if not isinstance(x, dict):
continue
for fact in (x.get("facts") or []):
k = fact.get("key") if isinstance(fact, dict) else None
if k and str(k).strip().lower() in JUNK:
counts[str(k)] += 1
if len(examples) < 10:
examples.append((r.get("vendor"), str(k), fact.get("value", "")))
out = "/root/buryan-infra/ops/combine/P0-JUNK-REPORT-2026-11-18.md"
lines = ["# P0.7 — мусорные факты", "",
"Точные мусорные ключи: **%d**, вхождений: **%d**." % (len(counts), sum(counts.values())), "",
"| Ключ | Вхождений |", "|---|---|"]
for k, n in counts.most_common():
lines.append("| %s | %d |" % (k, n))
lines += ["", "## Примеры", "| Вендор | Ключ | Значение |", "|---|---|---|"]
for v, k, val in examples:
lines.append("| %s | %s | %s |" % (v, k, str(val)[:80]))
open(out, "w", encoding="utf-8").write("\n".join(lines) + "\n")
print("junk", dict(counts))
print(out)
@@ -0,0 +1,55 @@
#!/usr/bin/env python3
"""P0.5: валидация/карантин атрибутов Комбайна. Прод не меняет."""
import yaml
import json
from collections import Counter
VAL = "/opt/work-hub/compat/values.yaml"
OUT = "/root/buryan-infra/ops/combine/attributes-quarantine-2026-11-18.yaml"
REP = "/root/buryan-infra/ops/combine/P0-ATTR-REPORT-2026-11-18.md"
d = yaml.safe_load(open(VAL, encoding="utf-8"))
devs = d if isinstance(d, list) else d.get("devices", [])
bad = []
for x in devs:
name = x.get("device") or ""
attrs = x.get("attributes") or {}
for k, v in attrs.items():
reason = None
try:
f = float(str(v).split()[0])
except Exception:
f = None
if k in ("camera.fov_h", "camera.fov_v") and f is not None and (f <= 0 or f > 180):
reason = "FOV вне 0..180"
if k in ("camera.fov_h", "camera.fov_v") and name == "MeetingBar A30" and f == 120:
reason = "FOV 120 одновременнно H/V — физически невозможно"
if k == "camera.max_resolution":
sv = str(v)
if sv in ("4", "3840") or "*" in sv:
reason = "несогласованный формат разрешения"
if k == "poe.ports" and ("UVC" in name or name.startswith("SIP-")):
reason = "PoE-порты у камеры/телефона"
if k == "audio.spl_max" and "UVC" in name:
reason = "SPL у USB-камеры — поле не по роли"
if k == "physical.temp_min" and f is not None and f > 60:
reason = "temp_min выглядит как температура, не диапазон"
if k == "power.consumption_w" and f is not None and f > 500:
reason = "потребление >500 Вт"
if reason:
bad.append({"device": name, "key": k, "value": v, "reason": reason})
yaml.safe_dump({"version": "2026-11-18", "quarantine": bad}, open(OUT, "w", encoding="utf-8"),
allow_unicode=True, sort_keys=False)
cnt = Counter(b["reason"] for b in bad)
lines = ["# P0.5 — карантин атрибутов", "",
"Прод `values.yaml` не изменён. Проблемных значений: **%d**." % len(bad), "",
"| Причина | Кол-во |", "|---|---|"]
for k, n in cnt.most_common():
lines.append("| %s | %d |" % (k, n))
lines += ["", "## Значения", "| Устройство | Атрибут | Значение | Причина |", "|---|---|---|---|"]
for b in bad[:80]:
lines.append("| %s | %s | %s | %s |" % (b["device"], b["key"], b["value"], b["reason"]))
open(REP, "w", encoding="utf-8").write("\n".join(lines) + "\n")
print("quarantine", len(bad), "devices", len({b['device'] for b in bad}))
print(REP)