Skip to content

Conversation

@twaugh
Copy link
Owner

@twaugh twaugh commented Nov 23, 2025

Phase 3 wasn't updating the UI for blocks 2+ when decisions were streaming in from Phase 2's background worker. The polling timer never started because initialization logic incorrectly marked all blocks as "ready" when it detected a non-empty decisions list.

Root Cause:
The initialization code (lines 167-174) assumed only two scenarios:

  1. Empty decisions → streaming will start, don't mark blocks ready
  2. Non-empty decisions → complete pre-generated list (tests), mark ALL ready

But there was a third scenario it didn't handle:
3. Partially populated decisions → streaming from Phase 2, only mark blocks WITH decisions as ready

This caused on_mount() to calculate all_complete=True (5 ready / 5 total), preventing the polling timer from starting.

Fix:

  1. Use auto_start_workers flag to distinguish test mode (True) from production mode with shared streaming list (False)
  2. In production mode, only mark blocks with decisions as ready
  3. Change task check from isinstance() to hasattr() to support test MockApp

Result:

  • Polling starts correctly when blocks_ready < total_blocks
  • UI updates as new decisions stream in from Phase 2
  • All 56 Phase 3 tests pass

Assisted-by: Claude Code

Phase 3 wasn't updating the UI for blocks 2+ when decisions were
streaming in from Phase 2's background worker. The polling timer never
started because initialization logic incorrectly marked all blocks as
"ready" when it detected a non-empty decisions list.

Root Cause:
The initialization code (lines 167-174) assumed only two scenarios:
1. Empty decisions → streaming will start, don't mark blocks ready
2. Non-empty decisions → complete pre-generated list (tests), mark ALL ready

But there was a third scenario it didn't handle:
3. Partially populated decisions → streaming from Phase 2, only mark
   blocks WITH decisions as ready

This caused on_mount() to calculate all_complete=True (5 ready / 5 total),
preventing the polling timer from starting.

Fix:
1. Use auto_start_workers flag to distinguish test mode (True) from
   production mode with shared streaming list (False)
2. In production mode, only mark blocks with decisions as ready
3. Change task check from isinstance() to hasattr() to support test MockApp

Result:
- Polling starts correctly when blocks_ready < total_blocks
- UI updates as new decisions stream in from Phase 2
- All 56 Phase 3 tests pass

Assisted-by: Claude Code
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.75%. Comparing base (a727fb3) to head (4dc0c01).

Files with missing lines Patch % Lines
src/logsqueak/tui/screens/integration_review.py 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
+ Coverage   84.57%   84.75%   +0.18%     
==========================================
  Files          48       48              
  Lines        5083     5084       +1     
==========================================
+ Hits         4299     4309      +10     
+ Misses        784      775       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@twaugh twaugh merged commit d200961 into main Nov 23, 2025
1 check passed
@twaugh twaugh deleted the fix/phase3-polling-blocks-2-onwards branch November 23, 2025 09:17
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.

3 participants