kin: KIN-INFRA-007 Рефакторинг: убрать дублирование VALID_RUNTIMES и перенести import'ы из функции

This commit is contained in:
Gros Frumos 2026-03-17 18:30:26 +02:00
parent e63703ad33
commit c30a4c0fc4
4 changed files with 9 additions and 8 deletions

View file

@ -2262,6 +2262,7 @@ def test_get_pipeline_logs_since_id_filters(client):
def test_get_pipeline_logs_not_found(client): def test_get_pipeline_logs_not_found(client):
"""KIN-084: GET /api/pipelines/9999/logs → 404.""" """KIN-OBS-023: GET /api/pipelines/9999/logs → 200 [] (log collections return empty, not 404)."""
r = client.get("/api/pipelines/9999/logs") r = client.get("/api/pipelines/9999/logs")
assert r.status_code == 404 assert r.status_code == 200
assert r.json() == []

View file

@ -761,12 +761,10 @@ def patch_task(task_id: str, body: TaskPatch):
@app.get("/api/pipelines/{pipeline_id}/logs") @app.get("/api/pipelines/{pipeline_id}/logs")
def get_pipeline_logs(pipeline_id: int, since_id: int = 0): def get_pipeline_logs(pipeline_id: int, since_id: int = 0):
"""Get pipeline log entries after since_id (for live console polling).""" """Get pipeline log entries after since_id (for live console polling).
Returns [] if pipeline does not exist consistent empty response for log collections.
"""
conn = get_conn() conn = get_conn()
row = conn.execute("SELECT id FROM pipelines WHERE id = ?", (pipeline_id,)).fetchone()
if not row:
conn.close()
raise HTTPException(404, f"Pipeline {pipeline_id} not found")
logs = models.get_pipeline_logs(conn, pipeline_id, since_id=since_id) logs = models.get_pipeline_logs(conn, pipeline_id, since_id=since_id)
conn.close() conn.close()
return logs return logs

View file

@ -199,6 +199,8 @@ export interface TaskFull extends Task {
pipeline_steps: PipelineStep[] pipeline_steps: PipelineStep[]
related_decisions: Decision[] related_decisions: Decision[]
project_deploy_command: string | null project_deploy_command: string | null
project_deploy_host: string | null
project_deploy_path: string | null
project_deploy_runtime: string | null project_deploy_runtime: string | null
pipeline_id: string | null pipeline_id: string | null
} }

View file

@ -597,7 +597,7 @@ async function saveEdit() {
<span v-if="resolvingManually" class="inline-block w-3 h-3 border-2 border-orange-400 border-t-transparent rounded-full animate-spin mr-1"></span> <span v-if="resolvingManually" class="inline-block w-3 h-3 border-2 border-orange-400 border-t-transparent rounded-full animate-spin mr-1"></span>
{{ resolvingManually ? 'Сохраняем...' : '&#10003; Решить вручную' }} {{ resolvingManually ? 'Сохраняем...' : '&#10003; Решить вручную' }}
</button> </button>
<button v-if="task.status === 'done' && task.project_deploy_command" <button v-if="task.status === 'done' && (task.project_deploy_command || task.project_deploy_runtime)"
@click.stop="runDeploy" @click.stop="runDeploy"
:disabled="deploying" :disabled="deploying"
class="px-4 py-2 text-sm bg-teal-900/50 text-teal-400 border border-teal-800 rounded hover:bg-teal-900 disabled:opacity-50"> class="px-4 py-2 text-sm bg-teal-900/50 text-teal-400 border border-teal-800 rounded hover:bg-teal-900 disabled:opacity-50">