{
  "schema_version": 1,
  "channel": "homelab-runtime",
  "command_id": "HOMELAB-READER-V3-STORAGE-CONTRACT-AUDIT-375",
  "status": "OK",
  "rc": 0,
  "host": "pve01",
  "mode": "read-only",
  "component": "cluster-audit",
  "started_at_utc": "2026-07-23T16:15:59Z",
  "finished_at_utc": "2026-07-23T16:15:59Z",
  "reference_register_checked": true,
  "reference_sha256": "5763f2f8edc75fcf6f3951f8c95896d1cc112ceccb6cf5b64a383f540a4deb8e",
  "error_register_checked": true,
  "error_register_sha256": "08b3a769b8e38eaa1acec915352fb328180d70caa7ff6cd9d1ec0da426262752",
  "command_sha256": "7a9dc5ecf6ec239bf61ccf2a67f6b3238f06106fe9ff6ff7c5442f76dd566e20",
  "duplicate_failed_command_blocked": false,
  "block_reason": null,
  "execution_started": true,
  "changes_made": false,
  "sanitized": true,
  "secrets_included": false,
  "private_addresses_included": false,
  "raw_evidence_retained_locally": true,
  "raw_evidence_sha256": "520e76d1ea9c69ce029685bd7089a4d2b361287d3133004063ec0fd5adc97ee3",
  "sanitized_output_sha256": "3bbc00cf03cf0b7088f1551454d01bf5f982791084f4c03918afecbe2986f1e9",
  "output_truncated_in_json": false,
  "full_sanitized_output_url": "https://git.gram1.ru/.well-known/homelab-runtime/latest.txt",
  "output": "DETAIL=READER_SHA256=092780e76ff18dfe2920c51f8b97dd09d194fd6cbdb59c3755c9fbf6530f3536\nDETAIL=LINKED_SHA256=efa9fce3c768e6e0650903ca14fe4b6d5319d57f20ec87c465a4a00cb300d4e0\nDETAIL=SOURCE_SYNTAX_AND_INTEGRITY=PASS\nDETAIL=READER_STORAGE_SOURCE_BEGIN\nDETAIL=READER_LINE=1|#!/usr/bin/python3\nDETAIL=READER_LINE=2|import hashlib\nDETAIL=READER_LINE=3|import http.server\nDETAIL=READER_LINE=4|import json\nDETAIL=READER_LINE=5|import os\nDETAIL=READER_LINE=6|import pathlib\nDETAIL=READER_LINE=7|import re\nDETAIL=READER_LINE=8|import sys\nDETAIL=READER_LINE=9|\nDETAIL=READER_LINE=10|ROOT=pathlib.Path(\"/var/lib/homelab-reader-v3\")\nDETAIL=READER_LINE=11|MANIFEST=ROOT/\"manifest.json\"\nDETAIL=READER_LINE=12|RESULTS=ROOT/\"results\"\nDETAIL=READER_LINE=13|CAPABILITY=os.environ[\"HOMELAB_READER_CAPABILITY\"]\nDETAIL=READER_LINE=14|PORT=int(os.environ.get(\"HOMELAB_READER_PORT\",\"18788\"))\nDETAIL=READER_LINE=15|RESULT_RE=re.compile(r\"^[A-Za-z0-9][A-Za-z0-9._-]{0,127}-[0-9a-f]{64}\\.txt$\")\nDETAIL=READER_LINE=16|\nDETAIL=READER_LINE=17|class Handler(http.server.BaseHTTPRequestHandler):\nDETAIL=READER_LINE=18|    server_version=\"HomelabReader/3\"\nDETAIL=READER_LINE=19|\nDETAIL=READER_LINE=20|    def log_message(self,fmt,*args):\nDETAIL=READER_LINE=21|        sys.stderr.write(\"%s - %s\\n\"%(self.address_string(),fmt%args))\nDETAIL=READER_LINE=22|\nDETAIL=READER_LINE=23|    def reply(self,status,content_type,payload,etag=\"\",include_body=True):\nDETAIL=READER_LINE=24|        self.send_response(status)\nDETAIL=READER_LINE=25|        self.send_header(\"Content-Type\",content_type)\nDETAIL=READER_LINE=26|        self.send_header(\"Content-Length\",str(len(payload)))\nDETAIL=READER_LINE=27|        self.send_header(\"Cache-Control\",\"no-store, no-cache, must-revalidate, max-age=0\")\nDETAIL=READER_LINE=28|        self.send_header(\"Surrogate-Control\",\"no-store\")\nDETAIL=READER_LINE=29|        self.send_header(\"Pragma\",\"no-cache\")\nDETAIL=READER_LINE=30|        self.send_header(\"Expires\",\"0\")\nDETAIL=READER_LINE=31|        self.send_header(\"X-Robots-Tag\",\"noindex, nofollow, noarchive\")\nDETAIL=READER_LINE=32|        if etag:\nDETAIL=READER_LINE=33|            self.send_header(\"ETag\",chr(34)+etag+chr(34))\nDETAIL=READER_LINE=34|            self.send_header(\"X-Homelab-Generation\",etag)\nDETAIL=READER_LINE=35|        self.end_headers()\nDETAIL=READER_LINE=36|        if include_body:\nDETAIL=READER_LINE=37|            self.wfile.write(payload)\nDETAIL=READER_LINE=38|\nDETAIL=READER_LINE=39|    def do_HEAD(self):\nDETAIL=READER_LINE=40|        self.handle_reader(False)\nDETAIL=READER_LINE=41|\nDETAIL=READER_LINE=42|    def do_GET(self):\nDETAIL=READER_LINE=43|        self.handle_reader(True)\nDETAIL=READER_LINE=44|\nDETAIL=READER_LINE=45|    def handle_reader(self,include_body):\nDETAIL=READER_LINE=46|        request_path=self.path.split(\"?\",1)[0]\nDETAIL=READER_LINE=47|        prefix=\"/\"+CAPABILITY+\"/\"\nDETAIL=READER_LINE=48|        if not request_path.startswith(prefix):\nDETAIL=READER_LINE=49|            self.reply(404,\"text/plain; charset=utf-8\",b\"not found\\n\",include_body=include_body)\nDETAIL=READER_LINE=50|            return\nDETAIL=READER_LINE=51|\nDETAIL=READER_LINE=52|        relative=request_path[len(prefix):]\nDETAIL=READER_LINE=53|\nDETAIL=READER_LINE=54|        if relative==\"health\":\nDETAIL=READER_LINE=55|            self.reply(200,\"application/json; charset=utf-8\",b\"{\\\"status\\\":\\\"ok\\\",\\\"version\\\":3}\\n\",\"health-v3\",include_body)\nDETAIL=READER_LINE=56|            return\nDETAIL=READER_LINE=57|\nDETAIL=READER_LINE=58|        if relative==\"feed\":\nDETAIL=READER_LINE=59|            try:\nDETAIL=READER_LINE=60|                payload=MANIFEST.read_bytes()\nDETAIL=READER_LINE=61|                document=json.loads(payload.decode(\"utf-8\"))\nDETAIL=READER_LINE=62|                generation=str(document.get(\"generation\",\"0\"))\nDETAIL=READER_LINE=63|                self.reply(200,\"application/json; charset=utf-8\",payload,generation,include_body)\nDETAIL=READER_LINE=64|            except Exception:\nDETAIL=READER_LINE=65|                self.reply(500,\"text/plain; charset=utf-8\",b\"reader error\\n\",include_body=include_body)\nDETAIL=READER_LINE=66|            return\nDETAIL=READER_LINE=67|\nDETAIL=READER_LINE=68|        if relative.startswith(\"results/\"):\nDETAIL=READER_LINE=69|            name=relative[len(\"results/\"):]\nDETAIL=READER_LINE=70|            target=RESULTS/name\nDETAIL=READER_LINE=71|            if not RESULT_RE.fullmatch(name) or not target.is_file():\nDETAIL=READER_LINE=72|                self.reply(404,\"text/plain; charset=utf-8\",b\"not found\\n\",include_body=include_body)\nDETAIL=READER_LINE=73|                return\nDETAIL=READER_LINE=74|            try:\nDETAIL=READER_LINE=75|                payload=target.read_bytes()\nDETAIL=READER_LINE=76|                digest=name.rsplit(\"-\",1)[1][:-4]\nDETAIL=READER_LINE=77|                if hashlib.sha256(payload).hexdigest()!=digest:\nDETAIL=READER_LINE=78|                    self.reply(500,\"text/plain; charset=utf-8\",b\"integrity error\\n\",include_body=include_body)\nDETAIL=READER_LINE=79|                    return\nDETAIL=READER_LINE=80|                self.reply(200,\"text/plain; charset=utf-8\",payload,digest,include_body)\nDETAIL=READER_LINE=81|            except Exception:\nDETAIL=READER_LINE=82|                self.reply(500,\"text/plain; charset=utf-8\",b\"reader error\\n\",include_body=include_body)\nDETAIL=READER_LINE=83|            return\nDETAIL=READER_LINE=84|\nDETAIL=READER_LINE=85|        self.reply(404,\"text/plain; charset=utf-8\",b\"not found\\n\",include_body=include_body)\nDETAIL=READER_LINE=86|\nDETAIL=READER_LINE=87|class Server(http.server.ThreadingHTTPServer):\nDETAIL=READER_LINE=88|    allow_reuse_address=True\nDETAIL=READER_LINE=89|\nDETAIL=READER_LINE=90|Server((\"[PRIVATE_IP]\",PORT),Handler).serve_forever()\nDETAIL=READER_STORAGE_SOURCE_END\nDETAIL=LINKED_SOURCE_BEGIN\nDETAIL=LINKED_LINE=1|#!/usr/bin/env bash\nDETAIL=LINKED_LINE=2|set -o pipefail\nDETAIL=LINKED_LINE=3|tmp=$(/usr/bin/mktemp)\nDETAIL=LINKED_LINE=4|trap '/usr/bin/rm -f \"$tmp\"' EXIT\nDETAIL=LINKED_LINE=5|\nDETAIL=LINKED_LINE=6|/usr/local/sbin/homelab-chat-run \"$@\" 2>&1 | /usr/bin/tee \"$tmp\"\nDETAIL=LINKED_LINE=7|rc=${PIPESTATUS[0]}\nDETAIL=LINKED_LINE=8|\nDETAIL=LINKED_LINE=9|cid=$(/usr/bin/sed -n \"s/^COMMAND_ID=//p\" \"$tmp\" | /usr/bin/tail -n 1)\nDETAIL=LINKED_LINE=10|sha=$(/usr/bin/sed -n \"s/^COMMIT_SHA=//p\" \"$tmp\" | /usr/bin/tail -n 1)\nDETAIL=LINKED_LINE=11|raw=$(/usr/bin/sed -n \"s/^LOCAL_RAW_FILE=//p\" \"$tmp\" | /usr/bin/tail -n 1)\nDETAIL=LINKED_LINE=12|\nDETAIL=LINKED_LINE=13|if [[ \"$cid\" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ && \"$sha\" =~ ^[0-9a-f]{40}$ ]]; then\nDETAIL=LINKED_LINE=14|    /usr/bin/printf \"COMMIT_URL=https://git.gram1.ru/homelab-admin/homelab-public-context/commit/%s\\n\" \"$sha\"\nDETAIL=LINKED_LINE=15|    /usr/bin/printf \"IMMUTABLE_RESULT_URL=https://git.gram1.ru/homelab-admin/homelab-public-context/raw/commit/%s/runtime/history/%s.txt\\n\" \"$sha\" \"$cid\"\nDETAIL=LINKED_LINE=16|fi\nDETAIL=LINKED_LINE=17|\nDETAIL=LINKED_LINE=18|/usr/bin/printf \"FAILURE_DIAGNOSTIC_BEGIN\\n\"\nDETAIL=LINKED_LINE=19|if [[ -n \"$raw\" && -r \"$raw\" ]]; then\nDETAIL=LINKED_LINE=20|    /usr/bin/grep -Ei '^(DECISION|DETAIL|FAILURE_REASON|ERROR_CODE|SOURCE_DECISION|NGINX_[A-Z0-9_]*|READER_[A-Z0-9_]*|RESULT_FEED_URL|PUBLIC_HEALTH_URL|HTTPS_[A-Z0-9_]*|LOCAL_[A-Z0-9_]*|CHANGES_MADE)=|Traceback|RuntimeError|SystemExit|FileNotFoundError|PermissionError|command not found|No such file or directory|Connection refused|failed|invalid|missing' \"$raw\" | /usr/bin/tail -n 100 || true\nDETAIL=LINKED_LINE=21|fi\nDETAIL=LINKED_LINE=22|/usr/bin/printf \"FAILURE_DIAGNOSTIC_END\\n\"\nDETAIL=LINKED_LINE=23|\nDETAIL=LINKED_LINE=24|exit \"$rc\"\nDETAIL=LINKED_SOURCE_END\nResult=success\nExecMainStatus=0\nExecStart={ path=/usr/bin/python3 ; argv[]=/usr/bin/python3 -B /usr/local/sbin/homelab-reader-server-v3 ; ignore_errors=no ; start_time=[Thu 2026-07-23 16:20:39 MSK] ; stop_time=[n/a] ; pid=1247 ; code=(null) ; status=0/0 }\nLoadState=loaded\nActiveState=active\nSubState=running\nFragmentPath=/etc/systemd/system/homelab-reader-v3.service\nDETAIL=PUBLIC_READER_ROUTE=feed|HTTP_STATUS=200\nDETAIL=PUBLIC_READER_ROUTE=results/HOMELAB-READER-V3-FEED-CONTRACT-AUDIT-374|HTTP_STATUS=404\nDETAIL=PUBLIC_READER_ROUTE=results/HOMELAB-READER-V3-FEED-CONTRACT-AUDIT-374.txt|HTTP_STATUS=404\nDETAIL=READER_V3_STORAGE_CONTRACT_AUDIT=PASS\nCHANGES_MADE=NO\n"
}
