Phase 6c-2: QA nits — dead code, N+1 query, dep hygiene, k8s hardening

phase-postgres-6c2-qa-nits Phase

Goal: Address 5 actionable QA nits from PR #130 review to bring the embedding worker to production quality.
Owner: Dev agent
Repo: forgejo_admin/pal-e-docs
Depends on: Phase 6c (PR #130 must merge first)

Problem

QA approved PR #130 with 7 nits. 2 are no-ops (hardcoded image tag is inherited pattern; health server binding 0.0.0.0 is standard k8s). 5 are actionable:

Fix

  • Nit 1: Dead code. EMBEDDABLE_TYPES constant defined at line 52 but never referenced. Either use it in the block filtering logic (replacing inline checks) or remove it. Prefer using it — it makes the filtering explicit and testable.
  • Nit 2: Redundant set_isolation_level. The reconnection path (line 523) calls conn.set_isolation_level() but _connect() already sets it. Remove the duplicate call in the reconnect path.
  • Nit 3: N+1 query for note titles. _fetch_pending_blocks does a per-block query to get the parent note title for heading context. At 5K blocks during backfill, this is 5K extra queries. Fix: batch the title lookup with a JOIN or a single query that fetches all needed note titles upfront.
  • Nit 4: Duplicate httpx dependency. httpx appears in both main deps (line 25) and dev deps (line 32) in pyproject.toml. Remove from dev deps — it's now a production dependency.
  • Nit 6: No terminationGracePeriodSeconds. The worker handles SIGTERM gracefully but k8s defaults to 30s before SIGKILL. Add explicit terminationGracePeriodSeconds: 60 to give the worker time to finish a batch and reset processing blocks to pending.
  • phase-postgres-6-vector-search — parent phase
  • phase-postgres-6c1-autoclose-enforcement — sibling subphase (also discovered during 6c)