Add explicit poll_task_types allowlist to filter ClickUp polling
Only tasks with Work Category in poll_task_types are fetched and processed. Prevents unrecognized types (SEO Audit, AEO, etc.) from being evaluated every poll cycle. Falls back to skill_map keys if the list is empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>fix/customer-field-migration
parent
ca73689099
commit
1e26969ff8
|
|
@ -49,6 +49,7 @@ class ClickUpConfig:
|
||||||
error_status: str = "error"
|
error_status: str = "error"
|
||||||
task_type_field_name: str = "Work Category"
|
task_type_field_name: str = "Work Category"
|
||||||
default_auto_execute: bool = False
|
default_auto_execute: bool = False
|
||||||
|
poll_task_types: list[str] = field(default_factory=list)
|
||||||
skill_map: dict = field(default_factory=dict)
|
skill_map: dict = field(default_factory=dict)
|
||||||
enabled: bool = False
|
enabled: bool = False
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,12 +357,14 @@ class Scheduler:
|
||||||
now_ms = int(datetime.now(UTC).timestamp() * 1000)
|
now_ms = int(datetime.now(UTC).timestamp() * 1000)
|
||||||
due_date_lt = now_ms + (self.DUE_DATE_WINDOW_WEEKS * 7 * 24 * 60 * 60 * 1000)
|
due_date_lt = now_ms + (self.DUE_DATE_WINDOW_WEEKS * 7 * 24 * 60 * 60 * 1000)
|
||||||
|
|
||||||
|
# Explicit allowlist of Work Category values to poll
|
||||||
|
allowed_types = self.config.clickup.poll_task_types or list(skill_map.keys())
|
||||||
|
|
||||||
custom_fields_filter = None
|
custom_fields_filter = None
|
||||||
if self._field_filter_cache and self._field_filter_cache.get("options"):
|
if self._field_filter_cache and self._field_filter_cache.get("options"):
|
||||||
field_id = self._field_filter_cache["field_id"]
|
field_id = self._field_filter_cache["field_id"]
|
||||||
options = self._field_filter_cache["options"]
|
options = self._field_filter_cache["options"]
|
||||||
# Only include options that map to skills we have
|
matching_opt_ids = [options[name] for name in allowed_types if name in options]
|
||||||
matching_opt_ids = [options[name] for name in skill_map if name in options]
|
|
||||||
if matching_opt_ids:
|
if matching_opt_ids:
|
||||||
import json as _json
|
import json as _json
|
||||||
|
|
||||||
|
|
@ -378,12 +380,8 @@ class Scheduler:
|
||||||
)
|
)
|
||||||
|
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
# ClickUp status filtering is the dedup: tasks in poll_statuses
|
# Client-side verify: Work Category must be in allowed types AND skill_map
|
||||||
# are eligible; once moved to "automation underway", they won't
|
if task.task_type not in allowed_types or task.task_type not in skill_map:
|
||||||
# appear in the next poll.
|
|
||||||
|
|
||||||
# Client-side verify: Work Category must be in skill_map
|
|
||||||
if task.task_type not in skill_map:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Respect auto_execute flag — skip tasks that require manual trigger
|
# Respect auto_execute flag — skip tasks that require manual trigger
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ email:
|
||||||
clickup:
|
clickup:
|
||||||
poll_interval_minutes: 20 # 3x per hour
|
poll_interval_minutes: 20 # 3x per hour
|
||||||
poll_statuses: ["to do", "outline approved"]
|
poll_statuses: ["to do", "outline approved"]
|
||||||
|
poll_task_types: ["Press Release", "On Page Optimization", "Content Creation", "Link Building"]
|
||||||
review_status: "internal review"
|
review_status: "internal review"
|
||||||
pr_review_status: "pr needs review"
|
pr_review_status: "pr needs review"
|
||||||
in_progress_status: "in progress"
|
in_progress_status: "in progress"
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class _FakeClickUpConfig:
|
||||||
error_status: str = "error"
|
error_status: str = "error"
|
||||||
task_type_field_name: str = "Work Category"
|
task_type_field_name: str = "Work Category"
|
||||||
default_auto_execute: bool = True
|
default_auto_execute: bool = True
|
||||||
|
poll_task_types: list[str] = field(default_factory=lambda: ["Press Release"])
|
||||||
skill_map: dict = field(default_factory=lambda: {"Press Release": _PR_MAPPING})
|
skill_map: dict = field(default_factory=lambda: {"Press Release": _PR_MAPPING})
|
||||||
enabled: bool = True
|
enabled: bool = True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue