fix(growth): make active source canary idempotent
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-15 17:25:25 +08:00
parent 7183da1c39
commit e3b3c7fbd3
3 changed files with 101 additions and 7 deletions

View File

@@ -797,6 +797,27 @@ def test_targeted_marketplace_canary_activates_and_rollback_quarantines(monkeypa
assert yahoo["has_runtime_data"] is True
assert yahoo["write_enabled"] is True
one_candidate_readback = readback_external_offer_candidates(
engine,
candidates[:1],
source_code="yahoo_shopping",
ingestion_method="public_product_jsonld",
)
idempotent_activation = (
canary_service.activate_external_market_source_after_canary(
engine,
source_code="yahoo_shopping",
candidates=candidates[:1],
independent_readback=one_candidate_readback,
identity=identity,
minimum_verified_count=2,
)
)
assert idempotent_activation["status"] == "already_active_verified"
assert idempotent_activation["applied"] is True
assert idempotent_activation["state_changed"] is False
assert idempotent_activation["writes_database_count"] == 0
rollback = canary_service.rollback_external_market_source_canary(
engine,
source_code="yahoo_shopping",