# Background Tasks (`/processing`) — E2E notes **Date:** 2026-08-04 **App:** Descrybe v2 web `http://127.0.0.1:5174` + API `http://127.0.0.1:8080` + worker **Tenant:** `demo@descrybe.local` → **Platform Demo** (not A1; see [safe-test-fixtures.md](safe-test-fixtures.md)) **LLM:** Green Chat via `OPENAI_BASE_URL` / `OPENAI_API_KEY` / `OPENAI_MODEL` in `root `.env` / `/integrations/ai`` — or local stub ([mock-llm.md](mock-llm.md)) for CI/dev without production keys ## What `/processing` does - Nav label: **Background Tasks** - Lists recent `processing_jobs` for the active company (poll every 5s while tab visible) - Shows status, per-step badges (`normalize` → … → `ai_enhance`), product progress, start/complete times - Actions: **Terminate** (pending/running), **Retry** (failed/cancelled/completed) Legacy aliases (SSR 307 → `/processing`): | Path | Redirect | |------|----------| | `/tasks` | `/processing` | | `/dashboard/tasks` | `/processing` (`hooks.server.ts`) | ## Verified matrix (this run) | Check | Result | Notes | |-------|--------|-------| | Login demo | **PASS** | Browser session on `:5174` | | `GET /api/processing/jobs` | **PASS** | Shape `{ jobs: [...] }` | | Create `normalize_only` | **PASS** | HTTP 202, `status=pending` | | Cancel job | **PASS** | HTTP 200; `status=cancelled`; incomplete steps marked `cancelled` | | Create `enhance_only` + Green Chat | **PASS** | ~1s; `normalize`+`ai_enhance` → `done`; product description rewritten | | UI table progress / badges | **PASS** | Completed green; Cancelled grey; progress `1/1` / `0/1` | | `/tasks` SSR redirect | **PASS** | 307 `Location: /processing` | | Console / failed requests on page | **PASS** | 0 errors after login | Sample enhance job: `045b3d15-…` → `completed`, steps both `done`. Sample cancelled job: `56c0bcee-…` → `step_progress[0].status=cancelled`. ## Fixes applied this pass 1. **Cancel step progress** — `CancelJob` now marks pending/running steps as `cancelled` in `step_progress` (was left `pending`, confusing the UI). 2. **Terminate button alignment** — UI only offers Terminate for `pending`/`running` (matches API). 3. **Cancelled step display** — client coerces stale pending steps on cancelled jobs. 4. **SSR `/tasks` redirect** — replaced client `onMount` goto + universal `PageLoad` with `+page.server.ts` 307 (no client flash). 5. **Layout dark-class effect** — guard with `browser` before touching `document`. ## How to retest quickly ```powershell # API must be up; worker must inherit OPENAI_* from root `.env` / `/integrations/ai` Test-NetConnection 192.168.50.181 -Port 8767 # After CSRF + login cookie jar: # POST /api/processing/jobs {"raw_product_ids":["…"],"processing_type":"enhance_only"} # POST /api/processing/jobs/{id}/cancel # GET /api/processing/jobs/{id} # poll until completed # UI: http://127.0.0.1:5174/processing (not :3000 — that is Descrybe v1 Next) ``` Cookie jar used locally: `artifacts/processing-smoke-cookies.txt` (local only). ## Related - [green-chat-smoke.md](green-chat-smoke.md) — LAN Green Chat + prior enhance smoke - [ai-full-smoke.md](ai-full-smoke.md) — broader AI matrix - [green-chat-llm.md](green-chat-llm.md) — wiring guide