1.7.3
βοΈ Patch 1.7.3 β Buy-price force recalc, repricer test suite, and deprecation cleanup¶
π Summary¶
- Repricer base cron now detects actual buy_price changes from
shopping_tableand runs a forced min/max recalculation + export for affected articles β even whenuse_min_max_rulesis disabled on a channel. - UVP articles (
min_uvp/max_uvpset) are excluded from this flow;article_typeis reset on eligible buy-price changes so Penner classification can be re-evaluated. - FBM/FBA export in the cron path still respects per-region
ignoreflags (noforce=Trueβ unlike the UVP export flow). - Added a 39-test pytest suite covering buy-price sync, force-recalc selection, per-channel recalc, exports, and the full cron recalc/export pipeline.
- Cleaned up Pydantic v2 / SQLAlchemy 2.0 deprecations and test-time ResourceWarning noise.
β¨ Improvements¶
- Buy-price sync (
sync_buy_prices): - Returns a new
changedlist (SKUs wherebrutto_buy_priceactually changed), separate fromsuccess(confirmed/updated without error). - Force recalc after buy_price change (
_sync_articles_internal): - After the normal full recalc pass, runs a second pass per eligible SKU with
force_min_max=Trueon Shopify, Kaufland, Otto, FBM, and FBA. - Helper
_resolve_buy_price_force_recalc_skuscentralises selection: skips UVP and OOS (stock == 0), resetsarticle_typetonullfor included SKUs. - Per-channel
force_min_maxflag onrecalculate_articles: - When
True, recalculates and writes min/max (or Shopify price) even ifuse_min_max_rulesisfalseβ without permanently flipping that flag. - Manual-override path (profit-only refresh) remains the default when buy_price is unchanged.
- Test suite (
service_multi-repricer/app/tests/) β 39 tests, no Docker/Postgres required: test_sync_buy_prices.pyβ change detection, missing shopping rows, newest row wins.test_force_recalc_resolution.pyβ UVP/OOS exclusion,article_typereset, mixed batches.test_recalculate_channels.pyβ base vsforce_min_maxfor all channels; OOS skip; FBM/FBA manual override vs SP-API full recalc.test_exports.pyβ Shopify/Kaufland export success; FBM/FBAignorerespected; UVP-styleforce=Truebypasses ignore.test_cron_sync_flow.pyβ end-to-end_sync_articles_internalwith mocked sync steps.- In-memory SQLite fixtures; external APIs (Plenty, Sellerlogic, Kaufland, SP-API) mocked.
- pytest configuration:
pytest.ini:pythonpath = app ..so tests run from the service folder without manualPYTHONPATH(picks upbackend_logging).error::ResourceWarningβ unclosed SQLite connections fail tests; SQLModel-internal Pydantic deprecation filtered until library upgrade.- Deprecation / hygiene:
SettingsusesSettingsConfigDict; response/SQLModel schemas migrated from nestedclass Configtomodel_config = ConfigDict(...).sqlalchemy.orm.declarative_baseinstead of deprecatedsqlalchemy.ext.declarative.- Kaufland export/sync timestamps use Europe/Berlin instead of
datetime.utcnow(). Plenty_Manager.batch_get_stocktyping fixed for Python 3.13+ (List[tuple[int, int]]).
π Bug Fixes¶
- Buy_price sync false positives: SKUs were treated as βchangedβ whenever sync succeeded, even if the price was identical β
changedis now only populated on a real delta. - Manual-override articles stuck after EK change: cron recalc refreshed profit on fixed target prices but did not recompute bounds when
use_min_max_rules=falseβ force pass fixes that for buy_price changes only. - Penner
article_typestale after EK change: eligible articles getarticle_type = nullon buy_price update so classification can be reassigned.
π Files changed¶
Backend (service_multi-repricer)
app/api/v1/endpoints/repricer_articles.pyβ buy_pricechangedtracking,_resolve_buy_price_force_recalc_skus, force recalc loop in cron background task.app/api/v1/endpoints/shopify_articles.pyβforce_min_maxon recalculate.app/api/v1/endpoints/kaufland_articles.pyβforce_min_max, Berlin timestamps on export/sync.app/api/v1/endpoints/otto_articles.pyβforce_min_maxon recalculate.app/api/v1/endpoints/fbm_articles.pyβforce_min_maxon recalculate.app/api/v1/endpoints/fba_articles.pyβforce_min_maxon recalculate.app/services/plenty/plenty_manager.pyβbatch_get_stocktype annotation fix.app/core/config.py,app/core/database.py,app/models/base.pyβ ConfigDict / declarative_base.app/models/*.py,app/schemas/*.pyβ PydanticConfigDictmigration (models/schemas touched by tests and exports).
Tests
app/tests/conftest.py,app/tests/test_*.py(5 modules),app/tests/__init__.py.pytest.ini.
π§ Database & SQL¶
- No schema migration required.
article_typemay be set toNULLon repricer articles when shopping_table reports a new buy_price (non-UVP, in-stock articles only).
Usage notes¶
- Run tests locally from
backend/service_multi-repricer:No running Docker stack needed β tests use in-memory SQLite and mocked marketplace APIs.pip install -r requirements.txt pytest pytest-asyncio python -m pytest app/tests - After deploy, the base repricer cron will automatically force-recalc and export channels when EK changes; UVP-managed articles are untouched.
- FBM/FBA regions with
ignore !== falseare still skipped on cron export; only the dedicated UVP export path usesforce=True. - Otto min/max are updated in DB on force recalc; Otto live price push still goes through the separate Otto monitor cron (unchanged).