Skip to content

πŸ§ͺ Test gap analysis β€” 3 gaps found in compile/job, compile/stage, and update_checkΒ #647

@github-actions

Description

@github-actions

Test Gap Analysis

Test suite snapshot: 1,733 total tests β€” all pass βœ…
Previous open issue covering earlier gaps: #376 (still open β€” generate_lean_prompt, init_logging, MCP tools list).

This issue tracks three new gaps discovered in the 2026-05-19 cycle that are not covered by #376.


Priority Gaps

Module Function/Path Why It Matters Suggested Test
compile/job.rs generate_job_header() β€” repositories block (line 84–95) The if !front_matter.repositories.is_empty() branch is never entered by any test. The generated header comment tells pipeline authors how to wire up resources: repositories: β€” a silent regression here would silently produce wrong documentation in every emitted job-template Compile a target: job fixture that includes a repos: entry and assert the output header contains resources: and repositories:
compile/stage.rs generate_stage_header() β€” repositories block (line 85–96) Identical pattern to the job gap above. Neither job-agent.md nor stage-agent.md fixture has a repos: field, so the branch is permanently skipped Compile a target: stage fixture with one repository and assert header contains the full resources: repositories: block with correct alias, type, and name
update_check.rs parse_version() β€” pre-release suffix and invalid-input paths The code comment explicitly documents: "Pre-release suffixes on the patch component (e.g. "3-beta") are accepted" β€” but no test exercises this path. If parse_version regresses on a v0.31.0-beta.1 tag, check_for_update silently swallows the None result and the user gets no update notice Unit-test parse_version directly via is_newer: pre-release suffix, two-component version, and non-numeric inputs all returning false

Suggested Test Cases

1. generate_job_header() β€” repos documentation block

Add a fixture tests/fixtures/job-agent-with-repos.md:

---
name: "Job Agent With Repos"
description: "Tests the repos documentation block in job header"
target: job
repos:
  - alias: my-utils
    org: my-org
    repo: utils
---

## Job Agent With Repos

Review code changes using an additional repository.

Then in tests/compiler_tests.rs:

#[test]
fn test_job_header_contains_repos_documentation() {
    let dir = tempdir().unwrap();
    copy_fixture_to_dir("job-agent-with-repos.md", &dir);
    let output = compile_fixture_in_dir("job-agent-with-repos.md", &dir);

    assert!(
        output.contains("resources:"),
        "job header should document resources block when repos are defined"
    );
    assert!(
        output.contains("repositories:"),
        "job header should list repositories"
    );
    assert!(
        output.contains("- repository: my-utils"),
        "job header should list the repo alias"
    );
}

2. generate_stage_header() β€” repos documentation block

Same approach with a target: stage fixture, asserting the resources: repositories: block also appears in the stage-template header comment with correct type: and name: lines:

#[test]
fn test_stage_header_contains_repos_documentation() {
    let dir = tempdir().unwrap();
    copy_fixture_to_dir("stage-agent-with-repos.md", &dir);
    let output = compile_fixture_in_dir("stage-agent-with-repos.md", &dir);

    assert!(output.contains("# Add these repositories to your pipeline's resources: block:"));
    assert!(output.contains("#     repositories:"));
    assert!(output.contains("#       - repository: my-utils"));
    assert!(output.contains("#         type: git"));
    assert!(output.contains("#         name: my-org/utils"));
}

3. update_check.rs β€” parse_version() pre-release and invalid inputs

Add to the existing tests block in src/update_check.rs:

#[test]
fn pre_release_suffix_is_treated_as_newer() {
    // "0.31.0-beta.1" β†’ patch leading digits = 0, so NOT newer than 0.30.2
    // This tests that the suffix is stripped and doesn't cause a panic or None
    assert!(!is_newer("0.31.0-beta.1", "0.31.0"));
    // But it should still detect a newer major component
    assert!(is_newer("1.0.0-rc.1", "0.31.0"));
}

#[test]
fn invalid_version_strings_are_not_newer() {
    assert!(!is_newer("not-a-version", "0.30.2"));
    assert!(!is_newer("", "0.30.2"));
    assert!(!is_newer("0.31", "0.30.2")); // only two components
    assert!(!is_newer("0.30.2", "not-a-version")); // invalid current
}

Coverage Summary

Module Public/Key Fns Tests Notes
compile/job.rs generate_job_header repos branch: 0 No target: job + repos: fixture exists
compile/stage.rs generate_stage_header repos branch: 0 No target: stage + repos: fixture exists
update_check.rs parse_version (private) pre-release + invalid: 0 Documented behaviour not tested; 6 happy-path tests exist via is_newer

This issue was created by the automated test gap finder. Previous run: 2026-05-18 (gaps noted, threshold not met). Open issue with earlier gaps: #376. Modules audited this cycle: update_check (new), compile/job (re-audited), compile/stage (re-audited). Total tests found: 1,733 (was 1,724 last cycle, +9).

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

Generated by Test Gap Finder Β· ● 875K Β· β—·

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