fix(quality_nudge,bluesky): gate Instagram nudge on EXCLUDE_SOURCES + anchor bluesky tests at resolver

This commit is contained in:
Trevin Chow
2026-05-17 00:32:38 -07:00
parent f236cff86a
commit 1814bb1967
4 changed files with 68 additions and 7 deletions
-1
View File
@@ -24,7 +24,6 @@ from . import http, log
BSKY_SESSION_URL = "https://bsky.social/xrpc/com.atproto.server.createSession"
_DEFAULT_BSKY_SEARCH_HOST = "api.bsky.app"
BSKY_SEARCH_URL = f"https://{_DEFAULT_BSKY_SEARCH_HOST}/xrpc/app.bsky.feed.searchPosts"
def _resolve_search_url(config: Optional[Dict[str, Any]] = None) -> str:
@@ -86,6 +86,17 @@ def _is_instagram_silent_failure(config: dict, research_results: dict) -> bool:
"""
if not config.get("SCRAPECREATORS_API_KEY"):
return False # not configured — not a silent failure
# Honor EXCLUDE_SOURCES: a user who set EXCLUDE_SOURCES=instagram
# intentionally turned the source off, so a zero-item count is
# expected, not a silent failure. Mirror the canonical parsing
# pattern from pipeline.available_sources().
excluded = {
s.strip().lower()
for s in (config.get("EXCLUDE_SOURCES") or "").split(",")
if s.strip()
}
if "instagram" in excluded:
return False
count = research_results.get("instagram_items_count")
if count is None:
return False # source not run this invocation