feat(bot): клиент SourceCraft API — прогоны, логи кубов, sha коммита, ретраи

- SourceCraftClient (httpx): list_runs, get_run, get_cube_logs (постранично), run_commit_sha;
  ретраи на сетевые ошибки и 5xx с экспоненциальной задержкой, 4xx — SourceCraftError без повторов
- модели: RunStatus/EventType из swagger, «1970-01-01» = не задано, failed_cubes без служебных #-кубов
- у прогона в API нет sha → куб check/meta в tgit-uploads печатает TGIT_COMMIT_SHA (ADR-014)
- CLI: python -m app.sourcecraft.cli runs
- тесты на реальных ответах API (фикстуры), порог покрытия 45 → 80

Refs #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 18:02:52 +03:00
co-authored by Claude Opus 5.5
parent 15f354d06b
commit c016b47a8a
18 changed files with 1433 additions and 4 deletions
+396
View File
@@ -0,0 +1,396 @@
{
"id": "",
"slug": "1000001",
"dates": {
"created_at": "2026-10-13T20:58:52.273658Z",
"started_at": "2026-10-13T20:58:53.940173Z",
"finished_at": "2026-10-13T20:59:17.833911Z",
"updated_at": "2026-10-13T20:59:17.867686Z"
},
"status": "failed",
"workflows": [
{
"id": "",
"slug": "check-and-deploy",
"description": "",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:53.940173Z",
"finished_at": "2026-10-13T20:59:17.833911Z",
"updated_at": "2026-10-13T20:59:17.862572Z"
},
"status": "failed",
"tasks": [
{
"id": "",
"slug": "check",
"description": "",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:53.940173Z",
"finished_at": "2026-10-13T20:59:11.150164Z",
"updated_at": "2026-10-13T20:59:12.846332Z"
},
"status": "failed",
"cubes": [
{
"id": "",
"slug": "#create-environment",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:54.031424Z",
"finished_at": "2026-10-13T20:58:54.090132Z",
"updated_at": "2026-10-13T20:58:54.155008Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": []
}
},
{
"id": "",
"slug": "#git-clone",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:54.090481Z",
"finished_at": "2026-10-13T20:58:55.142644Z",
"updated_at": "2026-10-13T20:58:55.211046Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#create-environment"
}
]
}
},
{
"id": "",
"slug": "#prepare-image-for-compile",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:55.143033Z",
"finished_at": "2026-10-13T20:58:59.605194Z",
"updated_at": "2026-10-13T20:58:59.706155Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#git-clone"
}
]
}
},
{
"id": "",
"slug": "#prepare-image-for-lint",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:58:59.605538Z",
"finished_at": "2026-10-13T20:59:00.536788Z",
"updated_at": "2026-10-13T20:59:00.604498Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#git-clone"
}
]
}
},
{
"id": "",
"slug": "#prepare-image-for-security",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:59:00.537171Z",
"finished_at": "2026-10-13T20:59:01.447150Z",
"updated_at": "2026-10-13T20:59:01.511994Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#git-clone"
}
]
}
},
{
"id": "",
"slug": "#prepare-image-for-tests",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:59:01.447481Z",
"finished_at": "2026-10-13T20:59:02.624921Z",
"updated_at": "2026-10-13T20:59:02.700313Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#git-clone"
}
]
}
},
{
"id": "",
"slug": "compile",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:59:02.625267Z",
"finished_at": "2026-10-13T20:59:09.366621Z",
"updated_at": "2026-10-13T20:59:09.454706Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-image-for-compile"
}
]
}
},
{
"id": "",
"slug": "lint",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:59:09.366953Z",
"finished_at": "2026-10-13T20:59:11.088201Z",
"updated_at": "2026-10-13T20:59:11.173518Z"
},
"status": "failed",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-image-for-lint"
}
]
}
},
{
"id": "",
"slug": "security",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "2026-10-13T20:59:11.088571Z",
"updated_at": "2026-10-13T20:59:11.206851Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-image-for-security"
}
]
}
},
{
"id": "",
"slug": "tests",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "2026-10-13T20:59:11.088804Z",
"updated_at": "2026-10-13T20:59:11.242177Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-image-for-tests"
}
]
}
},
{
"id": "",
"slug": "#tear-down-environment",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "2026-10-13T20:59:11.089254Z",
"finished_at": "2026-10-13T20:59:11.150164Z",
"updated_at": "2026-10-13T20:59:11.346169Z"
},
"status": "success",
"artifacts": [],
"relations": {
"needs": [
{
"name": "compile"
},
{
"name": "lint"
},
{
"name": "security"
},
{
"name": "tests"
}
]
}
}
],
"relations": {
"needs": []
}
},
{
"id": "",
"slug": "deploy",
"description": "",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "2026-10-13T20:59:17.833911Z",
"updated_at": "2026-10-13T20:59:17.840273Z"
},
"status": "created",
"cubes": [
{
"id": "",
"slug": "#create-environment",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": []
}
},
{
"id": "",
"slug": "#git-clone",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#create-environment"
}
]
}
},
{
"id": "",
"slug": "#prepare-artifacts",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#git-clone"
}
]
}
},
{
"id": "",
"slug": "#prepare-image-for-deploy",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-artifacts"
}
]
}
},
{
"id": "",
"slug": "deploy",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "#prepare-image-for-deploy"
}
]
}
},
{
"id": "",
"slug": "#tear-down-environment",
"dates": {
"created_at": "2026-10-13T20:58:52.726601Z",
"started_at": "1970-01-01T00:00:00Z",
"finished_at": "1970-01-01T00:00:00Z",
"updated_at": "2026-10-13T20:58:52.727666Z"
},
"status": "created",
"artifacts": [],
"relations": {
"needs": [
{
"name": "deploy"
}
]
}
}
],
"relations": {
"needs": [
{
"name": "check"
}
]
}
}
],
"environment_id": ""
}
],
"event_type": "manual",
"error_messages": [],
"user": {
"id": "01a06158-1562-7db1-b6e9-018ddd4d4c29",
"slug": "rogachevegorushka"
}
}