Fix 5 QA nits: dead code, N+1 query, dep hygiene, k8s hardening #136

Merged
forgejo_admin merged 1 commit from 135-qa-nits-dead-code-n1-dep-k8s into main 2026-03-09 14:00:28 +00:00

Summary

Addresses 5 actionable QA nits from the PR #130 review. Cleanup only -- no changes to core worker logic.

Changes

  • src/pal_e_docs/embedding_worker.py: Use EMBEDDABLE_TYPES constant in block filtering query (IN %s replaces != 'mermaid'), remove redundant set_isolation_level call in reconnection path (already handled by _connect()), fix N+1 note title query by adding a correlated subquery to the RETURNING clause (eliminates per-block SELECT)
  • pyproject.toml: Remove duplicate httpx>=0.27 from [project.optional-dependencies] dev (already in main dependencies)
  • k8s/embedding-worker.yaml: Add terminationGracePeriodSeconds: 60 to pod spec for graceful shutdown
  • tests/test_embedding.py: Add 3 tests validating EMBEDDABLE_TYPES constant (coverage, mermaid exclusion, guard against drift)

Test Plan

  • Tests pass locally: pytest tests/ -k test_embedding -v -- 23 passed (20 existing + 3 new)
  • Ruff lint and format pass
  • No core worker logic changed
$ pytest tests/ -k test_embedding -v
23 passed, 579 deselected, 23 warnings in 0.32s

Review Checklist

  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #135
  • Parent PR: #130 (6c: async embedding pipeline)
  • plan-2026-02-26-tf-modularize-postgres -- Phase 6c-2
## Summary Addresses 5 actionable QA nits from the PR #130 review. Cleanup only -- no changes to core worker logic. ## Changes - `src/pal_e_docs/embedding_worker.py`: Use `EMBEDDABLE_TYPES` constant in block filtering query (`IN %s` replaces `!= 'mermaid'`), remove redundant `set_isolation_level` call in reconnection path (already handled by `_connect()`), fix N+1 note title query by adding a correlated subquery to the `RETURNING` clause (eliminates per-block SELECT) - `pyproject.toml`: Remove duplicate `httpx>=0.27` from `[project.optional-dependencies] dev` (already in main `dependencies`) - `k8s/embedding-worker.yaml`: Add `terminationGracePeriodSeconds: 60` to pod spec for graceful shutdown - `tests/test_embedding.py`: Add 3 tests validating `EMBEDDABLE_TYPES` constant (coverage, mermaid exclusion, guard against drift) ## Test Plan - [x] Tests pass locally: `pytest tests/ -k test_embedding -v` -- 23 passed (20 existing + 3 new) - [x] Ruff lint and format pass - [x] No core worker logic changed ``` $ pytest tests/ -k test_embedding -v 23 passed, 579 deselected, 23 warnings in 0.32s ``` ## Review Checklist - [x] No secrets committed - [x] No unnecessary file changes - [x] Commit messages are descriptive ## Related - Closes #135 - Parent PR: #130 (6c: async embedding pipeline) - `plan-2026-02-26-tf-modularize-postgres` -- Phase 6c-2
Fix 5 QA nits from PR #130 review
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
bb7c21d184
- Use EMBEDDABLE_TYPES constant in block filtering (IN clause replaces != 'mermaid')
- Remove redundant set_isolation_level in reconnection path (_connect already sets it)
- Fix N+1 note title query with correlated subquery in RETURNING clause
- Remove duplicate httpx from dev dependencies (already in main deps)
- Add terminationGracePeriodSeconds: 60 to embedding worker k8s deployment
- Add 3 tests for EMBEDDABLE_TYPES constant validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
forgejo_admin deleted branch 135-qa-nits-dead-code-n1-dep-k8s 2026-03-09 14:00:28 +00:00
Sign in to join this conversation.
No description provided.