Skip to content

Conversation

@ahogappa
Copy link
Owner

@ahogappa ahogappa commented Jan 25, 2026

Summary

  • Mark unselected section candidate subtrees as completed (skipped) while excluding tasks that are also dependencies of the selected impl
  • Prevent state regression from :completed to :running in progress display
  • Show pending tasks when no running tasks available
  • Don't show success icon while pending tasks remain
  • Move collect_all_dependencies to BaseProgressDisplay for reuse

Test plan

  • All existing tests pass
  • New test added for marking unselected candidate descendants
  • Manual testing with kompo shows correct task names and counts

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved dependency collection to gather all related tasks for accurate progress views
    • Enhanced progress display with clearer status icons, prioritized task names, and output suffixes
  • Bug Fixes

    • Prevents tasks already finalized from re-entering running state
    • Ensures unselected candidates and their dependent descendants are marked completed to avoid misleading statuses
  • Tests

    • Added test covering completion of unselected candidate descendants

✏️ Tip: You can customize this high-level summary in your review settings.

- Mark unselected section candidate subtrees as completed (skipped)
  while excluding tasks that are also dependencies of the selected impl
- Prevent state regression from :completed to :running in progress display
- Show pending tasks when no running tasks available
- Don't show success icon while pending tasks remain
- Move collect_all_dependencies to BaseProgressDisplay for reuse

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 25, 2026

Walkthrough

Adds recursive dependency collection and a run-state-finalized guard to BaseProgressDisplay; enhances SimpleProgressDisplay to track per-section candidate subtrees and mark unselected candidates (and their descendant tasks) completed; adds a test verifying subtree skipping behavior. (49 words)

Changes

Cohort / File(s) Summary
BaseProgressDisplay
lib/taski/execution/base_progress_display.rb
Added public collect_all_dependencies(task_class) and private collect_dependencies_recursive(task_class, collected) to gather all dependencies recursively. Added private run_state_finalized?(progress) and a guard in apply_state_transition to prevent transitioning back to :running if run state is :completed or :failed.
SimpleProgressDisplay (subtree & rendering updates)
lib/taski/execution/simple_progress_display.rb
Added @section_candidate_subtrees tracking. On section impl registration, collects candidate subtrees and marks unselected candidates’ subtrees as completed via mark_unselected_candidates_completed, mark_subtree_completed, and mark_task_as_skipped. Refactored status rendering: collects pending tasks, selects primary task name, computes status icon via determine_status_icon, and appends truncated output via build_output_suffix.
Tests
test/test_simple_progress_display.rb
Added test_register_section_impl_marks_unselected_candidate_descendants_as_completed to assert that unselected candidate descendants are marked completed while selected implementation dependencies remain pending.

Sequence Diagram

sequenceDiagram
    participant Client as Section Handler
    participant SPD as SimpleProgressDisplay
    participant BPD as BaseProgressDisplay
    participant Graph as Task Dependency Graph

    Client->>SPD: register_section_impl(selected_candidate)
    SPD->>BPD: collect_all_dependencies(selected_candidate)
    BPD->>Graph: traverse cached_dependencies recursively
    Graph-->>BPD: return dependency Set
    BPD-->>SPD: selected_deps

    SPD->>SPD: for each unselected_candidate
    SPD->>BPD: collect_all_dependencies(unselected_candidate)
    BPD->>Graph: traverse cached_dependencies recursively
    Graph-->>BPD: return dependency Set
    BPD-->>SPD: unselected_deps

    SPD->>SPD: mark_subtree_completed(unselected_subtree, exclude: selected_deps)
    SPD-->>SPD: mark pending tasks in subtree as completed (skip excluded)

    SPD->>SPD: update internal state & render status line (pending/running/failed)
    SPD-->>Client: section impl registered, display/state updated
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Possibly related PRs

Poem

🐰 I hop through trees of tasks and code,
Skipping branches down a tidy road,
Unchosen leaves fall soft and done,
Selected roots still bask in sun,
Taski hums — progress neatly stowed ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: improve progress display accuracy for section candidates' clearly and specifically describes the main change: enhancing accuracy of progress display rendering for section candidate task handling.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@lib/taski/execution/simple_progress_display.rb`:
- Around line 204-212: The truncation logic uses current_tasks.first(3) before
checking size, so pending_tasks never gets a "..." even when more than 3 items;
change the flow to compute the full list (e.g., pending_list =
pending_tasks.keys.map { |t| short_name(t) } or use current_tasks as the
canonical list), then create the displayed slice (full_list.first(3).join(", "))
and append "..." when full_list.size > 3; update the code that builds task_names
(and any branch that sets current_tasks/pending_tasks) so the size check
compares against the original full list, not the already-truncated array.

Comment on lines 204 to 212
elsif pending_tasks.any?
# Show pending tasks when nothing is running (waiting for dependencies)
pending_tasks.keys.first(3).map { |t| short_name(t) }
else
[]
end

task_names = current_tasks.first(3).join(", ")
task_names += "..." if current_tasks.size > 3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Inconsistent truncation prevents "..." suffix for pending tasks.

Line 206 truncates to 3 tasks early via first(3), so current_tasks.size will never exceed 3 for pending tasks. This means line 212's "..." suffix won't appear even when there are more than 3 pending tasks, unlike the behavior for running/cleaning tasks.

Proposed fix
         elsif pending_tasks.any?
           # Show pending tasks when nothing is running (waiting for dependencies)
-          pending_tasks.keys.first(3).map { |t| short_name(t) }
+          pending_tasks.keys.map { |t| short_name(t) }
         else
           []
         end
🤖 Prompt for AI Agents
In `@lib/taski/execution/simple_progress_display.rb` around lines 204 - 212, The
truncation logic uses current_tasks.first(3) before checking size, so
pending_tasks never gets a "..." even when more than 3 items; change the flow to
compute the full list (e.g., pending_list = pending_tasks.keys.map { |t|
short_name(t) } or use current_tasks as the canonical list), then create the
displayed slice (full_list.first(3).join(", ")) and append "..." when
full_list.size > 3; update the code that builds task_names (and any branch that
sets current_tasks/pending_tasks) so the size check compares against the
original full list, not the already-truncated array.

- Extract run_state_finalized? predicate in BaseProgressDisplay
- Split build_status_line into focused helper methods
- Extract mark_unselected_candidates_completed for section handling
- Extract mark_task_as_skipped for single task state update
- Use safe navigation in on_section_impl_registered

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ahogappa ahogappa merged commit a2fa577 into master Jan 25, 2026
8 checks passed
@ahogappa ahogappa mentioned this pull request Jan 25, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants