Add local self-test flow and fix fallback regressions
build-push / docker (push) Successful in 4m15s

This commit is contained in:
AI Assistant
2026-03-13 18:09:32 +09:00
parent f968458c5c
commit 6f3149a443
7 changed files with 373 additions and 69 deletions
+48 -3
View File
@@ -1,5 +1,43 @@
# AI Media Hub Handover
## Working Rule
- From this point on, every meaningful change should be appended to this file so the next handoff can reconstruct:
- what changed
- why it changed
- how it was verified
- what remains risky
- Treat this file as both backlog and handover log, not just a static TODO list.
## Current Session Update (2026-03-13)
- Added a local self-test workflow before push/container build:
- `scripts/selftest.sh`
- `scripts/mock_searxng.py`
- Fixed Korean query translation fallback behavior:
- If `GEMINI_API_KEY` is missing or Gemini translation fails, the code now still attempts Google Translate fallback.
- If Google Translate fallback fails, dictionary replacement fallback still runs.
- Added Go tests for translation fallback logic.
- Fixed frontend HLS preview wiring:
- `hls.js` is now loaded in `frontend/index.html`
- frontend now tries `hls.js` first, then native HLS playback if available
- Corrected the practical local verification note:
- `go build ./backend` from repo root conflicts with the existing `backend/` directory name
- verified build command is now treated as `go build -o /tmp/... ./backend`
## Local Self-Test Workflow
- Primary command:
- `bash scripts/selftest.sh`
- What it currently verifies:
- Go formatting for touched backend files
- Python syntax for worker + mock SearXNG
- `go test ./...`
- backend binary build
- local app boot with temp SQLite/download dirs
- `/healthz`
- `/api/search` using a local mock SearXNG server
- `/api/upload`
- Purpose:
- allow safe local regression checks before push or container build without depending on real SearXNG, Gemini, or browser interaction
## Project Summary
- Project: `ai-media-hub`
- Goal: AI-assisted media discovery + ingest dashboard for Unraid
@@ -106,6 +144,8 @@
- Search relevance is still not considered stable enough.
- Gemini batch evaluation exists, but search quality can still degrade if upstream SearXNG results are noisy.
- Frontend JavaScript was not linted with Node tooling in this environment because `node` is not installed here.
- Full browser-level preview validation is still not covered by the local self-test script.
- Search cards still render recommendation reason text, not a robust asset description/snippet mapping.
## Frontend Debug Logger
- UI button: bottom-right `Logs`
@@ -173,12 +213,17 @@
- [ ] Envato / Artgrid preview extraction hardening
- [ ] Search result relevance validation against real user queries
- [ ] Better matching between rendered description and actual linked asset
- [ ] Add browser-level verification for preview/HLS behavior
- [ ] Add more automated coverage for search ranking / filtering logic
- [ ] Add proper frontend build/lint step if Node becomes available
## Verified Locally In This Environment
- [x] `go build ./backend`
- [x] Python syntax check for worker at various stages
- [x] basic server boot / `/healthz` at various stages
- [x] `go build -o /tmp/ai-media-hub ./backend`
- [x] `go test ./...` (currently no broad test suite beyond the added fallback tests)
- [x] Python syntax check for worker + self-test helper
- [x] local app boot / `/healthz` through `scripts/selftest.sh`
- [x] local `/api/search` against mock SearXNG through `scripts/selftest.sh`
- [x] local `/api/upload` through `scripts/selftest.sh`
- [ ] full browser-level validation was not fully reproducible in this environment
## Short Handover Summary