Skip to content

πŸ§ͺ Test gap analysis β€” 3 gaps found in lean runtime, logging, and MCP tools listΒ #376

@github-actions

Description

@github-actions

Test Gap Analysis

Test suite snapshot: 968 unit tests, 69 integration tests (tests/compiler_tests.rs), 3 init tests, 8 MCP HTTP tests β€” 1,049 total. All pass. βœ…

Previous issue #242 was closed as completed β€” all 11 prior gaps were fixed. New gaps introduced since then (latest commit: 05fede2 β€” refactor(safe-outputs): rename upload-attachment to upload-workitem-attachment).


Priority Gaps

Module Function/Path Why It Matters Suggested Test
runtimes/lean/mod.rs generate_lean_prompt() β€” public fn, 0 callers, 0 tests Dead code that diverges silently from LeanExtension::prompt_supplement() inline text; if someone updates one and not the other, the agent receives the wrong prompt Remove the fn or wire it up; add test asserting output matches LeanExtension::prompt_supplement() content
src/logging.rs init_logging() β€” 5 conditional branches, 0 tests Selects log level from debug/verbose/RUST_LOG/default flags, then falls back to env_logger on failure. The fallback path and the level-selection logic are completely untested Unit test each branch: debug β†’ Debug, verbose β†’ Info, fallback β†’ returns None
tests/mcp_http_tests.rs test_mcp_initialize_and_tools_list β€” doesn't assert upload-workitem-attachment Tool was renamed in #372 from upload-attachment; the tools-list test still only checks noop, create-work-item, create-pull-request, missing-tool, missing-data. A silent MCP registration failure for the renamed tool would go undetected Add assert!(body.contains("upload-workitem-attachment"), ...)

Suggested Test Cases

1. generate_lean_prompt() β€” remove dead code or wire it up and test

The function in src/runtimes/lean/mod.rs is never called. LeanExtension::prompt_supplement() in src/runtimes/lean/extension.rs contains the same content inline. The two should be unified:

// Option A: use generate_lean_prompt() from prompt_supplement()
fn prompt_supplement(&self) -> Option<String> {
    Some(generate_lean_prompt())
}

Then add a unit test:

// In src/runtimes/lean/mod.rs tests block
#[test]
fn test_generate_lean_prompt_matches_extension_supplement() {
    let ext = LeanExtension::new(LeanRuntimeConfig::Enabled(true));
    let supplement = ext.prompt_supplement().expect("Lean should have a prompt supplement");
    let generated = generate_lean_prompt();
    assert_eq!(supplement, generated,
        "generate_lean_prompt() and LeanExtension::prompt_supplement() must stay in sync");
}

#[test]
fn test_generate_lean_prompt_contains_key_content() {
    let prompt = generate_lean_prompt();
    assert!(prompt.contains("Lean 4 is installed"), "should mention Lean 4");
    assert!(prompt.contains("lean"), "should mention lean command");
    assert!(prompt.contains("lake"), "should mention lake command");
    assert!(prompt.contains(".lean"), "should mention .lean extension");
}

2. init_logging() β€” branch coverage

// In src/logging.rs tests block
#[test]
fn test_init_logging_debug_flag_returns_some_path() {
    // debug=true should succeed and return a log path
    let result = init_logging("test-debug", true, false);
    // May be None if the log dir can't be created in CI, but shouldn't panic
    let _ = result; // just ensure it doesn't panic
}

#[test]
fn test_init_logging_verbose_flag() {
    let result = init_logging("test-verbose", false, true);
    let _ = result;
}

#[test]
fn test_init_logging_default_flags() {
    // Neither debug nor verbose β€” uses Warn level
    let result = init_logging("test-default", false, false);
    let _ = result;
}

#[test]
fn test_init_logging_with_rust_log_set() {
    // RUST_LOG set β€” should use Info level
    std::env::set_var("RUST_LOG", "info");
    let result = init_logging("test-rust-log", false, false);
    let _ = result;
    std::env::remove_var("RUST_LOG");
}

3. MCP tools list β€” assert renamed tool is registered

// In tests/mcp_http_tests.rs, add to test_mcp_initialize_and_tools_list:
assert!(
    body.contains("upload-workitem-attachment"),
    "Should list upload-workitem-attachment tool (renamed from upload-attachment in #372), body: {body}"
);

Coverage Summary

Module Public Fns Tests Notes
runtimes/lean/mod.rs generate_lean_prompt 0 (0 callers) Dead code β€” diverges from inline prompt_supplement()
src/logging.rs init_logging 0 5 branches untested; fallback path (env_logger) untested
tests/mcp_http_tests.rs test_mcp_initialize_and_tools_list asserts 5/~20 tools upload-workitem-attachment (just renamed) not asserted

This issue was created by the automated test gap finder. Previous run: 2026-04-30 (issue #242, now closed βœ…). Modules audited this cycle: all. Total tests found: 1,049 (up from 1,015).

Generated by Test Gap Finder Β· gh-aw-workflow-call-id: githubnext/ado-aw/test-gap-finder

Generated by Test Gap Finder Β· ● 3M Β· β—·

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions