test(etl): Wave 4E — real-data e2e + per-route latency regression#82
Merged
Conversation
Adds two slow-marker test files under a new ``tests/stackunderflow/integration/`` package: * ``test_etl_pipeline_e2e.py`` — builds a 10K-message synthetic store across 5 providers (claude, codex, cursor, gemini, cline) over 30 days × 20 projects, runs every registered Normalizer end-to-end, refreshes every mart, and asserts cost-conservation across all five marts. Then mounts the production routers behind a TestClient and hits every dashboard route asserting 200 + non-empty + <500ms. * ``test_route_perf_regression.py`` — parametrises every dashboard route against a pre-populated synthetic marts fixture (100K daily, 50K session, 1K project, 2K provider_day, 5K model_day rows) plus a small 1K-message set so aggregator-driven routes stay quick. Each route gets 1 warmup + 5 cold + 5 warm runs; max(warm) must beat the per-route budget. Prints a cold/warm/budget table to the log so future regressions can be calibrated from CI output alone. Both files are gated on the new ``slow`` pytest marker registered in ``pyproject.toml``. Default ``pytest tests/ -q`` keeps its 1474-test collection unchanged (11 slow tests deselected by ``addopts = "-m 'not slow'"``); run the integration suite explicitly with ``pytest -m slow tests/stackunderflow/integration -q``. ``/api/etl/status`` is listed for forward compatibility — the route isn't yet implemented in the current main, so the test accepts a 404 in lieu of a 200 (e2e) / pytest.skip (regression) until the route lands. Latency table from a recent dev-box run: projects_with_stats cold 5.8ms warm 5.8ms budget 100 dashboard_data cold 8.6ms warm 7.1ms budget 100 cost_data cold 12.1ms warm 11.9ms budget 100 cost_data_by_provider cold 1.4ms warm 1.1ms budget 50 compare cold 1.7ms warm 1.7ms budget 100 yield cold 1.3ms warm 1.2ms budget 200 optimize cold 81.9ms warm 100.7ms budget 200 messages_summary cold 1.8ms warm 1.6ms budget 50 Synthetic stores live in ``tmp_path`` — the user's real ``~/.stackunderflow/store.db`` is never touched. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0b36218 to
c34a329
Compare
0bserver07
added a commit
that referenced
this pull request
May 6, 2026
Bumps to 0.7.0. Consolidates the [Unreleased] CHANGELOG entries from the 11 ETL PRs (#72, #73, #74, #75, #76, #79, #81, #80, #78, #77, #82) into a single [0.7.0] section. New: docs/HANDOFF.md — state-of-the-codebase walkthrough for incoming agents. Architecture map, recent history, key gotchas, what's left, files-to-read-first. End-state on the maintainer's real store: 150,337 usage_events Marts populated and watermarks in sync Dashboard cold-load 2.5s → <50ms warm Watcher 155ms end-to-end source-file-write → dashboard-data-fresh 1598 backend tests passing, 2 skipped, 11 deselected (slow suite). Frontend typecheck + build clean. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two slow-marker test files under a new
tests/stackunderflow/integration/package and registers aslowpytest marker (opt-in viapytest -m slow; defaultpytest tests/ -qkeeps the existing 1474-test collection untouched).test_etl_pipeline_e2e.py— builds a 10K-message synthetic store across 5 providers (claude/codex/cursor/gemini/cline) over 30 days × 20 projects, runs every registeredNormalizerend-to-end, refreshes every mart, asserts cost conservation across daily/session/project/provider_day/model_day, then sweeps every dashboard route via FastAPI'sTestClientasserting 200 + non-empty + <500ms.test_route_perf_regression.py— parametrises every dashboard route against a pre-populated marts fixture (100K daily / 50K session / 1K project / 2K provider_day / 5K model_day rows) plus a small 1K-message set so aggregator-driven routes stay tight. Each route runs 1 warmup + 5 cold + 5 warm requests;max(warm)must beat the per-route budget.pyproject.toml— new[tool.pytest.ini_options]section registers theslowmarker and addsaddopts = "-m 'not slow'"so the default suite skips the slow tests automatically. Run the new suite withpytest -m slow./api/etl/statusis listed for forward compatibility — the route isn't implemented yet onmain, so the test accepts a 404 (e2e) /pytest.skip(regression) until the endpoint lands.Latency table (dev box, M-series, Python 3.12)
Test counts
pytest tests/ -q→ 1472 passed, 2 skipped, 11 deselected (slow tests). Total collection 1474 — matches baseline.pytest -m slow tests/stackunderflow/integration -q→ 10 passed, 1 skipped (the/api/etl/statusplaceholder).Test plan
pytest -m slow tests/stackunderflow/integration -q— 10 passed + 1 skipped (etl_status placeholder).pytest tests/ -q— 1472 passed + 2 skipped + 11 deselected (unchanged from baseline).ruff check tests/stackunderflow/integration/— all checks passed.pyproject.tomlmarker config + CHANGELOG.🤖 Generated with Claude Code