Skip to content

fix(backups): queue the manual backup through the bus dispatcher - #295

Open
roncodes wants to merge 1 commit into
release/v1.6.69from
fix/database-backup-dispatch
Open

roncodes wants to merge 1 commit into
release/v1.6.69from
fix/database-backup-dispatch

Conversation

@roncodes

@roncodes roncodes commented Oct 7, 2026

Copy link
Copy Markdown
Member

PHP CI on release/v1.6.69 fails in DatabaseBackupsTest with Call to undefined method Fleetbase\Jobs\RunDatabaseBackup::dispatch() (runs 37580012747, 37578658850).

Cause: several test files define an empty Illuminate\Foundation\Bus\Dispatchable shim (for example tests/Unit/Jobs/LogApiRequestTest.php). When one of them loads before RunDatabaseBackup, the job gets the empty trait and has no static dispatch(). The failure therefore depends on test order.

Fix: DatabaseBackupController::run() dispatches new RunDatabaseBackup(...) through the Illuminate\Contracts\Bus\Dispatcher contract. That is the same at runtime, and the existing test already asserts on the bus fake bound to that contract.

This also unblocks #290 (socket auth), which now targets this release branch.

Test plan: verified by CI (PHP CI on this PR).

RunDatabaseBackup::dispatch() comes from the Dispatchable trait. Several test
files define an empty Illuminate\Foundation\Bus\Dispatchable shim, so when one
of them loads first the static dispatch() is missing and DatabaseBackupsTest
fails depending on test order (PHP CI on release/v1.6.69 fails this way).
Dispatching through the bus contract behaves the same at runtime and does not
depend on the trait.
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d569a22) to head (b02d948).
⚠️ Report is 10 commits behind head on release/v1.6.69.

Additional details and impacted files
@@                 Coverage Diff                  @@
##             release/v1.6.69      #295    +/-   ##
====================================================
  Coverage             100.00%   100.00%            
- Complexity              7940      8059   +119     
====================================================
  Files                    438       443     +5     
  Lines                  25670     25974   +304     
====================================================
+ Hits                   25670     25974   +304     
Flag Coverage Δ
backend 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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