feat(gui): Add cascade blocking logic to block/unblock

This commit is contained in:
2026-03-07 16:30:53 -05:00
parent 265839a55b
commit c6d0bc8c8d

View File

@@ -1960,6 +1960,17 @@ class App:
t['status'] = 'blocked' t['status'] = 'blocked'
t['manual_block'] = True t['manual_block'] = True
t['blocked_reason'] = '[MANUAL] User blocked' t['blocked_reason'] = '[MANUAL] User blocked'
changed = True
while changed:
changed = False
for t in self.active_tickets:
if t.get('status') == 'todo':
for dep_id in t.get('depends_on', []):
dep = next((x for x in self.active_tickets if str(x.get('id', '')) == dep_id), None)
if dep and dep.get('status') == 'blocked':
t['status'] = 'blocked'
changed = True
break
self._push_mma_state_update() self._push_mma_state_update()
def _cb_unblock_ticket(self, ticket_id: str) -> None: def _cb_unblock_ticket(self, ticket_id: str) -> None:
@@ -1968,6 +1979,20 @@ class App:
t['status'] = 'todo' t['status'] = 'todo'
t['manual_block'] = False t['manual_block'] = False
t['blocked_reason'] = None t['blocked_reason'] = None
changed = True
while changed:
changed = False
for t in self.active_tickets:
if t.get('status') == 'blocked' and not t.get('manual_block', False):
can_run = True
for dep_id in t.get('depends_on', []):
dep = next((x for x in self.active_tickets if str(x.get('id', '')) == dep_id), None)
if dep and dep.get('status') != 'completed':
can_run = False
break
if can_run:
t['status'] = 'todo'
changed = True
self._push_mma_state_update() self._push_mma_state_update()
def _reorder_ticket(self, src_idx: int, dst_idx: int) -> None: def _reorder_ticket(self, src_idx: int, dst_idx: int) -> None: