test(infra): integration phantom column gate (#197) #216
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#216
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/197-test-infra-gate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
geom_3857PR #196 +units_countPR #213, оба пойманные вручную на code review)EXPLAIN-тестов (READONLY) против real Postgres schema через SSH-tunneledlocalhost:15432phantom_check_session: создаёт временную schematest_phantom_<random>черезpg_dump --schema-only, гарантированный teardownDROP SCHEMA CASCADE(schema_created flag tracking — fix code-reviewer concern)pg_dumpнедоступен — work inpublic(EXPLAIN safe)pytest.mark.skipif(not TEST_DATABASE_URL)— без env var все 12 SKIPPEDCoverage (12 queries)
domrf_kn_objectsgeom_3857PR #196ekburg_construction_permitsunits_countPR #213mv_layout_velocitydomrf_kn_flatsobjective_*cad_*_geomFiles
backend/tests/integration/__init__.py(NEW, empty)backend/tests/integration/conftest.py(+155) — fixture + skipif markerbackend/tests/integration/test_phantom_columns.py(+379) — 12 testsbackend/pyproject.toml(+1) — pytest markerintegrationTest plan
pytest tests/integration/)total_area_sqm→units_countв test#4 → expect:column "units_count" does not existPre-push checks
Follow-up
Closes #197
Deep Code Review — verdict
Summary
1333792· Mergeable: true · Auto-merge scope: ALLOWED (tests-only)Schema verification
All 12 test queries verified against real DB. Zero phantom columns found.
domrf_kn_objects — all columns confirmed real:
ekburg_construction_permits — all columns confirmed real:
mv_layout_velocity (matview, confirmed via pg_attribute):
domrf_kn_flats — obj_id, total_area, rooms, is_studio, flat_type, price_per_m2, status, snapshot_date — all real
objective_complex_mapping — domrf_obj_id, objective_complex_name — real
objective_corpus_room_month — deals_total_vol_m2, deals_total_count, report_month, project_name — real
cad_parcels_geom (VIEW) — cad_num, geom — real
cad_quarters_geom — cad_number, geom — real
Note: m.obj_id in test_objective_corpus_room_month_columns resolves from derived subquery alias (cm.domrf_obj_id AS obj_id), not from objective_corpus_room_month directly. Correct SQL.
Fixture safety
DML / side-effect check
Credentials check
No hardcoded passwords, tokens, or secrets. Credentials flow exclusively through os.environ.get("TEST_DATABASE_URL", "") (line 31).
pyproject.toml change
One line only: integration marker appended to [tool.pytest.ini_options].markers (line 86). No other changes.
Skip logic
requires_test_db = pytest.mark.skipif(not _TEST_DATABASE_URL, ...) at module level in conftest.py (line 36). Applied as pytestmark = [...] at module level in test file (lines 32-35). All 12 tests inherit it and skip cleanly when TEST_DATABASE_URL absent. Additional pytest.skip() guard inside fixture body (line 96) as belt-and-suspenders.
Cross-file impact
No modifications to existing test files. No backend/tests/conftest.py at root tests level (does not exist). New files only. No fixture name collisions.
Minor observations (non-blocking)
Recommended next steps
No blocking issues. Merge.
Optional follow-up (separate PR): replace db_url.replace with proper URL parsing for pg_dump invocation.
Auto-merge policy
ALLOWED — all changes under backend/tests/** and backend/pyproject.toml. Not in blocked-scope list. APPROVE + ALLOWED — merging.