Skip to content

Improve Fleet-Ops server test coverage#277

Draft
roncodes wants to merge 48 commits into
mainfrom
feature/fleetops-server-coverage-100
Draft

Improve Fleet-Ops server test coverage#277
roncodes wants to merge 48 commits into
mainfrom
feature/fleetops-server-coverage-100

Conversation

@roncodes

@roncodes roncodes commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

This is a progressive backend-only coverage PR for Fleet-Ops ./server. The current batch expands executable coverage across the package bootstrap harness, route registration, reporting schema contracts, telematics helpers, Lalamove integration value/request flows, resource serialization, support contracts, and request/resource formatting.

The branch now verifies coverage locally through the same server workflow coverage command used in CI, while keeping the 100% line fail-under gate in place for the final target.

Coverage Progress

Checkpoint Line coverage Method coverage Class coverage
Previous verified baseline 10.81% (3,603 / 33,333) 11.54% (401 / 3,475) 0.00% (0 / 521)
Latest verified local run 16.79% (5,598 / 33,333) 12.92% (449 / 3,475) 0.00% (0 / 521)
Delta +5.98 points (+1,995 statements) +1.38 points (+48 methods) unchanged

What Changed

  • Added backend coverage for Fleet-Ops route registration so server/src/routes.php is executed and important API/internal groups and endpoints are asserted.
  • Added reporting schema coverage for FleetOpsReportSchema, including table registration, relationships, computed columns, and transformer contracts.
  • Added telematics service helper coverage for identity resolution, timestamps, status handling, telemetry reconciliation helpers, location defaults, sensor normalization, and event-key generation.
  • Added Lalamove integration coverage for market/service type value objects, delivery stops, request signing, URL construction, quotation/order calls, and cancellation error handling through mocked Guzzle clients.
  • Added vehicle resource coverage for internal/public serialization and webhook payloads for Vehicle and VehicleWithoutDriver.
  • Hardened the lightweight Pest bootstrap with missing config/response/request bindings and small compatibility shims needed by standalone backend tests.
  • Fixed the active revenue metric query to use Fleet-Ops-owned status/direction constants instead of constants missing from the locked local Core API dependency.
  • Updated barryvdh/laravel-dompdf to ^3.1 so PHP CI fresh installs resolve Dompdf 3.x instead of the security-blocked Dompdf 2.x line.
  • Applied PHP CS Fixer formatting to backend request/test files touched by the coverage slice.

Local Validation

  • composer test:lint passes.
  • composer test:unit passes.
  • XDEBUG_MODE=coverage composer test:coverage:clover passes and writes coverage/clover.xml.
  • XDEBUG_MODE=coverage composer coverage:baseline passes and reports the latest coverage percentages above.
  • Fresh no-lock Composer install dry-run from composer.json resolves successfully and selects barryvdh/laravel-dompdf v3.1.2 / dompdf/dompdf v3.1.6, matching CI's ignored-lock install behavior.
  • git diff --check and git diff --cached --check pass.
  • XDEBUG_MODE=coverage composer coverage:check correctly fails below the configured 100% line threshold, currently at 16.79%; this confirms the final fail-under gate is wired and still enforcing the end goal.

Known Local Gate Status

  • The package PR workflow currently runs composer lint, composer test:unit, and XDEBUG_MODE=coverage composer coverage:baseline; those paths were verified locally before pushing this batch.
  • The aggregate composer test command also runs composer test:types. Running it locally outside the sandbox reaches PHPStan and fails with the existing source-analysis backlog (13,300 PHPStan errors across server/src). That type gate is not currently part of .github/workflows/server.yml, but it remains a separate local cleanup item before composer test can be called fully green.

Next Coverage Targets

  • High-volume zero-coverage controllers remain the largest path to 100%, starting with API/internal order, driver, customer, search, setting, service quote, and vehicle controllers.
  • Other large uncovered backend surfaces include SyncTelematicDevicesJob, OrderFilter, Contact, Maintenance, DeviceEvent, Sensor, and maintenance schedule internals.

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