From 306eee3a21cab8f4f375588f9485467a6642b551 Mon Sep 17 00:00:00 2001 From: aecsocket Date: Wed, 21 Jan 2026 16:12:21 +0000 Subject: [PATCH] Fix changing Delphi report issue detail verdict if already exists (#5172) * Fix changing Delphi report issue detail verdict if already exists * cargo sqlx prepare --- ...e721b955fc4f2a4d4ac196611bc8d6b04706.json} | 4 ++-- .../routes/internal/moderation/tech_review.rs | 2 ++ docker-compose.yml | 23 +++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) rename apps/labrinth/.sqlx/{query-cfe6c9e2abba8e9c1cd7aa799a6a95f2732f1a7611ea6f7ce49cd7e077761ebf.json => query-b767ca57e4d8abf164a951ce77f1e721b955fc4f2a4d4ac196611bc8d6b04706.json} (79%) diff --git a/apps/labrinth/.sqlx/query-cfe6c9e2abba8e9c1cd7aa799a6a95f2732f1a7611ea6f7ce49cd7e077761ebf.json b/apps/labrinth/.sqlx/query-b767ca57e4d8abf164a951ce77f1e721b955fc4f2a4d4ac196611bc8d6b04706.json similarity index 79% rename from apps/labrinth/.sqlx/query-cfe6c9e2abba8e9c1cd7aa799a6a95f2732f1a7611ea6f7ce49cd7e077761ebf.json rename to apps/labrinth/.sqlx/query-b767ca57e4d8abf164a951ce77f1e721b955fc4f2a4d4ac196611bc8d6b04706.json index dc84840d..016b67f6 100644 --- a/apps/labrinth/.sqlx/query-cfe6c9e2abba8e9c1cd7aa799a6a95f2732f1a7611ea6f7ce49cd7e077761ebf.json +++ b/apps/labrinth/.sqlx/query-b767ca57e4d8abf164a951ce77f1e721b955fc4f2a4d4ac196611bc8d6b04706.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO delphi_issue_detail_verdicts (\n project_id,\n detail_key,\n verdict\n )\n SELECT\n didws.project_id,\n didws.key,\n $1\n FROM delphi_issue_details_with_statuses didws\n INNER JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n WHERE\n didws.id = $2\n -- see delphi.rs todo comment\n AND dri.issue_type != '__dummy'\n ", + "query": "\n INSERT INTO delphi_issue_detail_verdicts (\n project_id,\n detail_key,\n verdict\n )\n SELECT\n didws.project_id,\n didws.key,\n $1\n FROM delphi_issue_details_with_statuses didws\n INNER JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n WHERE\n didws.id = $2\n -- see delphi.rs todo comment\n AND dri.issue_type != '__dummy'\n ON CONFLICT (project_id, detail_key)\n DO UPDATE SET verdict = EXCLUDED.verdict\n ", "describe": { "columns": [], "parameters": { @@ -22,5 +22,5 @@ }, "nullable": [] }, - "hash": "cfe6c9e2abba8e9c1cd7aa799a6a95f2732f1a7611ea6f7ce49cd7e077761ebf" + "hash": "b767ca57e4d8abf164a951ce77f1e721b955fc4f2a4d4ac196611bc8d6b04706" } diff --git a/apps/labrinth/src/routes/internal/moderation/tech_review.rs b/apps/labrinth/src/routes/internal/moderation/tech_review.rs index c4f4cd9f..3197f5ed 100644 --- a/apps/labrinth/src/routes/internal/moderation/tech_review.rs +++ b/apps/labrinth/src/routes/internal/moderation/tech_review.rs @@ -1176,6 +1176,8 @@ async fn update_issue_detail( didws.id = $2 -- see delphi.rs todo comment AND dri.issue_type != '__dummy' + ON CONFLICT (project_id, detail_key) + DO UPDATE SET verdict = EXCLUDED.verdict "#, status as _, issue_detail_id as _, diff --git a/docker-compose.yml b/docker-compose.yml index d02b3a0d..10820d25 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,8 +12,9 @@ services: POSTGRES_USER: labrinth POSTGRES_PASSWORD: labrinth POSTGRES_HOST_AUTH_METHOD: trust + PGUSER: labrinth healthcheck: - test: [ 'CMD', 'pg_isready', '-U', 'labrinth' ] + test: ['CMD', 'pg_isready', '-U', 'labrinth'] interval: 3s timeout: 5s retries: 3 @@ -32,7 +33,7 @@ services: MEILI_HTTP_PAYLOAD_SIZE_LIMIT: 107374182400 MEILI_LOG_LEVEL: warn healthcheck: - test: [ 'CMD', 'curl', '--fail', 'http://localhost:7700/health' ] + test: ['CMD', 'curl', '--fail', 'http://localhost:7700/health'] interval: 3s timeout: 5s retries: 3 @@ -45,7 +46,7 @@ services: volumes: - redis-data:/data healthcheck: - test: [ 'CMD', 'redis-cli', 'PING' ] + test: ['CMD', 'redis-cli', 'PING'] interval: 3s timeout: 5s retries: 3 @@ -58,7 +59,7 @@ services: CLICKHOUSE_USER: default CLICKHOUSE_PASSWORD: default healthcheck: - test: [ 'CMD-SHELL', 'clickhouse-client --query "SELECT 1"' ] + test: ['CMD-SHELL', 'clickhouse-client --query "SELECT 1"'] interval: 3s timeout: 5s retries: 3 @@ -71,7 +72,14 @@ services: environment: MP_ENABLE_SPAMASSASSIN: postmark healthcheck: - test: [ 'CMD', 'wget', '-q', '-O/dev/null', 'http://localhost:8025/api/v1/info' ] + test: + [ + 'CMD', + 'wget', + '-q', + '-O/dev/null', + 'http://localhost:8025/api/v1/info', + ] interval: 3s timeout: 5s retries: 3 @@ -122,7 +130,8 @@ services: LABRINTH_ENDPOINT: http://host.docker.internal:8000/_internal/delphi/ingest LABRINTH_ADMIN_KEY: feedbeef healthcheck: - test: [ 'CMD', 'wget', '-q', '-O/dev/null', 'http://localhost:59999/health' ] + test: + ['CMD', 'wget', '-q', '-O/dev/null', 'http://localhost:59999/health'] interval: 3s timeout: 5s retries: 3 @@ -153,7 +162,7 @@ services: MEILI_HTTP_PAYLOAD_SIZE_LIMIT: 107374182400 MEILI_LOG_LEVEL: warn healthcheck: - test: [ 'CMD', 'curl', '--fail', 'http://localhost:7700/health' ] + test: ['CMD', 'curl', '--fail', 'http://localhost:7700/health'] interval: 3s timeout: 5s retries: 3