P2-05: Zero unit tests for core decider modules — only plugin has tests #15

Closed
opened 2026-06-16 13:57:01 +00:00 by Artur · 0 comments
Owner

Severity: P2 (Medium)
File: tests/ directory

Problem

Current test coverage:

  • tests/test_decider_plugin.py — 848 lines, 100 tests (covers Hermes plugin only)
  • No tests for core modules: config.py, llm.py, matrix.py, ensemble.py, precedent.py, adr.py, server.py, cli.py, util.py

The gap analysis (#213) flagged this, but it was never resolved. Core modules with zero tests include:

  • Critical paths: decision logic, threshold evaluation, precedent lookup/storage
  • Security critical: sanitize_input, fence_input, extract_json
  • Integration: full round-trip without Hermes dependency

Fix

Create tests/test_decider_core.py with tests for each core module:

  • test_config.py: load_config edge cases (missing file, bad JSON, missing fields)
  • test_llm.py: retry logic, jitter, timeout (mock HTTP)
  • test_util.py: sanitize_input (all injection patterns), fence_input, extract_json (fences, markdown, multiple JSON)
  • test_matrix.py: score clamping, threshold logic, parse errors
  • test_ensemble.py: weight calculation, agreement metric, error handling, timeout
  • test_precedent.py: hash collisions, normalization, concurrent writes
  • test_adr.py: filename safety, collision resistance, content structure
  • test_cli.py: stdin parsing (JSON + plain text), --mode flags
  • test_server.py: auth, rate limiting, cache, body limits
**Severity**: P2 (Medium) **File**: `tests/` directory ## Problem Current test coverage: - ✅ `tests/test_decider_plugin.py` — 848 lines, 100 tests (covers Hermes plugin only) - ❌ **No tests for core modules**: `config.py`, `llm.py`, `matrix.py`, `ensemble.py`, `precedent.py`, `adr.py`, `server.py`, `cli.py`, `util.py` The gap analysis (#213) flagged this, but it was never resolved. Core modules with zero tests include: - **Critical paths**: decision logic, threshold evaluation, precedent lookup/storage - **Security critical**: sanitize_input, fence_input, extract_json - **Integration**: full round-trip without Hermes dependency ## Fix Create `tests/test_decider_core.py` with tests for each core module: - `test_config.py`: load_config edge cases (missing file, bad JSON, missing fields) - `test_llm.py`: retry logic, jitter, timeout (mock HTTP) - `test_util.py`: sanitize_input (all injection patterns), fence_input, extract_json (fences, markdown, multiple JSON) - `test_matrix.py`: score clamping, threshold logic, parse errors - `test_ensemble.py`: weight calculation, agreement metric, error handling, timeout - `test_precedent.py`: hash collisions, normalization, concurrent writes - `test_adr.py`: filename safety, collision resistance, content structure - `test_cli.py`: stdin parsing (JSON + plain text), --mode flags - `test_server.py`: auth, rate limiting, cache, body limits
Artur closed this issue 2026-06-16 14:24:07 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
glow-all/decider#15
No description provided.