{
  "schema_version": 1,
  "channel": "homelab-runtime",
  "command_id": "GITEA-V4-STAGE-RECONCILE-TRANSACTION-V2-20260730T165915Z",
  "status": "FAIL",
  "rc": 1,
  "host": "pve01",
  "mode": "change",
  "component": "gitea-machine-identity",
  "started_at_utc": "2026-07-30T17:00:10Z",
  "finished_at_utc": "2026-07-30T17:00:11Z",
  "reference_register_checked": true,
  "reference_sha256": "5763f2f8edc75fcf6f3951f8c95896d1cc112ceccb6cf5b64a383f540a4deb8e",
  "error_register_checked": true,
  "error_register_sha256": "24934a2c7fa5c26f6e828583c4aefac7f143b40c0171736ed7571e617d55ab83",
  "command_sha256": "9ffcea480b54d6707a4308757839917962b95f120e48c04b04f25fc0b25c83a3",
  "duplicate_failed_command_blocked": false,
  "block_reason": null,
  "execution_started": true,
  "change_declared": true,
  "result_contract_valid": true,
  "result_contract_status": "FAIL",
  "result_contract_error": null,
  "command_rc": 1,
  "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": "41d148fc79fd258d1a038ea7d8f91bfc9709c7e4af1deb144bedd32e6004c413",
  "sanitized_output_sha256": "41d148fc79fd258d1a038ea7d8f91bfc9709c7e4af1deb144bedd32e6004c413",
  "output_truncated_in_json": false,
  "full_sanitized_output_url": "https://git.gram1.ru/.well-known/homelab-runtime/latest.txt",
  "output": "HOMELAB_RESULT_CONTRACT={\"changes_made\":false,\"command_id\":\"GITEA-V4-STAGE-RECONCILE-TRANSACTION-V2-20260730T165915Z\",\"rollback_restored\":null,\"rollback_started\":false,\"status\":\"FAIL\",\"version\":1}\n{\"PLAN_SHA256\":null,\"changes_made\":false,\"command_id\":\"GITEA-V4-STAGE-RECONCILE-TRANSACTION-V2-20260730T165915Z\",\"error\":\"RuntimeError: command failed rc=1 argv=/usr/bin/python3 -B -m unittest discover -s /tmp/gitea-v4-reconcile-2aauj_hx/review/tests -v stdout= stderr=(current, dict):\\\\n        fail('current user response')\\\\n    actual_login = current.get('login')\\\\n    if not isinstance(actual_login, str) or not re.fullmatch(r'[A-Za-z0-9_.-]+', actual_login):\\\\n        fail('current login')\\\\n    _, permission = client.request(\\\\n        'GET',\\\\n        f'/repos/{REPOSITORY}/collaborators/{actual_login}/permission',\\\\n    )\\\\n    if not isinstance(permission, dict) or permission.get('permission') != 'admin':\\\\n        fail('legacy repository permission')\\\\n    status, _ = client.request(\\\\n        'GET',\\\\n        '/users/' + MACHINE_USER,\\\\n        expected=(200, 404),\\\\n    )\\\\n    if status != 404:\\\\n        fail('machine user already present')\\\\n    return actual_login\\\\n\\\\n\\\\nparser = argparse.ArgumentParser()\\\\nparser.add_argument('mode', choices=('inspect', 'grant'))\\\\nparser.add_argument('--credential-file', required=True)\\\\nargs = parser.parse_args()\\\\nlogin_value, material_value = read_credential(Path(args.credential_file))\\\\nclient = Client(login_value, material_value)\\\\n\\\\nif args.mode == 'inspect':\\\\n    actual_login = inspect(client)\\\\n    print('LEGACY_IDENTITY_API_STATUS=OK')\\\\n    print('GITEA_VERSION=1.26.2')\\\\n    print('LEGACY_AUTHENTICATED_LOGIN=' + actual_login)\\\\n    print('LEGACY_REPOSITORY_PERMISSION=admin')\\\\n    print('MACHINE_USER_STATE=ABSENT')\\\\n    print('API_DEADLINE_SECONDS=10')\\\\n    raise SystemExit(0)\\\\n\\\\n_, version = client.request('GET', '/version', authenticated=False)\\\\nif not isinstance(version, dict) or version.get('version') != '1.26.2':\\\\n    fail('Gitea version')\\\\n_, current = client.request('GET', '/user')\\\\nif not isinstance(current, dict):\\\\n    fail('current user response')\\\\nactual_login = current.get('login')\\\\nif not isinstance(actual_login, str) or not re.fullmatch(r'[A-Za-z0-9_.-]+', actual_login):\\\\n    fail('current login')\\\\n_, legacy_permission = client.request(\\\\n    'GET',\\\\n    f'/repos/{REPOSITORY}/collaborators/{actual_login}/permission',\\\\n)\\\\nif not isinstance(legacy_permission, dict) or legacy_permission.get('permission') != 'admin':\\\\n    fail('legacy repository permission')\\\\n_, machine_user = client.request('GET', '/users/' + MACHINE_USER)\\\\nif not isinstance(machine_user, dict):\\\\n    fail('machine user response')\\\\nif machine_user.get('login') != MACHINE_USER or machine_user.get('is_admin') is not False:\\\\n    fail('machine user non-admin state')\\\\nclient.request(\\\\n    'PUT',\\\\n    f'/repos/{REPOSITORY}/collaborators/{MACHINE_USER}',\\\\n    payload={'permission': 'write'},\\\\n    expected=(204,),\\\\n)\\\\n_, permission = client.request(\\\\n    'GET',\\\\n    f'/repos/{REPOSITORY}/collaborators/{MACHINE_USER}/permission',\\\\n)\\\\nif not isinstance(permission, dict) or permission.get('permission') != 'write':\\\\n    fail('machine repository permission')\\\\nprint('LEGACY_IDENTITY_GRANT_STATUS=OK')\\\\nprint('MACHINE_USER_PRESENT=YES')\\\\nprint('MACHINE_USER_ADMIN=NO')\\\\nprint('REPOSITORY_PERMISSION=write')\\\\n\\\"\\n\\n----------------------------------------------------------------------\\nRan 20 tests in 0.002s\\n\\nFAILED (failures=1)\\n\",\"mutation_outcome\":\"NO_MUTATION\",\"rollback_restored\":null,\"rollback_started\":false,\"schema\":1,\"status\":\"FAIL\"}\n"
}
