Skip to content

test(core): add coverage reporting and expand test suite#52

Open
anhermon wants to merge 5 commits into
devfrom
chore/coverage-reporting
Open

test(core): add coverage reporting and expand test suite#52
anhermon wants to merge 5 commits into
devfrom
chore/coverage-reporting

Conversation

@anhermon

@anhermon anhermon commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add cargo-tarpaulin coverage reporting to CI with artifact upload and GitHub step summary
  • Add 10 new tests for harness-core: config defaults, API key resolution, TOML roundtrip, message constructors, content block extraction, serde roundtrips
  • Total workspace tests: 69 → 79
  • Pin tarpaulin to ~0.31 for rustc 1.86 compatibility

Verification

  • cargo test --workspace — all 79 tests pass
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • CI coverage job produces tarpaulin-report.json artifact

Baseline Coverage

45.31% — 880/1942 lines covered (established from first tarpaulin CI run)

Closes ANGA-597

🤖 Generated with Claude Code

anhermon and others added 5 commits April 5, 2026 06:05
Release: merge dev into main (26 commits)
The two auth::resolve() tests both mutate CLAUDE_CONFIG_DIR and
ANTHROPIC_API_KEY env vars. When cargo runs them in parallel, one
test can clear the vars while the other is still using them, causing
a spurious "No Anthropic credentials found" failure.

Add a static Mutex so the tests serialize their env-var access.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add cargo-tarpaulin coverage reporting to CI workflow with artifact
upload and step summary. Expand core crate tests: config defaults,
API key resolution, TOML roundtrip, message constructors, content
extraction, and serde roundtrips.

Closes ANGA-597

Co-Authored-By: Paperclip <noreply@paperclip.ing>
cargo-tarpaulin 0.35.2 pulls gimli 0.33.0 which requires rustc 1.88.
Pin to ~0.31 series which compiles on the stable rustc 1.86 in CI.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
The parser was looking for top-level covered_lines/coverable_lines keys
which don't exist in tarpaulin's JSON output. Parse the actual traces
array from file entries instead.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@anhermon

anhermon commented Apr 6, 2026

Copy link
Copy Markdown
Owner Author

Review: PR #52

Recommendation: Close in favor of PR #53.

PR #53 is a strict superset of this PR. It covers the same core/config.rs and core/message.rs tests with better depth (8 config tests vs 5, 8 message tests vs 5), and adds tests for tools/registry.rs, tools/schema.rs, and paperclip/types.rs — 135 total tests vs 79. Merging both would create conflicts in the same files.

Issues in #52 not present in #53:

  1. CI coverage job: The inline Python script for parsing tarpaulin-report.json is fragile — the JSON schema varies across tarpaulin versions. PR test(core,tools,paperclip): add coverage reporting and expand test suite #53 avoids this by just uploading XML/HTML artifacts.

  2. Tarpaulin version pin: --version "~0.31" will break when 0.32 ships. PR test(core,tools,paperclip): add coverage reporting and expand test suite #53 omits the pin, which is simpler.

  3. Missing ENV_LOCK in one test: resolved_api_key_prefers_config_value doesn't acquire the mutex — if ANTHROPIC_API_KEY is set in the environment, the test passes for the wrong reason.

Action: Close this PR and proceed with #53.

@anhermon anhermon left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CTO Review — Close in favor of #53

PR #52 is a subset of #53 (79 tests vs 135, 4 files vs 6). Has additional issues: fragile inline Python parser, tarpaulin version pin (~0.31 will break), missing ENV_LOCK guard on config test.

#53 is the strict superset. Recommend closing #52 and merging #53 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant