From 7489ad771e49fe6310b4c32d09e7a6bfd555c4e5 Mon Sep 17 00:00:00 2001 From: Daniel Rosel Date: Sun, 11 Jan 2026 20:25:36 +0100 Subject: [PATCH] chore: cleaning --- Makefile | 62 +++++++++++++++++++++++------------- tests/e2e/config/__init__.py | 1 - tests/e2e/config/pricing.py | 53 ------------------------------ tests/e2e/config/settings.py | 36 --------------------- 4 files changed, 39 insertions(+), 113 deletions(-) delete mode 100644 tests/e2e/config/__init__.py delete mode 100644 tests/e2e/config/pricing.py delete mode 100644 tests/e2e/config/settings.py diff --git a/Makefile b/Makefile index 8b22b38..d2d2d7f 100644 --- a/Makefile +++ b/Makefile @@ -11,56 +11,72 @@ PYTEST := $(VENV)/bin/pytest .DEFAULT_GOAL := help -all: pdf - -run.webapp: - @cd web && npm install && npm run dev +.PHONY: help +help: + @echo "pdf.build pdf.watch pdf.clean | test.backend test.e2e test.all | web.dev | install | stats.lines" $(BUILDDIR): mkdir -p paper/$(BUILDDIR) -pdf: $(BUILDDIR) - @echo "Concatenating source code..." +.PHONY: pdf.build +pdf.build: $(BUILDDIR) @bash paper/concat_code.sh @cd $(SRCDIR) && \ $(LATEXMK) -pdf -jobname=$(JOBNAME) \ -interaction=nonstopmode -file-line-error \ -outdir=../$(BUILDDIR) $(TEX) -watch: $(BUILDDIR) +.PHONY: pdf.watch +pdf.watch: $(BUILDDIR) @cd $(SRCDIR) && \ $(LATEXMK) -pvc -pdf -jobname=$(JOBNAME) \ -interaction=nonstopmode -file-line-error \ -r ../.latexmkrc \ -outdir=../$(BUILDDIR) $(TEX) -clean: +.PHONY: pdf.clean +pdf.clean: @cd $(SRCDIR) && \ $(LATEXMK) -C -jobname=$(JOBNAME) -outdir=../$(BUILDDIR) || true rm -rf paper/$(BUILDDIR)/* +.PHONY: test.backend +test.backend: $(VENV) + $(PYTEST) -v + +.PHONY: test.e2e +test.e2e: + @cd tests/e2e && npm install + @cd tests/e2e && npx playwright install chromium + @timeout 30 bash -c 'until curl -sf http://localhost:5000/health > /dev/null 2>&1; do sleep 1; done' || (echo "Backend not ready" && exit 1) + @timeout 30 bash -c 'until curl -sf http://localhost:3000 > /dev/null 2>&1; do sleep 1; done' || (echo "Web app not ready" && exit 1) + @cd tests/e2e && npm test + +.PHONY: test.all +test.all: test.backend test.e2e + +.PHONY: web.dev +web.dev: + @cd web && npm install && npm run dev + $(VENV): python3 -m venv $(VENV) $(PIP) install --upgrade pip +.PHONY: install install: $(VENV) $(PIP) install -r requirements.txt -test: $(VENV) - $(PYTEST) -v - -count-lines: +.PHONY: stats.lines +stats.lines: @find . \( -path '*/node_modules' -o -path '*/.venv' -o -path '*/venv' \) -prune -o \ \( -name "*.ts" -o -name "*.py" \) -type f -print0 | xargs -0 cat | wc -l -test.e2e: - @echo "Installing E2E dependencies..." - @cd tests/e2e && npm install - @cd tests/e2e && npx playwright install chromium --with-deps - @echo "Waiting for services..." - @timeout 30 bash -c 'until curl -sf http://localhost:5000/health > /dev/null 2>&1; do sleep 1; done' || (echo "Backend not ready" && exit 1) - @timeout 30 bash -c 'until curl -sf http://localhost:3000 > /dev/null 2>&1; do sleep 1; done' || (echo "Web app not ready" && exit 1) - @echo "Running E2E tests..." - @cd tests/e2e && npm test - -.PHONY: all pdf clean watch run.webapp install test test.e2e count-lines +.PHONY: pdf clean watch run.webapp test count-lines all +pdf: pdf.build +clean: pdf.clean +watch: pdf.watch +run.webapp: web.dev +test: test.backend +count-lines: stats.lines +all: pdf.build diff --git a/tests/e2e/config/__init__.py b/tests/e2e/config/__init__.py deleted file mode 100644 index d9124a2..0000000 --- a/tests/e2e/config/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Test configuration modules.""" diff --git a/tests/e2e/config/pricing.py b/tests/e2e/config/pricing.py deleted file mode 100644 index 35edeea..0000000 --- a/tests/e2e/config/pricing.py +++ /dev/null @@ -1,53 +0,0 @@ -from dataclasses import dataclass -from typing import Dict, Any - - -@dataclass(frozen=True) -class SurgePricingConfig: - high_threshold: int - surge_multiplier: float - window_size: int # seconds - - def to_dict(self) -> Dict[str, Any]: - return { - "high_threshold": self.high_threshold, - "surge_multiplier": self.surge_multiplier, - "window_size": self.window_size, - } - - -@dataclass(frozen=True) -class SessionAwareConfig: - velocity_threshold: float - view_depth_threshold: int - cart_ratio_threshold: float - agent_multiplier: float - - def to_dict(self) -> Dict[str, Any]: - return { - "velocity_threshold": self.velocity_threshold, - "view_depth_threshold": self.view_depth_threshold, - "cart_ratio_threshold": self.cart_ratio_threshold, - "agent_multiplier": self.agent_multiplier, - } - - -# Test-optimized configurations for deterministic results -AGGRESSIVE_SURGE = SurgePricingConfig( - high_threshold=3, - surge_multiplier=1.5, - window_size=10, -) - -MODERATE_SURGE = SurgePricingConfig( - high_threshold=5, - surge_multiplier=1.3, - window_size=15, -) - -STRICT_SESSION_AWARE = SessionAwareConfig( - velocity_threshold=2.0, # 2 events/sec is agent-like - view_depth_threshold=5, - cart_ratio_threshold=0.8, - agent_multiplier=1.4, -) diff --git a/tests/e2e/config/settings.py b/tests/e2e/config/settings.py deleted file mode 100644 index 54ead09..0000000 --- a/tests/e2e/config/settings.py +++ /dev/null @@ -1,36 +0,0 @@ -import os -from dataclasses import dataclass -@dataclass(frozen=True) -class ServiceConfig: - web_url: str - backend_url: str - pricing_url: str - kafka_host: str - kafka_port: int - redis_port: int -@dataclass(frozen=True) -class TestConfig: - headless: bool - timeout: int - poll_interval: float - max_retries: int - kafka_consumer_timeout: int - - -def load_service_config() -> ServiceConfig: - return ServiceConfig( - web_url=os.getenv("WEB_URL", "http://localhost:3000"), - backend_url=os.getenv("BACKEND_URL", "http://localhost:5000"), - pricing_url=os.getenv("PRICING_PROVIDER_URL", "http://localhost:5001"), - kafka_host=os.getenv("KAFKA_HOST", "localhost"), - kafka_port=int(os.getenv("KAFKA_PORT", "9092")), - redis_port=int(os.getenv("REDIS_PORT", "6377")), - ) -def load_test_config() -> TestConfig: - return TestConfig( - headless=os.getenv("HEADLESS", "true").lower() == "true", - timeout=int(os.getenv("TEST_TIMEOUT", "30000")), - poll_interval=float(os.getenv("POLL_INTERVAL", "0.5")), - max_retries=int(os.getenv("MAX_RETRIES", "10")), - kafka_consumer_timeout=int(os.getenv("KAFKA_TIMEOUT", "15")), - )