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
+19 -7
View File
@@ -1,8 +1,9 @@
---
description: "SnapOtter 的本機開發環境設定、指令、程式碼慣例,以及如何新增工具。"
i18n_source_hash: cb03724d2829
i18n_provenance: human
i18n_output_hash: 64a00be99b89
i18n_source_hash: 56acc1bf9a9b
i18n_provenance: machine
i18n_output_hash: d94d76633902
i18n_hash_version: 2
---
# 開發者指南 {#developer-guide}
@@ -11,12 +12,12 @@ i18n_output_hash: 64a00be99b89
## 先決條件 {#prerequisites}
- [Node.js](https://nodejs.org/) 22+
- [Node.js](https://nodejs.org/) 22.22+
- [pnpm](https://pnpm.io/) 9+`corepack enable && corepack prepare pnpm@latest --activate`
- [Docker](https://www.docker.com/)(本機 Postgres + Redis、容器建置與 AI 功能所必需)
- Git
只有在你要處理 AI/ML 附屬程序(去背、放大、OCR)時,才需要 Python 3.10+。
只有在你要處理 AI/ML 附屬程序(去背、放大、OCR)時,才需要 Python 3.11+。
## 設定 {#setup}
@@ -32,10 +33,10 @@ pnpm dev
| 服務 | URL | 說明 |
|----------|--------------------------|------------------------------------|
| 前端 | http://localhost:1349 | Vite 開發伺服器,代理 /api |
| 前端 | http://localhost:1351 | Vite 開發伺服器,代理 /api |
| 後端 | http://localhost:13490 | Fastify API(透過代理存取) |
在瀏覽器中開啟 http://localhost:1349。以 `admin` / `admin` 登入。你會在首次登入時被提示變更密碼。
在瀏覽器中開啟 http://localhost:1351。以 `admin` / `admin` 登入。你會在首次登入時被提示變更密碼。
## 專案結構 {#project-structure}
@@ -220,6 +221,17 @@ docker build -f docker/Dockerfile -t snapotter:latest .
DOCKER_BUILDKIT=1 docker build -f docker/Dockerfile -t snapotter:latest .
```
## 發布版本域 {#release-version-domains}
SnapOtter 有意有三個版本域。發佈期間請勿將一個網域複製到另一個網域:
- 應用程式發布版本涵蓋根清單、所有私人工作區包和 `APP_VERSION`。 Semantic-release 提供此值,`pnpm version:sync <version>` 在應用程式發布之前更新每個工作區。
- OpenAPI `info.version` 是穩定的公開 API-主力合約。所有本地化規範都保留在 `<major>.0.0` 上以實現相容的應用程式版本,並且僅當 API 合約轉移到新的主要版本時才會更改。
- `docker/feature-manifest.json` 保留 `imageVersion: 2.0.0` 作為不可變的舊功能包儲存時代。這些 v2 存檔路徑不是應用程式套件版本。準確的 OCR 使用運行時格式 v3 並單獨記錄其應用程式發布來源。
`tests/unit/infra/release-version-policy.test.ts` 強制執行這些邊界。新版本的網域或遷移必須一起更新該合約和相關的工件遷移設計。
獨立的 API 和舊套件值位於 `config/release-version-policy.json` 中;應用程式版本同步絕對不能隱含重寫該原則檔。
## 環境變數 {#environment-variables}
完整清單請見[設定指南](/zh-TW/guide/configuration)。開發時的關鍵變數: