Skip to content

Commit c7d3e5a

Browse files
authored
fix: unblock Wave0 shared CI failures (#376)
* fix: unblock wave0 shared CI failures (#371) * chore: satisfy black gate for shared lint blockers * fix: enforce instruction override guard and stale agent links * fix: import prompt loader in cart agent instructions helper
1 parent 67440b2 commit c7d3e5a

File tree

27 files changed

+122
-62
lines changed

27 files changed

+122
-62
lines changed

.github/agents/pr-evaluator.agent.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ Follow ADR-022: `<prefix>/<issue-id>-<short-description>`
410410

411411
## References
412412

413-
- [`docs/OPERATIONAL-WORKFLOWS.md`](docs/OPERATIONAL-WORKFLOWS.md)Merge and release workflows
414-
- [`.github/governance-map.md`](.github/governance-map.md) — Repository governance
413+
- [`docs/governance`](docs/governance)Governance policies and workflows
414+
- [`docs/architecture/README.md`](docs/architecture/README.md) — Repository architecture references
415415
- [GitHub PR Documentation](https://docs.github.com/en/pull-requests)
416416

417417
---

apps/ecommerce-cart-intelligence/src/ecommerce_cart_intelligence/agents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
read_hot_with_compatibility,
1515
resolve_namespace_context,
1616
)
17+
from holiday_peak_lib.agents.prompt_loader import load_prompt_instructions
1718

1819
from .adapters import CartAdapters, build_cart_adapters
1920

apps/ecommerce-catalog-search/src/ecommerce_catalog_search/agents.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from holiday_peak_lib.agents.fastapi_mcp import FastAPIMCPServer
1414
from holiday_peak_lib.agents.prompt_loader import load_prompt_instructions
1515
from holiday_peak_lib.schemas.product import CatalogProduct
16-
from pydantic import ValidationError
1716
from holiday_peak_lib.schemas.truth import IntentClassification
17+
from pydantic import ValidationError
1818

1919
from .adapters import (
2020
CatalogAdapters,
@@ -313,10 +313,14 @@ async def _search_products_intelligent(
313313
complexity = agent.assess_complexity(query)
314314
if complexity < agent.complexity_threshold:
315315
products = await _search_products_keyword(adapters, query=query, limit=limit)
316-
return products, {}, IntentClassification(
317-
intent="keyword_lookup",
318-
confidence=1.0,
319-
entities={"reason": "low_complexity"},
316+
return (
317+
products,
318+
{},
319+
IntentClassification(
320+
intent="keyword_lookup",
321+
confidence=1.0,
322+
entities={"reason": "low_complexity"},
323+
),
320324
)
321325

322326
intent = await agent.classify_intent(query)
@@ -347,9 +351,7 @@ def _build_sub_queries(query: str, intent: IntentClassification) -> list[str]:
347351
sub_queries.append(value.strip())
348352
elif isinstance(value, list):
349353
sub_queries.extend(
350-
item.strip()
351-
for item in value
352-
if isinstance(item, str) and item.strip()
354+
item.strip() for item in value if isinstance(item, str) and item.strip()
353355
)
354356
unique: list[str] = []
355357
seen: set[str] = set()

apps/ecommerce-catalog-search/src/ecommerce_catalog_search/ai_search.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ def _normalize_result_document(document: dict[str, Any]) -> AISearchDocumentResu
138138
if not sku:
139139
return None
140140
enriched_fields = {
141-
field: document.get(field)
142-
for field in _ENRICHED_FIELDS
143-
if document.get(field) is not None
141+
field: document.get(field) for field in _ENRICHED_FIELDS if document.get(field) is not None
144142
}
145143
return AISearchDocumentResult(
146144
sku=sku,

apps/ecommerce-catalog-search/tests/test_agents.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,5 +391,7 @@ async def test_handle_intelligent_mode_runs_multi_query_and_merges_enrichment(
391391
assert first["complementary_products"] == ["SKU-321"]
392392
assert first["substitute_products"] == ["SKU-654"]
393393
assert "extended_attributes" in first
394-
assert first["extended_attributes"]["enriched_description"].startswith("Noise-canceling")
394+
assert first["extended_attributes"]["enriched_description"].startswith(
395+
"Noise-canceling"
396+
)
395397
mock_multi.assert_awaited_once()

apps/ecommerce-catalog-search/tests/test_mcp_tools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,7 @@ async def test_catalog_intent_tool_requires_query(self, mock_mcp_server, mock_ag
166166
assert result["error"] == "query is required"
167167

168168
@pytest.mark.asyncio
169-
async def test_catalog_intent_tool_returns_classification_for_real_agent(
170-
self, mock_mcp_server
171-
):
169+
async def test_catalog_intent_tool_returns_classification_for_real_agent(self, mock_mcp_server):
172170
"""Intent MCP tool should call classify_intent when the bound agent supports it."""
173171
deps = AgentDependencies(
174172
service_name="test-catalog-search",

apps/search-enrichment-agent/src/search_enrichment_agent/adapters.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
build_ai_search_indexing_client_from_env,
1313
)
1414
from holiday_peak_lib.schemas.truth import SearchEnrichedProduct
15-
from holiday_peak_lib.utils.rate_limiter import RateLimitExceededError, RateLimiter
1615
from holiday_peak_lib.utils.logging import configure_logging
16+
from holiday_peak_lib.utils.rate_limiter import RateLimiter, RateLimitExceededError
1717

1818
logger = configure_logging(app_name="search-enrichment-agent")
1919

@@ -113,7 +113,9 @@ async def enrich_complex_fields(
113113
parsed["_status"] = "ok"
114114
return parsed
115115

116-
def _build_messages(self, *, entity_id: str, approved_truth: dict[str, Any]) -> list[dict[str, Any]]:
116+
def _build_messages(
117+
self, *, entity_id: str, approved_truth: dict[str, Any]
118+
) -> list[dict[str, Any]]:
117119
instruction = (
118120
"Generate search enrichment fields from approved truth data. "
119121
"Return a JSON object with keys: use_cases, complementary_products, "
@@ -159,7 +161,9 @@ async def sync_after_upsert(
159161
document = enriched.model_dump(mode="json", by_alias=True)
160162
document.setdefault("id", entity_id)
161163
document.setdefault("sku", entity_id)
162-
return await self._client.index_documents(self._client.settings.default_index_name, [document])
164+
return await self._client.index_documents(
165+
self._client.settings.default_index_name, [document]
166+
)
163167

164168
indexer_name = self._client.settings.default_indexer_name
165169
if not indexer_name:

apps/search-enrichment-agent/src/search_enrichment_agent/agents.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ async def run(
6767
sku=entity_id,
6868
score=1.0 if strategy == "complex" else 0.75,
6969
sourceType=(
70-
SourceType.AI_REASONING
71-
if strategy == "complex"
72-
else SourceType.PRODUCT_CONTEXT
70+
SourceType.AI_REASONING if strategy == "complex" else SourceType.PRODUCT_CONTEXT
7371
),
7472
sourceAssets=[],
7573
originalData=approved,

apps/search-enrichment-agent/src/search_enrichment_agent/enrichment_engine.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ def build_complex_fields(
8383
merged = dict(simple)
8484
for key in _REQUIRED_FIELDS:
8585
candidate = model_output.get(key)
86-
if key in {"use_cases", "complementary_products", "substitute_products", "search_keywords"}:
86+
if key in {
87+
"use_cases",
88+
"complementary_products",
89+
"substitute_products",
90+
"search_keywords",
91+
}:
8792
normalized = self._normalize_string_list(candidate)
8893
if normalized:
8994
merged[key] = normalized

apps/search-enrichment-agent/tests/test_agents.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def _mock_adapters() -> SearchEnrichmentAdapters:
6767
@pytest.mark.asyncio
6868
async def test_handle_requires_entity_id() -> None:
6969
agent_config_without_models = _build_agent_config_without_models()
70-
with patch("search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=_mock_adapters()):
70+
with patch(
71+
"search_enrichment_agent.agents.build_search_enrichment_adapters",
72+
return_value=_mock_adapters(),
73+
):
7174
agent = SearchEnrichmentAgent(config=agent_config_without_models)
7275

7376
result = await agent.handle({})
@@ -78,7 +81,9 @@ async def test_handle_requires_entity_id() -> None:
7881
async def test_handle_enriches_with_simple_strategy_when_models_unavailable() -> None:
7982
agent_config_without_models = _build_agent_config_without_models()
8083
adapters = _mock_adapters()
81-
with patch("search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters):
84+
with patch(
85+
"search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters
86+
):
8287
agent = SearchEnrichmentAgent(config=agent_config_without_models)
8388

8489
result = await agent.handle({"entity_id": "SKU-1"})
@@ -101,7 +106,9 @@ def add_tool(path, handler): # noqa: ANN001
101106
mcp.add_tool = add_tool
102107

103108
adapters = _mock_adapters()
104-
with patch("search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters):
109+
with patch(
110+
"search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters
111+
):
105112
agent = SearchEnrichmentAgent(config=agent_config_with_slm)
106113
register_mcp_tools(mcp, agent)
107114

@@ -125,7 +132,9 @@ async def test_enrich_triggers_search_indexing_after_upsert() -> None:
125132
adapters.search_indexing = AsyncMock()
126133
adapters.search_indexing.sync_after_upsert = AsyncMock(return_value={"status": "accepted"})
127134

128-
with patch("search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters):
135+
with patch(
136+
"search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters
137+
):
129138
agent = SearchEnrichmentAgent(config=agent_config_without_models)
130139

131140
result = await agent.enrich("SKU-1", trigger="test")
@@ -148,8 +157,13 @@ def add_tool(path, handler): # noqa: ANN001
148157
fake_client = object()
149158
adapters = _mock_adapters()
150159
with (
151-
patch("search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters),
152-
patch("search_enrichment_agent.agents.build_ai_search_indexing_client_from_env", return_value=fake_client),
160+
patch(
161+
"search_enrichment_agent.agents.build_search_enrichment_adapters", return_value=adapters
162+
),
163+
patch(
164+
"search_enrichment_agent.agents.build_ai_search_indexing_client_from_env",
165+
return_value=fake_client,
166+
),
153167
patch("search_enrichment_agent.agents.register_ai_search_indexing_tools") as register_tools,
154168
):
155169
agent = SearchEnrichmentAgent(config=agent_config_with_slm)

0 commit comments

Comments
 (0)