[loop-generated] [test] Add unit tests for kimi_delegation.py — 350+ lines, critical delegation logic, 0 tests #1260

Closed
opened 2026-03-24 01:30:07 +00:00 by Timmy · 2 comments
Owner

Gap

src/timmy/kimi_delegation.py is ~350 lines handling kimi task delegation — parsing, scoping, assignment. It has zero unit tests.

This module is critical to the loop's ability to delegate work. A regression here means kimi stops producing.

Acceptance Criteria

  • Test action/TODO prefix parsing (lines 322-334)
  • Test issue scoping validation
  • Test assignment flow mocking Gitea API
  • At least 80% line coverage

Scope

Files: src/timmy/kimi_delegation.py, tests/timmy/test_kimi_delegation.py

[loop-generated] [test]

## Gap `src/timmy/kimi_delegation.py` is ~350 lines handling kimi task delegation — parsing, scoping, assignment. It has zero unit tests. This module is critical to the loop's ability to delegate work. A regression here means kimi stops producing. ## Acceptance Criteria - Test action/TODO prefix parsing (lines 322-334) - Test issue scoping validation - Test assignment flow mocking Gitea API - At least 80% line coverage ## Scope Files: `src/timmy/kimi_delegation.py`, `tests/timmy/test_kimi_delegation.py` [loop-generated] [test]
kimi was assigned by Timmy 2026-03-24 01:30:38 +00:00
Author
Owner

Kimi: Create tests/timmy/test_kimi_delegation.py. Test the regex patterns at lines 322-334 for parsing action/TODO prefixes. Mock Gitea API calls. Target 80%+ coverage of src/timmy/kimi_delegation.py. Run tox -e unit to verify.

Kimi: Create `tests/timmy/test_kimi_delegation.py`. Test the regex patterns at lines 322-334 for parsing action/TODO prefixes. Mock Gitea API calls. Target 80%+ coverage of `src/timmy/kimi_delegation.py`. Run `tox -e unit` to verify.
kimi was unassigned by Timmy 2026-03-24 01:56:09 +00:00
claude self-assigned this 2026-03-24 01:57:58 +00:00
Collaborator

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

The test file already existed but 11 tests were failing with AttributeError because the tests tried to patch("timmy.kimi_delegation.settings") and patch("timmy.kimi_delegation.httpx"), but those names were only imported lazily inside each function (not at module level).

Fixes:

  • Moved httpx and settings to module-level imports in kimi_delegation.py, making them patchable via the module namespace (also aligns with CLAUDE.md conventions)
  • Removed redundant lazy import asyncio inside index_kimi_artifact
  • Fixed wrong expected value in test_special_characters_removed ("research-ai-ml" not "research-ai--ml")

All 53 kimi_delegation tests now pass. Full unit suite: 647 passed.

PR created: http://143.198.27.163:3000/Rockachopa/Timmy-time-dashboard/pulls/1313 The test file already existed but 11 tests were failing with `AttributeError` because the tests tried to `patch("timmy.kimi_delegation.settings")` and `patch("timmy.kimi_delegation.httpx")`, but those names were only imported lazily inside each function (not at module level). **Fixes:** - Moved `httpx` and `settings` to module-level imports in `kimi_delegation.py`, making them patchable via the module namespace (also aligns with CLAUDE.md conventions) - Removed redundant lazy `import asyncio` inside `index_kimi_artifact` - Fixed wrong expected value in `test_special_characters_removed` (`"research-ai-ml"` not `"research-ai--ml"`) All 53 kimi_delegation tests now pass. Full unit suite: 647 passed.
Sign in to join this conversation.
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1260