Skip to content

Library test coverage — OutputManager integration, cyclic deps, serialization, filekit fallback #67

@djdarcy

Description

@djdarcy

Library test coverage — OutputManager integration, cyclic deps, serialization, filekit fallback

Problem

core_lib and plan_lib shipped with solid unit tests (33 + 50 = 83 tests), but six areas identified during implementation remain untested:

  1. OutputManager + renderer integration — THAC0 level filtering through the plan renderer is untested. render_plan() calls print_*() functions but no test verifies that verbosity levels actually filter plan output.

  2. Cyclic dependency detectionAction.depends_on supports dependency chains, and _resolve_execution_order() handles them, but no test exercises a cycle (A→B→A). The handler exists but is unverified.

  3. Serialization round-tripAction and Plan are dataclasses with .asdict() support, but no test verifies asdict() → JSON → reconstruct for the "saved plans" promise.

  4. dazzle_filekit fallback — plan_lib's file_ops.py has a conditional import for dazzle_filekit with a stdlib fallback. No test verifies the fallback path works when dazzle_filekit isn't installed.

  5. Large plan stress — No test exercises plans with 50+ actions to verify performance of dependency resolution and rendering at scale.

  6. ANSI rendering correctness — The renderer uses ANSI escape codes for terminal output, but no test verifies the output matches expected formatting (could use snapshot testing).

These gaps were identified in the 2026-03-02__18-33-23 gap analysis during the core_lib/plan_lib implementation session.

Proposed solution

A focused test module for each gap area:

# tests/test_lib_integration.py

class TestOutputManagerRendererIntegration:
    """Verify THAC0 level 0 shows summary, level 2 shows full details"""

class TestCyclicDependency:
    """Verify A→B→A raises CyclicDependencyError with clear message"""

class TestSerializationRoundTrip:
    """Verify Action/Plan survive asdict() → JSON → reconstruct"""

class TestFileKitFallback:
    """Verify plan_lib works without dazzle_filekit installed"""

class TestLargePlanPerformance:
    """Verify 100-action plan resolves and renders in <1 second"""

class TestANSIRendering:
    """Snapshot test for renderer output format"""

Implementation approach

These can be built incrementally — each test class is independent:

  • Phase A (high value): Cyclic deps + serialization round-trip — these catch real bugs
  • Phase B (medium value): OutputManager + renderer integration + filekit fallback — these catch integration gaps
  • Phase C (low priority): Large plan stress + ANSI rendering — these catch edge cases

Acceptance criteria

  • Cyclic dependency test exists and verifies error handling
  • Serialization round-trip test: Actionasdict() → JSON string → dict → verify all fields preserved
  • OutputManager integration test: renderer respects THAC0 verbosity levels
  • dazzle_filekit fallback test: file_ops.py works when import fails
  • All new tests pass alongside existing 83 tests
  • At least one test per gap area from the list above

Related issues

Analysis

See 2026-03-02__20-16-20__full-postmortem_core-lib-plan-lib-and-session-discoveries.md for the gap identification during implementation.
See 2026-03-02__21-48-45__dev-workflow-process_missing-issues-and-plan-gaps.md for gap analysis (Gap 4).

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingTest infrastructure, harness, and coverage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions