From 11f667118062750fe5631fcc9ccc3b436fe33e19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:34:00 +0000 Subject: [PATCH 1/2] Initial plan From 343f0e146d55b7736f51456ae8effc396211c788 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:48:54 +0000 Subject: [PATCH 2/2] Add PILOT_COLLECTION fabric data and tests Agent-Logs-Url: https://github.com/Tryonme-com/tryonyou-app/sessions/6b2e64b8-88c7-40df-be99-5ef1bea2bc66 Co-authored-by: LVT-ENG <214667862+LVT-ENG@users.noreply.github.com> --- api/peacock_core.py | 38 ++++++++++++++++++++++++++++++++ tests/test_peacock_core.py | 45 +++++++++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/api/peacock_core.py b/api/peacock_core.py index 0a6b35ba..7bd95566 100644 --- a/api/peacock_core.py +++ b/api/peacock_core.py @@ -14,6 +14,44 @@ _FORBIDDEN_WEBHOOK_HOST_FRAGMENTS = ("abvetos.com",) +PILOT_COLLECTION: dict[str, dict[str, float]] = { + "eg0": { # Silk Haussmann + "drapeCoefficient": 0.85, + "weightGSM": 60, + "elasticityPct": 12, + "recoveryPct": 95, + "frictionCoefficient": 0.22, + }, + "eg1": { # Business Elite (Cotton/Wool) + "drapeCoefficient": 0.35, + "weightGSM": 280, + "elasticityPct": 4, + "recoveryPct": 80, + "frictionCoefficient": 0.65, + }, + "eg2": { # Velvet Night + "drapeCoefficient": 0.55, + "weightGSM": 320, + "elasticityPct": 8, + "recoveryPct": 88, + "frictionCoefficient": 0.45, + }, + "eg3": { # Tech Shell + "drapeCoefficient": 0.15, + "weightGSM": 180, + "elasticityPct": 2, + "recoveryPct": 98, + "frictionCoefficient": 0.75, + }, + "eg4": { # Cashmere Cloud + "drapeCoefficient": 0.70, + "weightGSM": 220, + "elasticityPct": 15, + "recoveryPct": 92, + "frictionCoefficient": 0.30, + }, +} + def is_webhook_destination_forbidden(url: str) -> bool: """True si la URL apunta a un host no permitido para webhooks salientes.""" diff --git a/tests/test_peacock_core.py b/tests/test_peacock_core.py index 2141ea0f..a16eb9a4 100644 --- a/tests/test_peacock_core.py +++ b/tests/test_peacock_core.py @@ -10,7 +10,50 @@ if _API not in sys.path: sys.path.insert(0, _API) -from peacock_core import ZERO_SIZE_LATENCY_BUDGET_MS, is_webhook_destination_forbidden +from peacock_core import PILOT_COLLECTION, ZERO_SIZE_LATENCY_BUDGET_MS, is_webhook_destination_forbidden + +_PILOT_KEYS = {"drapeCoefficient", "weightGSM", "elasticityPct", "recoveryPct", "frictionCoefficient"} + + +class TestPilotCollection(unittest.TestCase): + def test_has_five_entries(self) -> None: + self.assertEqual(len(PILOT_COLLECTION), 5) + + def test_all_ids_present(self) -> None: + for key in ("eg0", "eg1", "eg2", "eg3", "eg4"): + self.assertIn(key, PILOT_COLLECTION) + + def test_each_entry_has_required_keys(self) -> None: + for fabric_id, props in PILOT_COLLECTION.items(): + self.assertEqual( + set(props.keys()), + _PILOT_KEYS, + msg=f"Fabric entry '{fabric_id}' is missing required keys", + ) + + def test_all_values_are_numeric(self) -> None: + for fabric_id, props in PILOT_COLLECTION.items(): + for k, v in props.items(): + self.assertIsInstance( + v, (int, float), + msg=f"PILOT_COLLECTION['{fabric_id}']['{k}'] is not numeric", + ) + + def test_eg0_silk_haussmann_values(self) -> None: + eg0 = PILOT_COLLECTION["eg0"] + self.assertAlmostEqual(eg0["drapeCoefficient"], 0.85) + self.assertAlmostEqual(eg0["weightGSM"], 60) + self.assertAlmostEqual(eg0["elasticityPct"], 12) + self.assertAlmostEqual(eg0["recoveryPct"], 95) + self.assertAlmostEqual(eg0["frictionCoefficient"], 0.22) + + def test_eg3_tech_shell_has_lowest_drape(self) -> None: + drapes = {k: v["drapeCoefficient"] for k, v in PILOT_COLLECTION.items()} + self.assertEqual(min(drapes, key=drapes.get), "eg3") + + def test_eg4_cashmere_cloud_highest_elasticity(self) -> None: + elasticities = {k: v["elasticityPct"] for k, v in PILOT_COLLECTION.items()} + self.assertEqual(max(elasticities, key=elasticities.get), "eg4") class TestPeacockCoreIntegration(unittest.TestCase):