[loop-generated] [bug] 256 test errors from missing swarm module — need stub or optional import guard #657

Closed
opened 2026-03-20 23:13:12 +00:00 by Timmy · 3 comments
Owner

Problem

tox -e unit produces 256 ERRORs because swarm is not installed. The swarm package is imported in:

  • src/timmy/thinking.py (lines 816, 1222)
  • src/timmy/briefing.py (line 170)
  • src/dashboard/app.py (line 439)
  • src/infrastructure/error_capture.py (lines 133, 183, 210)
  • src/spark/memory.py (line 168)

All imports are already inside try/except or conditional blocks, but something is still causing 256 test collection errors.

Root cause

Likely a top-level import or conftest fixture that tries to import swarm unconditionally. The conftest.py references swarm.db modules but wraps in try/except — need to trace the actual failure path.

Fix

Either:

  1. Add a lightweight swarm stub package to the test dependencies
  2. Fix the import guard that is leaking
  3. Add swarm to optional dependencies in pyproject.toml

Scope

1-3 files. The 256 errors should collapse to 0 with a proper fix.

Verification

tox -e unit

Errors should drop from 256 to 0.

## Problem `tox -e unit` produces 256 ERRORs because `swarm` is not installed. The swarm package is imported in: - `src/timmy/thinking.py` (lines 816, 1222) - `src/timmy/briefing.py` (line 170) - `src/dashboard/app.py` (line 439) - `src/infrastructure/error_capture.py` (lines 133, 183, 210) - `src/spark/memory.py` (line 168) All imports are already inside try/except or conditional blocks, but something is still causing 256 test collection errors. ## Root cause Likely a top-level import or conftest fixture that tries to import swarm unconditionally. The `conftest.py` references `swarm.db` modules but wraps in try/except — need to trace the actual failure path. ## Fix Either: 1. Add a lightweight `swarm` stub package to the test dependencies 2. Fix the import guard that is leaking 3. Add `swarm` to optional dependencies in pyproject.toml ## Scope 1-3 files. The 256 errors should collapse to 0 with a proper fix. ## Verification ``` tox -e unit ``` Errors should drop from 256 to 0.
Author
Owner

@kimi — Investigate why tox -e unit produces 256 errors from ModuleNotFoundError: No module named swarm.

Steps:

  1. Run tox -e unit 2>&1 | grep ModuleNotFoundError | head -5 to confirm
  2. Trace the import chain — find which top-level import or conftest fixture pulls in swarm
  3. Fix with one of:
    a. Better import guards (try/except at the point of failure)
    b. A stub swarm package in tests/
    c. Adding swarm as optional dep

Files likely involved:

  • tests/conftest.py
  • src/dashboard/app.py
  • src/infrastructure/error_capture.py

Verify:

tox -e unit

Errors should drop from 256 to 0 (1889 passed should stay passed).

@kimi — Investigate why `tox -e unit` produces 256 errors from `ModuleNotFoundError: No module named swarm`. ### Steps: 1. Run `tox -e unit 2>&1 | grep ModuleNotFoundError | head -5` to confirm 2. Trace the import chain — find which top-level import or conftest fixture pulls in swarm 3. Fix with one of: a. Better import guards (try/except at the point of failure) b. A stub `swarm` package in tests/ c. Adding swarm as optional dep ### Files likely involved: - `tests/conftest.py` - `src/dashboard/app.py` - `src/infrastructure/error_capture.py` ### Verify: ``` tox -e unit ``` Errors should drop from 256 to 0 (1889 passed should stay passed).
kimi was assigned by Timmy 2026-03-20 23:13:32 +00:00
Author
Owner

Kimi Task — Fix #657: Missing swarm module causes 256 test errors

The swarm package is not installed, causing 256 test collection errors in tox -e unit.

What to do:

  1. Run tox -e unit and capture the actual error traceback to find the real import path causing failures
  2. The imports in src/timmy/thinking.py, src/timmy/briefing.py, etc. are already guarded — find where the guard is leaking
  3. Fix the import guard(s) OR add a minimal swarm stub to make tests collectible
  4. Verify with tox -e unit — errors should drop from 256 to 0

Files to check:

  • src/timmy/thinking.py (lines 816, 1222)
  • src/timmy/briefing.py (line 170)
  • src/dashboard/app.py (line 439)
  • tests/conftest.py — likely the real culprit
  • src/infrastructure/error_capture.py

Branch: fix/swarm-import-guard

**Kimi Task — Fix #657: Missing swarm module causes 256 test errors** The `swarm` package is not installed, causing 256 test collection errors in `tox -e unit`. **What to do:** 1. Run `tox -e unit` and capture the actual error traceback to find the real import path causing failures 2. The imports in `src/timmy/thinking.py`, `src/timmy/briefing.py`, etc. are already guarded — find where the guard is leaking 3. Fix the import guard(s) OR add a minimal `swarm` stub to make tests collectible 4. Verify with `tox -e unit` — errors should drop from 256 to 0 **Files to check:** - `src/timmy/thinking.py` (lines 816, 1222) - `src/timmy/briefing.py` (line 170) - `src/dashboard/app.py` (line 439) - `tests/conftest.py` — likely the real culprit - `src/infrastructure/error_capture.py` **Branch:** `fix/swarm-import-guard`
kimi was unassigned by Timmy 2026-03-21 01:56:56 +00:00
kimi was assigned by Timmy 2026-03-21 01:57:05 +00:00
Collaborator

Investigated this issue on branch kimi/issue-657. Running tox -e unit produces 2205 passed, 1 skipped, 0 errors — the 256 test collection errors are no longer present.

The swarm module is already properly stubbed in tests/conftest.py (lines 34-35 via sys.modules.setdefault()), and all swarm DB paths are redirected to temp directories. Lint also passes clean.

This issue appears to have been resolved by a prior commit. No code changes needed — closing as already fixed.

Investigated this issue on branch `kimi/issue-657`. Running `tox -e unit` produces **2205 passed, 1 skipped, 0 errors** — the 256 test collection errors are no longer present. The `swarm` module is already properly stubbed in `tests/conftest.py` (lines 34-35 via `sys.modules.setdefault()`), and all swarm DB paths are redirected to temp directories. Lint also passes clean. This issue appears to have been resolved by a prior commit. No code changes needed — closing as already fixed.
kimi closed this issue 2026-03-21 03:56:37 +00:00
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#657