fix: release QA hardening across processing, media, security, and CI gates (#649)

A release-readiness QA pass over the whole product. The commits split into
defects a user would hit and gates that were reporting green while measuring
nothing.

## Fixes that change behaviour

Rate limiting was bypassable on every install: TRUST_PROXY defaulted to true, so
request.ip came from a client-set header and a forged X-Forwarded-For got past
the login limiter. The default is now a private-network trust list.

A transient Postgres outage stranded in-flight jobs, leaving finished output on
disk with no row pointing at it. A reconciler now resolves those rows and adopts
the bytes rather than dropping the work.

A Redis connection that moved to a new address wedged every read-blocked
consumer, so completions stopped signalling while health still answered 200.
Socket timeouts plus subscriber pings recover it.

Installing more than one AI bundle left the shared venv multi-versioned and
silently broke three tools. The installer now reconciles distributions to one
version each.

Converting an image to JXL at quality 1 through 4 returned a 500, because
libjxl 0.7 rejects the distance those values compute. The quality is floored at
what the encoder honours. A missing ffmpeg was also reported to the user as a
corrupt upload; it now says the engine is unavailable.

RAW uploads reached an unpatched LibRaw on arm64, so it is built from source at
0.22.2, and the release scan was split so it can fail on an unfixed critical
instead of hiding it behind ignore-unfixed.

## Gates that could not fail

Two mutation lanes ran zero mutants because Stryker crawled the gitignored docs
build; coverage discarded its whole report on any failing test; the lint gate
skipped root tests, scripts, and two workspaces; and several generated matrices
counted a host missing ffmpeg as a passing tool. Each now measures what it
claims.

Full evidence and the outstanding release items are tracked locally and are not
part of this branch.
This commit is contained in:
SnapOtter
2026-07-27 15:37:30 +08:00
committed by GitHub
parent bc32f86a07
commit d10d0f544f
855 changed files with 54564 additions and 13092 deletions
+34 -14
View File
@@ -1,8 +1,9 @@
---
description: "SnapOtter için PostgreSQL veritabanı şeması, tablolar, migration'lar ve yedekleme prosedürleri."
i18n_source_hash: 50d5d4f220cf
i18n_provenance: human
i18n_output_hash: 1a738c4f269b
i18n_source_hash: a68264552836
i18n_provenance: machine
i18n_output_hash: 635a49df1d8b
i18n_hash_version: 2
---
# Veritabanı {#database}
@@ -145,6 +146,17 @@ Güvenlikle ilgili eylem günlüğü.
| `details` | jsonb | Eyleme özgü veri |
| `createdAt` | timestamp | Eylem zamanı |
### user_preferences {#user-preferences}
Kullanıcı başına arayüz durumu, tercih adına göre anahtarlanır. Ana sayfadaki sabitlenmiş araçları saklar; bunlar `PUT /api/v1/preferences` üzerinden yazılır.
| Sütun | Tür | Notlar |
|---|---|---|
| `userId` | text | users tablosuna FK, silmede CASCADE. `key` ile birlikte birincil anahtar |
| `key` | text | Tercihin adı. `userId` ile birlikte birincil anahtar |
| `value` | jsonb | Tercihin içeriği |
| `updatedAt` | timestamp | Son yazma zamanı |
## Migration'lar {#migrations}
Şema migration'larını Drizzle yürütür. Migration dosyaları `apps/api/drizzle/` dizininde bulunur. Geliştirme sırasında:
@@ -159,27 +171,35 @@ npx drizzle-kit migrate # apply pending migrations
## Yedekleme ve geri yükleme {#backup-and-restore}
İlişkisel veritabanı, uygulamanın `/data` volume'unda değil, Postgres container'ının `SnapOtter-pgdata` volume'unda bulunur.
İlişkisel veritabanı, uygulamanın `/data` biriminde değil, Postgres kapsayıcısının `SnapOtter-pgdata` biriminde bulunur.
**Seçenek 1: pg_dump (önerilen)**
**Doğrulama ile mantıksal yedekleme (önerilir)**
```bash
# Dump the database while the stack is running
docker exec SnapOtter-postgres pg_dump -U snapotter snapotter > backup.sql
# Dump into PostgreSQL's portable custom archive format
docker exec SnapOtter-postgres \
pg_dump --format=custom --no-owner -U snapotter snapotter > snapotter.dump
test -s snapotter.dump
docker exec -i SnapOtter-postgres pg_restore --list < snapotter.dump >/dev/null
# Restore into a fresh database
cat backup.sql | docker exec -i SnapOtter-postgres psql -U snapotter snapotter
# Restore into a fresh/disposable target first and fail on the first SQL error
docker exec -i SnapOtter-postgres \
pg_restore --exit-on-error --clean --if-exists --no-owner \
-U snapotter -d snapotter < snapotter.dump
```
**Seçenek 2: Volume anlık görüntüsü**
Bu veritabanı dökümü, `/data/files`'de veya Redis'te dayanıklı BullMQ durumunda kaydedilmiş kitaplık nesnelerini içermiyor. Bunları [Güvenlik ve Güçlendirme](/tr/guide/security#backup-and-recovery) bölümündeki koordineli prosedürle yedekleyin ve geri yükleyin.
**Soğuk hacim anlık görüntüsü**
```bash
# Stop the stack, then snapshot the pgdata volume
docker compose down
docker run --rm -v SnapOtter-pgdata:/data -v $(pwd)/backup:/backup \
alpine tar czf /backup/snapotter-pgdata.tar.gz -C /data .
# Stop every service first, then use your storage platform to snapshot the
# PostgreSQL, app-data, and Redis volumes as one crash-consistent set.
docker compose -f docker/docker-compose.yml stop
```
Canlı bir PostgreSQL veri dizinini `tar` ile kopyalamayın. Ön ek birim adlarını projeye göre oluşturun; bu nedenle, `SnapOtter-pgdata` değişmez etiketini varsaymak yerine, bağlı birim kimliklerini `docker inspect`'den veya depolama platformunuzdan çözümleyin.
### 1.x'ten (SQLite) geçiş {#migrating-from-1-x-sqlite}
SnapOtter 1.x'ten yükseltmenin kendi kılavuzu vardır: bkz. [1.x'ten 2.0'a Yükseltme](./upgrading). Kısacası, mevcut `/data` volume'unuzu yeniden kullanın; 2.0 ilk açılışta `/data/snapotter.db` dosyasını otomatik olarak algılayıp içe aktarır (ya da ona açıkça işaret etmesi için `SQLITE_MIGRATE_PATH` değerini ayarlayın). Önce yalnızca `snapotter.db` dosyasını değil, tüm `/data` volume'unu yedekleyin: 1.x SQLite WAL modunu kullanır, bu yüzden durdurulmuş bir container genellikle verilerinin çoğunu neredeyse boş bir `snapotter.db` dosyasının yanındaki `snapotter.db-wal` dosyasında bırakır.