{
  "schema_version": 1,
  "channel": "homelab-runtime",
  "command_id": "GITEA-V4-FAILED-CAPABILITY-ARTIFACT-PROBE-20260730T195901Z",
  "status": "OK",
  "rc": 0,
  "host": "pve01",
  "mode": "verify",
  "component": "gitea-machine-identity",
  "started_at_utc": "2026-07-30T20:00:27Z",
  "finished_at_utc": "2026-07-30T20:00:27Z",
  "reference_register_checked": true,
  "reference_sha256": "5763f2f8edc75fcf6f3951f8c95896d1cc112ceccb6cf5b64a383f540a4deb8e",
  "error_register_checked": true,
  "error_register_sha256": "24934a2c7fa5c26f6e828583c4aefac7f143b40c0171736ed7571e617d55ab83",
  "command_sha256": "2765124be407b6bc49a1c07e10ea5c7cd6b6e802d65ae286e1c3d5316719196d",
  "duplicate_failed_command_blocked": false,
  "block_reason": null,
  "execution_started": true,
  "change_declared": false,
  "result_contract_valid": true,
  "result_contract_status": null,
  "result_contract_error": null,
  "command_rc": 0,
  "changes_made": false,
  "rollback_started": false,
  "rollback_restored": null,
  "mutation_outcome": "NO_MUTATION",
  "sanitized": true,
  "secrets_included": false,
  "private_addresses_included": false,
  "raw_evidence_retained_locally": true,
  "raw_evidence_sha256": "fbff106b916c5c8b64191455e3e27be2cfeb3fd0ba7048d53d425be23ce1bf0a",
  "sanitized_output_sha256": "fbff106b916c5c8b64191455e3e27be2cfeb3fd0ba7048d53d425be23ce1bf0a",
  "output_truncated_in_json": false,
  "full_sanitized_output_url": "https://git.gram1.ru/.well-known/homelab-runtime/latest.txt",
  "output": "{\"capability_artifact\":{\"bytes\":64,\"ignored_key_count\":0,\"line_count\":2,\"non_key_line_count\":2,\"record_count\":0,\"records\":[],\"sha256\":\"9f40f58de72ebf08edb065b1e9ba9c4eaf4f527cd7da1f878cae64339a829e7d\",\"trailing_newline\":true},\"changes_made\":false,\"command_id\":\"GITEA-V4-FAILED-CAPABILITY-ARTIFACT-PROBE-20260730T195901Z\",\"dry_run_json\":{\"exists\":false},\"mutation_outcome\":\"NO_MUTATION\",\"next_stage\":\"PATCH_EXACT_REMOTE_FAILURE_AND_RUN_MIGRATION\",\"output_truncated_in_json\":false,\"private_addresses_included\":false,\"rc\":0,\"remote_source_context\":[\"0003: \",\"0004: fail(){\",\"0005:   printf 'ROOT_CAUSE=%s\",\"0006: ROOT_CAUSE_COUNT=1\",\"0007: DETAIL=%s\",\"0008: ' \\\"$1\\\" \\\"$2\\\"\",\"0009:   exit 1\",\"....\",\"0017: [[ \\\"$task_id\\\" == \\\"gitea-machine-identity-controlled-migration-v4\\\" ]] || fail TASK_ID_MISMATCH \\\"$task_id\\\"\",\"0018: case \\\"$mode\\\" in\",\"0019:   capability|apply|verify-state|rollback|cleanup-owned|seal) ;;\",\"0020:   *) fail INVALID_MODE \\\"$mode\\\" ;;\",\"0021: esac\",\"....\",\"0032: container_id=\",\"0033: \",\"0034: docker_capture(){\",\"0035:   local operation=\\\"$1\\\"\",\"0036:   shift\",\"0037:   local captured rc\",\"0038:   set +e\",\"0039:   captured=\\\"$(timeout --signal=TERM --kill-after=1s 3s docker \\\"$@\\\" 2>&1)\\\"\",\"0040:   rc=$?\",\"0041:   set -e\",\"....\",\"0049: \",\"0050: find_container(){\",\"0051:   container_id=\\\"$(docker_capture container-discovery ps --filter 'ancestor=docker.gitea.com/gitea:1.26.2' --format '{{.ID}}')\\\"\",\"0052:   [[ \\\"$(printf '%s\",\"0053: ' \\\"$container_id\\\" | awk 'NF{n++} END{print n+0}')\\\" -eq 1 ]] ||\",\"0054:     fail GITEA_CONTAINER_CARDINALITY vm170\",\"0055:   image_value=\\\"$(docker_capture container-inspect inspect \\\"$container_id\\\" --format '{{.Config.Image}}')\\\"\",\"0056:   [[ \\\"$image_value\\\" == 'docker.gitea.com/gitea:1.26.2' ]] ||\",\"0057:     fail GITEA_IMAGE_MISMATCH \\\"$image_value\\\"\",\"0058: }\",\"0059: \",\"0060: gitea_capture(){\",\"0061:   local seconds_value=\\\"$1\\\"\",\"0062:   local operation=\\\"$2\\\"\",\"....\",\"0064:   local captured rc\",\"0065:   set +e\",\"0066:   captured=\\\"$(timeout --signal=TERM --kill-after=2s \\\"$seconds_value\\\" docker exec --user git \\\"$container_id\\\" gitea \\\"$@\\\" 2>&1)\\\"\",\"0067:   rc=$?\",\"0068:   set -e\",\"....\",\"0077: gitea_quiet_best_effort(){\",\"0078:   set +e\",\"0079:   timeout --signal=TERM --kill-after=2s 18s docker exec --user git \\\"$container_id\\\" gitea \\\"$@\\\" >/dev/null 2>&1\",\"0080:   local rc=$?\",\"0081:   set -e\",\"....\",\"0128: ' <<<\\\"$plan_json\\\" >/dev/null\",\"0129: \",\"0130: if [[ \\\"$mode\\\" == 'capability' ]]; then\",\"0131:   [[ ! -e \\\"$state_dir\\\" ]] || fail TASK_STATE_ALREADY_PRESENT vm170\",\"0132:   create_help=\\\"$(gitea_capture 15s user-create-help admin user create --help)\\\"\",\"0133:   for required_flag in --user-type --access-token --access-token-name --access-token-scopes; do\",\"0134:     grep -Fq -- \\\"$required_flag\\\" <<<\\\"$create_help\\\" ||\",\"....\",\"0171: if [[ \\\"$mode\\\" == 'rollback' ]]; then\",\"0172:   [[ -f \\\"$state_dir/created-by-task\\\" ]] || fail ROLLBACK_TASK_MARKER_MISSING vm170\",\"0173:   gitea_capture 18s machine-user-delete admin user delete --username \\\"$machine_user\\\" >/dev/null\",\"0174:   rm -rf \\\"$state_dir\\\"\",\"0175:   printf 'VM170_MACHINE_IDENTITY_ROLLBACK_STATUS=OK\",\"....\",\"0187:   [[ -f \\\"$state_dir/admin-flag-absent\\\" ]] || fail ADMIN_FLAG_MARKER_MISSING vm170\",\"0188:   [[ -f \\\"$state_dir/scope-write-repository\\\" ]] || fail SCOPE_MARKER_MISSING vm170\",\"0189:   admin_users=\\\"$(gitea_capture 15s admin-user-list admin user list --admin)\\\"\",\"0190:   awk -v target=\\\"$machine_user\\\" 'NR>1 && $2==target {found=1} END{exit found?0:1}' <<<\\\"$admin_users\\\" &&\",\"0191:     fail MACHINE_USER_BECAME_ADMIN vm170\",\"....\",\"0215: trap cleanup_failure EXIT\",\"0216: \",\"0217: create_output=\\\"$(gitea_capture 18s machine-user-create admin user create --username \\\"$machine_user\\\" --email \\\"$machine_email\\\" --user-type bot --access-token --access-token-name \\\"$material_name\\\" --access-token-scopes 'write:repository')\\\"\",\"0218: grep -Fq \\\"New user '$machine_user' has been successfully created!\\\" <<<\\\"$create_output\\\" ||\",\"0219:   fail MACHINE_USER_CREATE_CONFIRMATION_MISSING vm170\"],\"rollback_restored\":null,\"rollback_started\":false,\"run_dir\":{\"name\":\"20260730T195350Z-2555344-dry-run\",\"path_sha256\":\"0f265d625302907f6fb9d51d5c165b390bafddae1c22a4e58aae83901ec831e7\"},\"schema\":1,\"secrets_included\":false,\"stage\":\"FAILED_CAPABILITY_ARTIFACT_CAPTURED\",\"status\":\"OK\"}\n"
}
