AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary
Python ai-promptsai-skillblueskyclaudeclaude-codeclawhubdeep-researchhackernewsinstagramopenclawpolymarketrecencyredditresearchsocial-mediatiktoktrendstwitterweb-searchyoutube
fix(doctor): Threads reports opt-in state, not false-Ready (U6)
Matt Van Hornd1efed83d420
diff --git a/skills/last30days/scripts/lib/doctor.py b/skills/last30days/scripts/lib/doctor.pyindex 5c598df2..1ebda6d6 100644--- a/skills/last30days/scripts/lib/doctor.py+++ b/skills/last30days/scripts/lib/doctor.py@@ -388,6 +388,28 @@ def _sc_gated_record(config: Dict[str, Any], purpose: str) -> Dict[str, Any]:fix=_sc_fix())+def _sc_optin_record(config: Dict[str, Any], source: str, purpose: str) -> Dict[str, Any]:+ """SC-gated source that ALSO requires an INCLUDE_SOURCES opt-in to run.++ Unlike ``_sc_gated_record`` (used by the on-by-default TikTok/Instagram),+ a key alone is not enough here: the pipeline only fires this source when it+ is in INCLUDE_SOURCES. Reporting a bare key as Ready is the Threads+ false-Ready bug - this mirrors ``_linkedin_record``'s correct gating so+ doctor and the pipeline cannot disagree.+ """+ requires = f"SCRAPECREATORS_API_KEY + INCLUDE_SOURCES={source}"+ if not config.get("SCRAPECREATORS_API_KEY"):+ return _record(status="unconfigured", requires=requires, fix=_sc_fix())+ if source in env.include_sources(config):+ return _record(status=health.OK, requires=requires,+ detail=f"SCRAPECREATORS_API_KEY present ({purpose})")+ return _record(+ status="opt-in", requires=requires,+ fix=f"add {source} to INCLUDE_SOURCES (or request it via --search {source})",+ note="key present; opt-in, never auto-activates",+ )++def _reddit_record(config):return _chained_record("reddit", config)@@ -529,7 +551,9 @@ def _instagram_record(config):def _threads_record(config):- return _sc_gated_record(config, "threads")+ # Threads needs the key AND an INCLUDE_SOURCES=threads opt-in to run, so it+ # is opt-in-gated (not on-by-default like TikTok/Instagram).+ return _sc_optin_record(config, "threads", "threads")def _bluesky_record(config):diff --git a/tests/test_doctor.py b/tests/test_doctor.pyindex 19cfa643..0718ecb0 100644--- a/tests/test_doctor.py+++ b/tests/test_doctor.py@@ -875,6 +875,39 @@ class FourStateAudit(unittest.TestCase):self.assertIn("13 items last run", text)+class ThreadsOptIn(unittest.TestCase):+ """U6: Threads reports opt-in state honestly against INCLUDE_SOURCES."""++ def test_key_without_optin_is_could_be_on(self):+ report = _build({"SCRAPECREATORS_API_KEY": "dummy-sc-secret-000"})+ rec = report["sources"]["threads"]+ self.assertEqual("opt-in", rec["status"])+ self.assertEqual(doctor.AUDIT_COULD_BE_ON, rec["audit_state"])+ self.assertIn("INCLUDE_SOURCES", rec["fix"])++ def test_key_with_optin_is_working(self):+ report = _build(+ {+ "SCRAPECREATORS_API_KEY": "dummy-sc-secret-000",+ "INCLUDE_SOURCES": "tiktok,instagram,threads",+ }+ )+ rec = report["sources"]["threads"]+ self.assertEqual("ok", rec["status"])++ def test_no_key_is_could_be_on_with_sc_fix(self):+ rec = _build({})["sources"]["threads"]+ self.assertEqual("unconfigured", rec["status"])+ self.assertEqual(doctor.AUDIT_COULD_BE_ON, rec["audit_state"])++ def test_tiktok_on_by_default_with_key_unchanged(self):+ # Regression: TikTok/Instagram stay on-by-default with a key (WORKING),+ # they are NOT opt-in-gated like Threads.+ report = _build({"SCRAPECREATORS_API_KEY": "dummy-sc-secret-000"})+ self.assertEqual("ok", report["sources"]["tiktok"]["status"])+ self.assertEqual("ok", report["sources"]["instagram"]["status"])++class CliHealth(unittest.TestCase):"""U3: CLI-dependency health + techmeme/arxiv/trustpilot sources."""