# Phase 5.5: Phase Summary — Technical Debt & Test Gaps Reset

## What Was Built

A maintenance phase addressing 4 tech debt items and 8 test quality issues identified in `technical_debt.md` and `test_audit.md`. All items were zero-risk or very-low-risk. No new features, no architectural changes.

## Changes by File

### Source Code (4 files)

| File | Change | Debt Issue |
|------|--------|------------|
| `analysis/testing.py` | `tier` type narrowed to `Literal["basic", "enhanced"]`; removed `# type: ignore` | #10 |
| `db/repositories/file_snapshot.py` | `contextlib.suppress(ValueError)` → `try/except` with `logger.warning` | #12 |
| `analysis/adapters/javascript_adapter.py` | Added `__init__` caching `Parser(_JS_LANGUAGE)` on instance | #13 |
| `analysis/adapters/typescript_adapter.py` | Added `__init__` caching both `_ts_parser` and `_tsx_parser` on instance | #13 |
| `config.py` | Removed `_BASE_DIR` module constant; `load_config()` and `get_campaign_dir()` accept `base_dir: Path | None` param | #2 |

### Test Files (5 files)

| File | Change | Audit Card |
|------|--------|------------|
| `test_db_connection.py` | Strengthened `test_idempotent_double_init` with table/meta assertions | SMELL-001 |
| `test_scoring.py` | Replaced mirror test with behavioral assertion (score > 100, not == 200) | SMELL-002 |
| `test_config.py` | Replaced hash mirror test with `test_different_repos_produce_different_dirs`; updated all campaign dir tests to use `base_dir` param instead of patching `_BASE_DIR` | SMELL-004 |
| `test_adapters.py` | Added `TestPythonAdapterDetectAppType` (6 tests: Flask, FastAPI, Typer, attribute access, Django, plain code) | GAP-003 |
| `test_repositories.py` | Added 5 new test classes: `get_missions_for_module` (2 tests), `get_by_path` (3 tests), campaign `update()` (3 tests), module `update()` (2 tests), chain CRUD gaps (6 tests) | GAP-004/005/006/007 |

## Key Decisions

**Injectable `_BASE_DIR` over config refactor.** We chose the additive approach (add `base_dir` param with default) over the more structural option of splitting `config.py` (Debt Issue #4). The additive change achieves testability without touching callers or creating new modules. Issue #4 is deferred to a future phase when it can be done alongside Phase 6 config work.

**Behavioral test properties over exact values.** The scoring test now asserts `score > 100` (higher than any single signal) rather than `== 200` (the exact sum). This makes the test resilient to weight rebalancing while still verifying that all signals are additive.

**Hash test replaced with uniqueness test.** Rather than asserting a specific SHA-256 hex string (testing Python's hashlib), the test now verifies the behavioral property: different repos produce different directories.

## Connection to Previous Phases

**Builds on**: Phase 5 (test suite, 255 tests). This phase adds ~22 new tests and improves 3 existing ones.

**Sets up for**: Phase 6 (LLM integration). The codebase now has injectable config paths (testable without filesystem), cached parsers (better performance), correct types (no type: ignore workarounds), and broader test coverage for the repository layer that Phase 6 will depend on.

## What Remains

From `technical_debt.md`: Issues 1 (UNIQUE constraints), 4 (config SRP split), 8 (DRY import resolution) are deferred.

From `test_audit.md`: 15 cards remain — all MUTANT and BOSS cards, plus SMELL-003, GAP-001, GAP-002. These are deeper investigations best addressed in future maintenance phases.
