fix(plane): resolve issue states per-project instead of hardcoded enduro UUIDs (ORCH-10) #33

Merged
admin merged 1 commits from feature/ORCH-10-per-project-states into main 2026-06-05 14:42:56 +03:00
Owner

ORCH-10: Per-project Plane state resolution

Problem

PLANE_STATES hardcoded enduro-trails UUIDs globally. Webhook comparison matched only ET UUID (b873d9eb), silently ignoring ORCH in_progress UUID (e331bfb3). Pipeline never started for ORCH-project tasks.

Solution

  • Added — fetches Plane API, caches per project, falls back to _DEFAULT_STATES on failure
  • = original ET values (backward compat), alias preserved
  • All functions resolve UUID via
  • Webhook compares against per-project resolved UUIDs

Tests

  • 23 new tests in tests/test_orch10_states.py
  • Total: 342 passed (was 319)

Verification

  • ET in_progress b873d9eb → pipeline start ✓
  • ORCH in_progress e331bfb3 → pipeline start ✓
  • Fallback on API error → _DEFAULT_STATES ✓
## ORCH-10: Per-project Plane state resolution ### Problem PLANE_STATES hardcoded enduro-trails UUIDs globally. Webhook comparison matched only ET UUID (b873d9eb), silently ignoring ORCH in_progress UUID (e331bfb3). Pipeline never started for ORCH-project tasks. ### Solution - Added — fetches Plane API, caches per project, falls back to _DEFAULT_STATES on failure - = original ET values (backward compat), alias preserved - All functions resolve UUID via - Webhook compares against per-project resolved UUIDs ### Tests - 23 new tests in tests/test_orch10_states.py - Total: 342 passed (was 319) ### Verification - ET in_progress b873d9eb → pipeline start ✓ - ORCH in_progress e331bfb3 → pipeline start ✓ - Fallback on API error → _DEFAULT_STATES ✓
admin added 1 commit 2026-06-05 14:23:47 +03:00
fix(plane): resolve issue states per-project instead of hardcoded enduro UUIDs (ORCH-10)
All checks were successful
CI / test (push) Successful in 12s
CI / test (pull_request) Successful in 10s
00325bcab0
ORCH-10 root cause: PLANE_STATES was a global dict hardcoding enduro-trails
UUIDs. The webhook comparison  only
matched ET UUID (b873d9eb) and silently ignored the ORCH in_progress UUID
(e331bfb3), blocking pipeline start for all orchestrator-project tasks.

Changes:
- src/plane_sync.py:
  * Rename PLANE_STATES -> _DEFAULT_STATES (enduro UUIDs kept as safe fallback).
  * PLANE_STATES preserved as alias to _DEFAULT_STATES (backward compat).
  * Add get_project_states(project_id) -> {logical_key: state_uuid}:
    fetches Plane API GET /projects/<id>/states/, maps by state name,
    caches per project_id, falls back to _DEFAULT_STATES on API failure.
  * Add _STATES_CACHE: dict, reload_project_states(project_id=None).
  * Add _PLANE_NAME_TO_KEY mapping and _STAGE_TO_STATE_KEY for clean lookup.
  * Add stage_to_state(stage, project_id) using get_project_states().
  * update_issue_state() uses stage_to_state() instead of STAGE_TO_STATE dict.
  * set_issue_{needs_input,in_review,blocked,done,in_progress,stage_state}()
    all resolve state UUID via get_project_states(project_id) instead of
    the global PLANE_STATES dict.

- src/webhooks/plane.py:
  * handle_issue_updated: import get_project_states, resolve proj_states per
    incoming project_id, compare new_state against proj_states["in_progress"],
    proj_states["approved"], proj_states["rejected"].
  * start_pipeline QG-0 blocked path: use get_project_states(plane_project_id)
    instead of PLANE_STATES["blocked"].

- tests/test_orch10_states.py: 23 new tests covering:
  * get_project_states returns correct UUIDs for both ET and ORCH projects.
  * API failure / empty response / None project_id -> _DEFAULT_STATES fallback.
  * Caching and reload_project_states (per-project and full flush).
  * stage_to_state() per-project resolution.
  * Webhook in_progress triggers pipeline for BOTH b873d9eb (ET) and e331bfb3 (ORCH).
  * Webhook approved/rejected routes correctly per project.
  * PLANE_STATES alias and _DEFAULT_STATES backward compat.
admin merged commit a2cf1454fd into main 2026-06-05 14:42:56 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/orchestrator#33