githubnext / githubnext/ado-aw

🧪 Test gap analysis — 3 gaps found in compile/job, compile/stage, and update_check

Open
#647 0 comments 0 reactions 0 assignees View on GitHub
testing
Dominant language
Rust
Stars
23
Forks
8
Avg merge
4d 9h
Merged PRs (30d)
22

Description

## 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`:

```markdown
---
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`:

```rust
#[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:

```rust
#[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`:

```rust
#[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](https://github.com/githubnext/ado-aw/actions/runs/26097257415/agentic_workflow) · gh-aw-workflow-call-id: githubnext/ado-aw/test-gap-finder

> Generated by [Test Gap Finder](https://github.com/githubnext/ado-aw/actions/runs/26097257415/agentic_workflow) · ● 875K · [◷](https://github.com/search?q=repo%3Agithubnext%2Fado-aw+is%3Aissue+%22gh-aw-workflow-call-id%3A+githubnext%2Fado-aw%2Ftest-gap-finder%22&type=issues)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.