Files
roboco/docs/backend/qa/ci-e2e-smoke-fix-embedding-dimension.md
T
ec6558e168 [2a86d1f5] CI-watch: fix the CI regression on roboco-api (#563)
* [e530aa5e] Diagnose and fix roboco-api CI failure (run 29629255153) (#561) (#562)

* [e530aa5e] fix(tests): narrow None before indexing validate_init_data() result in telegram_initdata self-check

CI run 29629255153 failed on mypy, not the historical pydantic-settings
issue (uv.lock already pins 2.14.2). The __main__ self-check block in
test_telegram_initdata.py indexed the dict[str, object] | None return
of validate_init_data() without narrowing away None first.

* [e530aa5e] docs(qa): document CI fix for mypy type narrowing in telegram_initdata test

Explains the root cause (mypy type error in __main__ block), the solution (None narrowing before indexing), and the safe pattern for future test self-checks that call functions returning optional types.

---------

Co-authored-by: Backend Developer 1 <be-dev-1@roboco.tech>
Co-authored-by: Backend Documenter <be-doc@roboco.tech>

* [0884b737] Diagnose and fix Python quality gate + e2e lifecycle smoke CI failures on PR #563 (#564) (#565)

* [0884b737] fix(tests): isolate ROBOCO_SDK_URL for scripted e2e-smoke agents

tests/e2e_smoke/harness.py already isolates ROBOCO_AGENT_TOKEN from the
host environment (the #503/#504 fix) but left ROBOCO_SDK_URL leaking
through. flow_server/do_server both default it to
http://localhost:9000 and forward every rejection there for the
per-verb circuit breaker; inside a real spawned agent container that
port is a live SDK loopback, so the breaker records genuine attempts
for the ephemeral test-agent IDs and trips circuit_open mid-test
(test_sandbox_on_demand.py::test_request_sandbox_guard_chain_over_real_api,
which deliberately causes 3 rejections in a row). Point it at a
guaranteed-refused loopback address so every environment gets the same
fail-open bypass a bare CI runner already gets by having nothing
listening on 9000 at all.

* [0884b737] docs(changelog): document e2e-smoke harness ROBOCO_SDK_URL isolation fix

Document the fix that isolates ROBOCO_SDK_URL in the ScriptedAgent harness to prevent the per-verb circuit breaker from leaking state into ephemeral test-agent identities when the e2e-smoke suite runs inside a live agent container. This ensures the suite passes consistently regardless of whether it runs on bare CI or inside a spawned agent.

---------

Co-authored-by: Backend Developer 1 <be-dev-1@roboco.tech>
Co-authored-by: Backend Documenter <be-doc@roboco.tech>

* [3b9a1771] Diagnose and fix ALL make quality + e2e-smoke stage failures on PR #563; confirm real CI green (round 3) (#566) (#567)

* [3b9a1771] fix(e2e-smoke): match real embedding dimension when seeding fake journal chunk

test_c3_deleted_journal_unindexed inserted a 4-dim placeholder vector
into chunks_journals, but the e2e stack's app lifespan eagerly creates
that table with the real settings.embedding_dimensions (1024) before
the test runs, so the insert failed with "expected 1024 dimensions,
not 4". Derive _SMOKE_DIM from settings.embedding_dimensions instead
of a hardcoded constant so the seeded vector always matches the
table's actual column width.

* [3b9a1771] docs(qa): document e2e-smoke embedding dimension fix in round 3 CI diagnosis

Recorded the root cause, solution, and pattern for the final e2e-smoke test failure found in comprehensive sandbox testing: the test seeded a 4-dim placeholder vector but the app's eager lifespan init created chunks_journals with the real 1024-dim embedding column. Updated _SMOKE_DIM to derive from settings.embedding_dimensions instead of a hardcoded constant.

---------

Co-authored-by: Backend Developer 1 <be-dev-1@roboco.tech>
Co-authored-by: Backend Documenter <be-doc@roboco.tech>

---------

Co-authored-by: Backend Developer 1 <be-dev-1@roboco.tech>
Co-authored-by: Backend Documenter <be-doc@roboco.tech>
2026-07-18 16:13:47 +02:00

56 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CI Fix: E2E Smoke Test Embedding Dimension Mismatch
**Round 3 — Resolved**
## Root Cause
The e2e smoke test `test_data_integrity.py::test_c3_deleted_journal_unindexed` was seeding a 4-dimensional placeholder vector into `chunks_journals`, but the e2e stack's app lifespan eagerly initializes every OptimalService plugin (including JOURNALS) at startup, which creates that table with the **real configured embedding dimension** (1024, from `settings.embedding_dimensions`) before the test ever runs. The insert failed with:
```
asyncpg.exceptions.DataError: expected 1024 dimensions, not 4
```
The test's own comment ("the table is created fresh per run") was stale: the app doesn't create it fresh on each test, it eagerly creates it once at startup.
## Solution Applied
Changed `_SMOKE_DIM` from a hardcoded constant to derive from the real runtime configuration:
```python
# Before
_SMOKE_DIM = 4 # tiny embedding dim — the table is created fresh per run
# After
_SMOKE_DIM = settings.embedding_dimensions
```
Now the seeded placeholder vector always matches the table's actual column width, regardless of the configured embedding dimension.
## Impact
- **Scope:** Test infrastructure only (e2e smoke test)
- **Risk:** Minimal — single constant reference change in the test module
- **Behavior:** No change to the code under test; the e2e module itself is unaffected
- **Verification:** Provisioned real postgres+redis sandbox matching `.github/workflows/e2e-smoke.yml`, ran full `make e2e-smoke` suite (51 tests), all passed
## Pattern
For future e2e smoke tests that seed placeholder data into a schema initialized at app startup, source placeholder dimensions from the runtime settings, not hardcoded constants:
```python
from roboco.config import settings
# Correct: placeholder always matches runtime schema
placeholder_dim = settings.embedding_dimensions
```
Do not assume the schema is created fresh per test — eager initialization hooks may create it once at app startup, before any individual test runs.
## Session Summary
Round 3 comprehensively diagnosed every failing CI stage:
- All 14 `make quality` stages were already clean
- The sole real failure was this e2e-smoke embedding-dimension bug
- All code-level failures from rounds 12 (mypy regression, SDK URL isolation) were already fixed
- This final fix clears both the Python quality gate and e2e lifecycle smoke checks for PR #566