Repository navigation
fix(sandbox): copy only the columns the sandbox tables have - #404
Merged
Merged
Conversation
copyAccountToSandbox() copied every live companies/users column into the sandbox. Extensions that skip sandbox migrations (billing adds companies.resource_units and resource_units_updated_at) leave columns that exist only in live, so creating a driver or contact with a test API key failed with 1054 Unknown column 'resource_units' (HTTP 500). Co-Authored-By: Claude <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #404 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 13585 13586 +1
===========================================
Files 634 634
Lines 49308 49311 +3
===========================================
+ Hits 49308 49311 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Incident
Fleetbase Cloud sandbox ("test mode") 500s. This PR fixes the fleetops part: creating a driver or contact with a
flb_test_key returns HTTP 500. TheGET /v1/*500s and the console 500s are fixed in fleetbase/billing#41, fleetbase/internals#58 and the registry-bridge PR.Root cause
ProfileAccountManager::copyAccountToSandbox()(from #378) copies the livecompaniesandusersrows into the sandbox database with every live column. Extensions that setsandbox-migrations: falseadd columns that exist only in live. Billing's2026_01_17_000001_add_resource_units_to_companiesaddscompanies.resource_unitsandresource_units_updated_at, so on Cloud the upsert fails:Reproduction (local fleetbase-dev stack)
POST /v1/driverswith a local test key returns 500 with the error above.copyAccountToSandbox()in-process against the real MySQLfleetbase_sandbox:1054 Unknown column 'resource_units'Fix
Before the upsert, reduce each copied row to the columns the sandbox table actually has (
Schema::connection('sandbox')->getColumnListing()). Theidcolumn is still dropped as before.Tests
test key requests copy only the columns the sandbox tables have: livecompaniesandusersget extra live-only columns that the sandbox lacks. Onmainit fails withtable companies has no column named resource_units; on this branch it passes.scripts/pest-runner.php server/tests/Unit/Support/ProfileAccountManagerTest.php: 14 passed. Before the fix: 13 passed and the new test failed.scripts/pest-file-runner.php(full suite, PHP 8.4): exit 0 across all 513 files.ProfileAccountManager.phpon this test file: no uncovered statements.Deploy note
No migration. Takes effect when fleetops is bumped in the fleetbase repo's Cloud deploy.
🤖 Generated with Claude Code