Skip to content

Increase AI server test coverage - #4

Draft
roncodes wants to merge 46 commits into
mainfrom
feature/ai-server-coverage
Draft

Increase AI server test coverage#4
roncodes wants to merge 46 commits into
mainfrom
feature/ai-server-coverage

Conversation

@roncodes

@roncodes roncodes commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

This draft PR wires backend coverage reporting into the AI package CI and brings the backend-only ./server test target to full coverage.

It also fixes the class coverage reporting bug. Clover can omit aggregate coveredclasses, which previously made the summary report 0.00% class coverage even when file-level class metrics were present. The coverage summary now derives class coverage from file-level metrics when the aggregate value is missing.

The backend tests have also been organized into explicit PHPUnit suites instead of living as a flat list under server/tests.

Current Coverage

Latest successful backend CI run: 30200831059

Metric Current Covered / Total
Line coverage 100.00% 1332 / 1332 statements
Method coverage 100.00% 152 / 152 methods
Class coverage 100.00% 23 / 23 classes

Latest Clover check reports no uncovered backend statements.

Test Organization

phpunit.xml.dist now defines two backend suites:

  • unit: server/tests/Unit
  • feature: server/tests/Feature

Current structure:

  • server/tests/Unit/Services: service/provider/query/task/attachment unit coverage
  • server/tests/Unit/Support: support registry, capability, temporal, and queryable-resource coverage
  • server/tests/Unit/Coverage: coverage-reporting regression coverage
  • server/tests/Feature/Http: controller, model, provider-flow, and HTTP-facing behavior coverage
  • server/tests/Support/helpers.php: shared test helpers loaded by the Pest bootstrap

This removes the old flat test layout and avoids hidden test file load-order coupling by centralizing shared helpers and resetting HTTP fakes for provider tests.

Coverage Added

  • Added regression coverage for the class coverage summary calculation.
  • Expanded backend Pest coverage across attachment resolution, task/session controllers, admin endpoints, query executor authorization paths, provider guards, usage labels, task apply/session flows, and task/provider error handling.
  • Added protected query/helper seams where needed so tests can exercise backend branches without executing real database queries.
  • Excluded only framework-bound adapter defaults from coverage: package-load guards, Eloquent static query/create adapters, Laravel Setting/Auth/DB facade adapters, and the isolated Anthropic test-error HTTP boundary. Their calling behavior is covered through injectable/overridable helpers.
  • Fixed test formatting under the repository PHP CS Fixer rules so CI lint remains stable.

Validation

  • composer lint
  • php -l on touched backend source/test files
  • git diff --check
  • git diff --cached --check
  • GitHub Actions PHP CI passed with coverage artifact on run 30200831059
  • GitHub Actions Ember.js CI passed on run 30200831096

Notes

Local composer test:unit remains blocked in this shell because Pest dependencies are not installed locally (Unable to find Pest. Run composer install first.). CI installs dependencies and is the authoritative backend test/coverage signal for this PR.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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