refactor(plane_sync): extract emoji literals to constants (L-3)
This commit is contained in:
@@ -6,6 +6,12 @@ from .config import settings
|
|||||||
|
|
||||||
logger = logging.getLogger("orchestrator.plane_sync")
|
logger = logging.getLogger("orchestrator.plane_sync")
|
||||||
|
|
||||||
|
# L-3: emoji literals used in Plane comment bodies, named for readability.
|
||||||
|
# Message text stays byte-for-byte identical to the previous output.
|
||||||
|
EMOJI_STAGE = "\U0001F504" # stage transition
|
||||||
|
EMOJI_QG_FAIL = "\u26A0\uFE0F" # quality-gate failure
|
||||||
|
EMOJI_DONE = "\u2705" # task completed
|
||||||
|
|
||||||
PLANE_BASE = f"{settings.plane_api_url}/api/v1"
|
PLANE_BASE = f"{settings.plane_api_url}/api/v1"
|
||||||
PLANE_HEADERS = {"X-API-Key": settings.plane_api_token}
|
PLANE_HEADERS = {"X-API-Key": settings.plane_api_token}
|
||||||
WORKSPACE = settings.plane_workspace_slug
|
WORKSPACE = settings.plane_workspace_slug
|
||||||
@@ -194,7 +200,7 @@ def notify_stage_change(work_item_id: str, old_stage: str, new_stage: str, agent
|
|||||||
project_id = _resolve_project_id(work_item_id, project_id)
|
project_id = _resolve_project_id(work_item_id, project_id)
|
||||||
update_issue_state(work_item_id, new_stage, project_id)
|
update_issue_state(work_item_id, new_stage, project_id)
|
||||||
|
|
||||||
msg = f"🔄 Stage: {old_stage} → {new_stage}"
|
msg = f"{EMOJI_STAGE} Stage: {old_stage} → {new_stage}"
|
||||||
if agent:
|
if agent:
|
||||||
msg += f" (launching {agent})"
|
msg += f" (launching {agent})"
|
||||||
|
|
||||||
@@ -232,11 +238,11 @@ def notify_stage_change(work_item_id: str, old_stage: str, new_stage: str, agent
|
|||||||
|
|
||||||
def notify_qg_failure(work_item_id: str, stage: str, check: str, reason: str, project_id: str = None):
|
def notify_qg_failure(work_item_id: str, stage: str, check: str, reason: str, project_id: str = None):
|
||||||
"""Notify Plane about QG failure."""
|
"""Notify Plane about QG failure."""
|
||||||
add_comment(work_item_id, f"⚠️ QG failed at {stage}: {check} — {reason}", project_id)
|
add_comment(work_item_id, f"{EMOJI_QG_FAIL} QG failed at {stage}: {check} — {reason}", project_id)
|
||||||
|
|
||||||
|
|
||||||
def notify_done(work_item_id: str, project_id: str = None):
|
def notify_done(work_item_id: str, project_id: str = None):
|
||||||
"""Mark issue as Done in Plane."""
|
"""Mark issue as Done in Plane."""
|
||||||
project_id = _resolve_project_id(work_item_id, project_id)
|
project_id = _resolve_project_id(work_item_id, project_id)
|
||||||
update_issue_state(work_item_id, "done", project_id)
|
update_issue_state(work_item_id, "done", project_id)
|
||||||
add_comment(work_item_id, "✅ Task completed! PR merged and deployed.", project_id)
|
add_comment(work_item_id, f"{EMOJI_DONE} Task completed! PR merged and deployed.", project_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user