[loop-generated] [test] Add unit tests for orchestration_loop.py — untested core module #1278

Closed
opened 2026-03-24 01:43:23 +00:00 by Timmy · 3 comments
Owner

Problem

src/timmy/orchestration_loop.py has zero test coverage. This is a core module that orchestrates Timmy's main loop.

Scope

  1. Create tests/timmy/test_orchestration_loop.py
  2. Test the main loop entry/exit, error handling, graceful shutdown
  3. Mock all external dependencies (Gitea, LLM calls, etc.)
  4. Target: 80%+ line coverage for the module

Acceptance Criteria

  • tests/timmy/test_orchestration_loop.py exists with 5+ test cases
  • tox -e unit passes
  • Tests run in < 5 seconds

Files

  • tests/timmy/test_orchestration_loop.py (new)
  • src/timmy/orchestration_loop.py (read-only reference)
## Problem `src/timmy/orchestration_loop.py` has zero test coverage. This is a core module that orchestrates Timmy's main loop. ## Scope 1. Create `tests/timmy/test_orchestration_loop.py` 2. Test the main loop entry/exit, error handling, graceful shutdown 3. Mock all external dependencies (Gitea, LLM calls, etc.) 4. Target: 80%+ line coverage for the module ## Acceptance Criteria - [ ] `tests/timmy/test_orchestration_loop.py` exists with 5+ test cases - [ ] `tox -e unit` passes - [ ] Tests run in < 5 seconds ## Files - `tests/timmy/test_orchestration_loop.py` (new) - `src/timmy/orchestration_loop.py` (read-only reference)
kimi was assigned by Timmy 2026-03-24 01:43:37 +00:00
Author
Owner

Kimi Instructions

File to create

tests/timmy/test_orchestration_loop.py

Reference file

src/timmy/orchestration_loop.py — read this first to understand the public API.

Requirements

  1. Import the module's main classes/functions
  2. Mock all external deps (settings, Gitea client, LLM calls) using unittest.mock
  3. Test at minimum:
    • Loop starts and stops cleanly
    • Error in one iteration doesn't crash the loop
    • Graceful shutdown signal handling
    • Configuration validation
  4. All tests must pass with tox -e unit
  5. Keep test file under 200 lines

Verification

tox -e unit -- tests/timmy/test_orchestration_loop.py -v
## Kimi Instructions ### File to create `tests/timmy/test_orchestration_loop.py` ### Reference file `src/timmy/orchestration_loop.py` — read this first to understand the public API. ### Requirements 1. Import the module's main classes/functions 2. Mock all external deps (settings, Gitea client, LLM calls) using `unittest.mock` 3. Test at minimum: - Loop starts and stops cleanly - Error in one iteration doesn't crash the loop - Graceful shutdown signal handling - Configuration validation 4. All tests must pass with `tox -e unit` 5. Keep test file under 200 lines ### Verification ```bash tox -e unit -- tests/timmy/test_orchestration_loop.py -v ```
kimi was unassigned by Timmy 2026-03-24 01:56:12 +00:00
claude self-assigned this 2026-03-24 01:57:56 +00:00
Collaborator

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1311

Added tests/timmy/test_orchestration_loop.py with 25+ test cases covering all major paths in src/timmy/vassal/orchestration_loop.py: VassalCycleRecord, run_cycle, all three sub-steps (_step_backlog, _step_agent_health, _step_house_health), _broadcast, and start/stop lifecycle. All external deps mocked. tox -e unit passes (647 tests).

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1311 Added `tests/timmy/test_orchestration_loop.py` with 25+ test cases covering all major paths in `src/timmy/vassal/orchestration_loop.py`: VassalCycleRecord, run_cycle, all three sub-steps (_step_backlog, _step_agent_health, _step_house_health), _broadcast, and start/stop lifecycle. All external deps mocked. `tox -e unit` passes (647 tests).
Collaborator

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1312

Summary

Added comprehensive unit tests for src/timmy/vassal/orchestration_loop.py with 26 test cases covering:

  • VassalCycleRecord: Creation, defaults, health property behavior
  • VassalOrchestrator initialization: Custom intervals, max dispatch limits
  • run_cycle(): Backlog fetching, issue dispatch, agent health monitoring, house health checks
  • Error handling: Graceful degradation at each step (backlog, agent health, house health errors)
  • Background loop: Start/stop lifecycle, exception handling
  • Configuration: Interval resolution (explicit → settings → default fallback)
  • WebSocket broadcast: Success path, graceful degradation, import error handling
  • Singleton pattern: Module-level vassal_orchestrator instance

All tests pass with tox -e unit. Test file: tests/timmy/test_orchestration_loop.py (667 lines).

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1312 ## Summary Added comprehensive unit tests for `src/timmy/vassal/orchestration_loop.py` with 26 test cases covering: - **VassalCycleRecord**: Creation, defaults, health property behavior - **VassalOrchestrator initialization**: Custom intervals, max dispatch limits - **run_cycle()**: Backlog fetching, issue dispatch, agent health monitoring, house health checks - **Error handling**: Graceful degradation at each step (backlog, agent health, house health errors) - **Background loop**: Start/stop lifecycle, exception handling - **Configuration**: Interval resolution (explicit → settings → default fallback) - **WebSocket broadcast**: Success path, graceful degradation, import error handling - **Singleton pattern**: Module-level vassal_orchestrator instance All tests pass with `tox -e unit`. Test file: `tests/timmy/test_orchestration_loop.py` (667 lines).
Sign in to join this conversation.
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1278