Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
v0.7.65 Fleetbase `0.7.56` focuses on security, API reliability, and release-branch fixes across Core API, Dev Engine, Fleet-Ops, Storefront, and the root Fleetbase app. It fixes API credential revocation, persistent database transaction behavior, lifecycle webhook signing, driver and order configuration workflows, signature custom-field handling, Octane transaction diagnostics, and several Storefront checkout/payment edge cases.
Ronald A. Richardsonae782d951277
diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.ymlindex 2a92ed92..069634a2 100644--- a/.github/workflows/build-binaries.yml+++ b/.github/workflows/build-binaries.yml@@ -19,11 +19,19 @@ jobs:runs-on: ubuntu-lateststeps:- - uses: actions/checkout@v3+ - uses: actions/checkout@v4- name: Build Linux binaryrun: |+ set -o pipefailchmod +x ./builds/linux/build-linux.sh- ./builds/linux/build-linux.sh+ ./builds/linux/build-linux.sh 2>&1 | tee build-linux.log+ - name: Upload Linux build log+ if: failure()+ uses: actions/upload-artifact@v4+ with:+ name: fleetbase-linux-build-log+ path: build-linux.log+ if-no-files-found: ignore- name: Upload Linux binaryif: github.event_name == 'workflow_run'uses: softprops/action-gh-release@v2@@ -41,7 +49,7 @@ jobs:runs-on: macos-lateststeps:- - uses: actions/checkout@v3+ - uses: actions/checkout@v4- name: Install build dependenciesrun: |brew update@@ -61,4 +69,4 @@ jobs:${{ env.DIST_DIR }}/fleetbase-darwin-arm64draft: falseenv:- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\ No newline at end of file+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}diff --git a/RELEASE.md b/RELEASE.mdindex ac1761d8..d64861fc 100644--- a/RELEASE.md+++ b/RELEASE.md@@ -1,50 +1,85 @@-> v0.7.55 ~ "Verification email delivery restored and a fully covered Console"+> v0.7.56 ~ "Credential revocation, Fleet-Ops driver workflows, and Storefront checkout hardening"---## Highlights-Fleetbase `0.7.55` is a quality and reliability release. It ships Core API `1.6.59`, which repairs the verification and credentials mail templates — both failed to compile, so every flow that delivers a code returned an error instead of sending. It also takes the Console test suite from 70% to 100% coverage on all four metrics, turns the coverage gate on so it cannot regress, and fixes ten Console defects found while writing those tests.+Fleetbase `0.7.56` focuses on security, API reliability, and release-branch fixes across Core API, Dev Engine, Fleet-Ops, Storefront, and the root Fleetbase app. It fixes API credential revocation, persistent database transaction behavior, lifecycle webhook signing, driver and order configuration workflows, signature custom-field handling, Octane transaction diagnostics, and several Storefront checkout/payment edge cases.---## Component Versions-- `console`: `0.7.55`-- `core-api`: `1.6.59`--All other modules are unchanged from `0.7.54`.+- `fleetbase`: `0.7.56`+- `core-api`: `1.6.60`+- `dev-engine`: `0.2.15`+- `fleetops`: `0.6.61`+- `storefront`: `0.4.20`---## Core API-- Fixed the verification and user-credentials mail views, which did not compile. Blade only treats `@` as a directive when the preceding character is not a word character — the rule that keeps `[email protected]` from compiling — so a greeting written as `Morning@if($user->name)` was left as literal text while its `@endif` compiled normally. The unmatched `endif` broke the enclosing conditional and the view threw on render.-- Restored delivery for every endpoint that sends a code: customer signup, SMS login with email fallback, password reset, account closure, and driver login all returned a `400` carrying the Blade error.-- The defect was introduced in `1.6.56` by the fix for a null user name, and shipped again in `1.6.57` and `1.6.58`. Anyone on those three versions is affected and should upgrade.+- Fixed API credential revocation so deleted credentials and immediately expired keys stop authenticating.+- Keys created by removed users now fail closed instead of continuing to authorize requests.+- Disabled persistent PDO connections by default to prevent shared MySQL transaction state from leaking between requests.+- Fixed lifecycle webhooks signed by queue workers so each event uses the correct company, credential, environment, and secret.+- Fixed URL building with query parameters and added report execution statistics columns.++---+## Dev Engine+- Fixed API key expiration editing so relative expiration values persist instead of being nulled by the date transform.+- Added regression coverage for the API key expiration dropdown flow.+- Added release-tag automation support for Dev Engine release branches.++---+## Fleet-Ops+- Added driver-facing route manifests so drivers can read, run, and re-sequence route stops.+- Added a driver card view with a persisted card/table layout preference.+- Published the order configuration flow graph so API consumers can sequence order setup steps.+- Added configurable Leaflet tile providers with keyless OpenStreetMap defaults.+- Fixed vehicle updates dropping odometer values.+- Fixed issue and fuel-report list filters so driver-scoped aliases apply correctly.+- Fixed driver password updates, driver creation password persistence, unsaved geocoded place editing, sensor creation defaults, register-device routes, fuel report creation, geofence driver history, QR debug output, and maintenance vehicle schedule workflows.+- Reduced duplicate release-branch CI runs.----## Console-- Took the Console test suite from 70% to 100% coverage on lines, statements, functions, and branches, growing it from 577 to 1150 tests.-- Made the coverage gate blocking. `console.yml` runs `coverage:check -- --fail-under=100` without `continue-on-error`, so a regression in any of the four metrics fails the build.-- Fixed infinite recursion in the onboarding orchestrator: skipping a guarded step resolved the same rejected step and handed it back, spinning until the tab died.-- Fixed the installation service treating runloop timer id `0` as "nothing pending", which double-subscribed to the install channel and left a retry firing after listening stopped.-- Fixed a failed dashboard metric request leaving the card spinning forever, and dashboard count formatters being called with a params array instead of positional arguments — `money` ignored the configured currency and `date` threw on render.-- Fixed `models/report` owner resolution and export queries, and the lowercase `config.api` key in `models/file` and `models/chat-attachment` that left host and namespace undefined.-- Fixed missing promise returns in `invite/for-user` and admin organization users, a missing `notifications` injection in the two-factor enforcement alert, and an always-true `instanceof Date` check that rendered the two-factor resend countdown as `NaN`.-- Removed `app/resolver.js`, which nothing imported and which would have thrown on every route except `main` had it ever been wired up.+## Storefront+- Fixed QPay callback URL handling and QPay auth token caching across service instances.+- Serialized checkout capture to avoid double-capture and race-condition failures.+- Allowed cash pickup checkout flows without requiring a delivery quote.+- Fixed customer profile update authorization.+- Verified Stripe payments before capture.+- Added coverage for checkout capture and Stripe verification edge cases.---## Release and CI-- Fixed the two long-standing Postman contract failures. `List Organizations` and `List Network Stores` each need a credential the collection-level bearer cannot supply, and each expressed that with a raw `Authorization` header. A raw header overrides collection auth on Postman CLI `1.46.0` but not on `1.47.x`, where the collection bearer wins — so both requests were authenticating with the wrong credential and had been failing for several releases. Both now express the override as a request-level auth block.-- Note for collection authors: on a request, `auth:` must be a mapping. The list form is the collection-level shape, and using it on a request removes the request from the collection and aborts the run.-- The `Install Postman CLI` step installs whatever version is current, so contract behavior can change without any change in this repository. Read the CLI version out of the run log before treating a local reproduction as evidence.-- Fixed the ERD refresh workflow, which invoked `koalaman/shellcheck-alpine` with only a script path. That image sets no entrypoint, so Docker executed the script itself and Alpine has no `bash` for its shebang. It only triggers on `dev-v*` branches, so it had never run before this release.+- Continued release-branch contract workflow improvements so module PRs test the branch API code.+- Kept release notes and package version bumps aligned for Core API, Dev Engine, Fleet-Ops, and Storefront.+- Added root API transaction tripwire diagnostics for detecting server/client transaction-state divergence when explicitly enabled.+- Restored the upstream Octane listener set and pinned the dev compose command so Octane `--watch` is passed consistently.+- Updated Console custom-field value typing so signature-pad fields are treated like file uploads.---## Bug Fixes-- Fixed verification and credentials emails failing to render, which surfaced as `400` responses across signup, login, password reset, account closure, and driver authentication.-- Fixed ten Console defects covering onboarding guards, install retries, dashboard metric and count panels, report models, file and chat-attachment API config, invite acceptance, two-factor enforcement, and the two-factor resend countdown.-- Fixed the Fleet-Ops `List Organizations` contract request authenticating with the organization API key instead of the platform API token.-- Fixed the Storefront `List Network Stores` contract request authenticating with the store key instead of the network key.+- Fixed API credentials remaining usable after deletion or creator removal.+- Fixed database transaction errors caused by persistent PDO connection aliasing.+- Fixed lifecycle webhook secret/session bleed in queue workers.+- Fixed root API/Octane behavior that could let a committed write surface as `422 There is no active transaction`.+- Fixed dev compose behavior where Octane file watching could be silently dropped.+- Fixed signature-pad custom fields falling through to text value handling instead of file value handling.+- Fixed Dev Engine API key expiration values not saving.+- Fixed Fleet-Ops odometer, driver filter, password, route manifest, map tile, place editing, device, fuel report, geofence, QR, and maintenance issues.+- Fixed Storefront QPay, Stripe, checkout capture, cash pickup, and customer ownership edge cases.---## API Changes-- No endpoint contracts changed. The Core API fix restores endpoints that were returning `400` because the mail view threw during rendering; request and response shapes are unchanged.+- Core API credential deletion and immediate expiration now revoke access reliably.+- Core API requests from credentials whose creator has been removed now return unauthorized.+- Core API disables persistent PDO by default; set `DB_PERSISTENT=true` only if your deployment needs the previous behavior.+- Core API lifecycle webhooks now resolve signing context per event instead of reusing stale worker state.+- Core API URL generation now preserves query parameters explicitly.+- Core API report execution statistics columns are available for reporting workflows.+- Root API config restores the upstream Octane listener set and adds opt-in transaction tripwire logging through `DB_TXN_TRIPWIRE_ENABLED`.+- Signature-pad custom fields now report a `file` value type, matching their stored `file:<uuid>` value format.+- Fleet-Ops exposes the order configuration flow graph for API consumers.+- Fleet-Ops adds driver route manifest read/run/re-sequencing support.+- Fleet-Ops driver-scoped issue and fuel-report filters now respect `driver_uuid` aliases.+- Storefront checkout capture is serialized and Stripe payments are verified before capture.---## Upgrade Stepsdiff --git a/api/app/Providers/AppServiceProvider.php b/api/app/Providers/AppServiceProvider.phpindex 1170659a..a35e8d62 100644--- a/api/app/Providers/AppServiceProvider.php+++ b/api/app/Providers/AppServiceProvider.php@@ -2,6 +2,12 @@namespace App\Providers;+use Illuminate\Database\Connection;+use Illuminate\Database\Events\QueryExecuted;+use Illuminate\Database\Events\TransactionBeginning;+use Illuminate\Database\Events\TransactionCommitting;+use Illuminate\Support\Facades\DB;+use Illuminate\Support\Facades\Event;use Illuminate\Support\Facades\Http;use Illuminate\Support\Facades\Log;use Illuminate\Support\ServiceProvider;@@ -10,6 +16,18 @@ use Psr\Http\Message\RequestInterface;class AppServiceProvider extends ServiceProvider{+ /**+ * Ring buffer of recent statements, kept only while the transaction tripwire is armed.+ *+ * @var array<int, string>+ */+ protected static array $recentStatements = [];++ /**+ * Whether a divergence has already been reported on this worker pass.+ */+ protected static bool $divergenceReported = false;+/*** Register any application services.*@@ -28,6 +46,116 @@ class AppServiceProvider extends ServiceProviderpublic function boot(){$this->configureOutboundHttpLogging();+ $this->configureTransactionTripwire();+ }++ /**+ * Detect the moment Laravel's transaction counter stops agreeing with the MySQL session.+ *+ * Laravel decides whether to issue a COMMIT from its own integer counter+ * (ManagesTransactions::commit(), and the inline twin inside transaction()),+ * while PDO decides whether a COMMIT is legal from the server's+ * SERVER_STATUS_IN_TRANS flag. If anything ends the server-side transaction+ * without going through the Connection - an implicit commit from DDL, or a+ * second PDO handle aliasing the same persistent MySQL session - the counter+ * keeps saying "1". Every statement issued since BEGIN is then already+ * durable, and the eventual commit throws "There is no active transaction",+ * so the caller reports failure for a write that landed.+ *+ * This logs the divergence at the statement that caused it, which is the+ * only place the culprit is still identifiable.+ */+ protected function configureTransactionTripwire(): void+ {+ if (!env('DB_TXN_TRIPWIRE_ENABLED', false)) {+ return;+ }++ // One report per transaction, not one per worker: a worker serves up to+ // --max-requests before it recycles, and a single latched flag would hide+ // every occurrence after the first.+ Event::listen(TransactionBeginning::class, function (TransactionBeginning $event) {+ if ($event->connection->transactionLevel() === 1) {+ static::$divergenceReported = false;+ }+ });++ DB::listen(function (QueryExecuted $query) {+ $this->recordStatement($query->sql);++ if ($query->connection->transactionLevel() < 1) {+ return;+ }++ $pdo = $query->connection->getRawPdo();++ if (!$pdo instanceof \PDO || $pdo->inTransaction()) {+ return;+ }++ $this->reportTransactionDivergence($query->connection, 'after-statement', $query->sql);+ });++ // Backstop: the divergence may be caused by something we never see as a+ // query of ours (another PDO handle on the same session). This catches it+ // immediately before the doomed COMMIT.+ Event::listen(TransactionCommitting::class, function (TransactionCommitting $event) {+ $pdo = $event->connection->getRawPdo();++ if ($pdo instanceof \PDO && !$pdo->inTransaction()) {+ $this->reportTransactionDivergence($event->connection, 'at-commit', null);+ }+ });+ }++ protected function recordStatement(string $sql): void+ {+ static::$recentStatements[] = Str::limit(preg_replace('/\s+/', ' ', $sql), 200);++ if (count(static::$recentStatements) > 25) {+ array_shift(static::$recentStatements);+ }+ }++ protected function reportTransactionDivergence(Connection $connection, string $phase, ?string $sql): void+ {+ // One report per worker pass. Re-entrancy guard as well: the CONNECTION_ID()+ // lookup below is itself a query and would otherwise trip the listener.+ if (static::$divergenceReported) {+ return;+ }++ static::$divergenceReported = true;++ $pdo = $connection->getRawPdo();++ try {+ $mysqlConnectionId = $pdo instanceof \PDO+ ? $pdo->query('SELECT CONNECTION_ID()')->fetchColumn()+ : null;+ } catch (\Throwable $e) {+ $mysqlConnectionId = 'unavailable: ' . $e->getMessage();+ }++ Log::error('[db:txn:divergence] transaction ended outside the Connection', [+ 'phase' => $phase,+ 'statement' => $sql === null ? null : Str::limit(preg_replace('/\s+/', ' ', $sql), 300),+ 'connection' => $connection->getName(),+ 'transaction_level' => $connection->transactionLevel(),+ 'pdo_object_id' => $pdo instanceof \PDO ? spl_object_id($pdo) : null,+ 'connection_object_id'=> spl_object_id($connection),+ 'mysql_connection_id' => $mysqlConnectionId,+ 'recent_statements' => static::$recentStatements,+ 'trace' => $this->applicationTrace(),+ ]);+ }++ protected function applicationTrace(): array+ {+ return collect(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 60))+ ->map(fn ($frame) => ($frame['file'] ?? '?') . ':' . ($frame['line'] ?? '?'))+ ->values()+ ->all();}protected function configureOutboundHttpLogging(): voiddiff --git a/api/config/octane.php b/api/config/octane.phpindex ed4b9324..8e1fd35b 100644--- a/api/config/octane.php+++ b/api/config/octane.php@@ -105,8 +105,21 @@ return [OperationTerminated::class => [FlushOnce::class,FlushTemporaryContainerInstances::class,- DisconnectFromDatabases::class,- CollectGarbage::class,+ // DisconnectFromDatabases::class,+ //+ // Left disabled, as upstream Octane ships it. It was enabled in+ // a5a5ddb to stop connection-pool exhaustion under load, but it never+ // did that: the mysql connections are opened with PDO::ATTR_PERSISTENT,+ // so disconnect() drops the PHP object and leaves the MySQL session+ // open in PHP's persistent pool. Measured on this stack: 40 concurrent+ // requests left 17 connections open and still idle minutes later.+ //+ // What it did do is churn a fresh PDO handle per request over that one+ // persistent session, which is how two live handles end up aliasing a+ // single MySQL transaction. A COMMIT through either handle ends the+ // transaction for both, and the loser's commit throws "There is no+ // active transaction" on a write that has already been made durable.+ CollectGarbage::class,],WorkerErrorOccurred::class => [diff --git a/builds/linux/build-linux.sh b/builds/linux/build-linux.shindex 018494dd..9d7dbc39 100755--- a/builds/linux/build-linux.sh+++ b/builds/linux/build-linux.sh@@ -60,7 +60,7 @@ fi# Build the imageecho "📦 Building static Linux binary for ${APP_NAME}..."-docker build -f "$DOCKERFILE" -t "$IMAGE_NAME" "$ROOT_DIR"+docker build --progress=plain -f "$DOCKERFILE" -t "$IMAGE_NAME" "$ROOT_DIR"# Create a container from the built imageecho "📦 Creating container to extract binary..."diff --git a/builds/linux/static-build.Dockerfile b/builds/linux/static-build.Dockerfileindex cd52d59b..cf8bef06 100644--- a/builds/linux/static-build.Dockerfile+++ b/builds/linux/static-build.Dockerfile@@ -70,6 +70,9 @@ ENV SPC_LOG_LEVEL=debug# Skip compressionENV NO_COMPRESS=1+# GitHub-hosted Linux runners are memory constrained for this full source build.+ENV SPC_CONCURRENCY=2+# set PHP versionENV PHP_VERSION=8.2diff --git a/console/app/models/custom-field.js b/console/app/models/custom-field.jsindex 01c92a00..ee1a9669 100644--- a/console/app/models/custom-field.js+++ b/console/app/models/custom-field.js@@ -32,7 +32,7 @@ export default class CustomFieldModel extends Model {/** @computed */@computed('type') get valueType() {- if (this.type === 'file-upload') return 'file';+ if (this.type === 'file-upload' || this.type === 'signature-pad') return 'file';if (this.type === 'date-time-input') return 'date';if (this.type === 'model-select') return 'model';diff --git a/console/tests/unit/models/custom-field-test.js b/console/tests/unit/models/custom-field-test.jsindex 5b07f01b..820b7a29 100644--- a/console/tests/unit/models/custom-field-test.js+++ b/console/tests/unit/models/custom-field-test.js@@ -21,6 +21,7 @@ module('Unit | Model | custom-field | valueType', function (hooks) {const field = (type) => store.createRecord('custom-field', { type }).valueType;assert.strictEqual(field('file-upload'), 'file');+ assert.strictEqual(field('signature-pad'), 'file', 'a signature is uploaded and stored as a file');assert.strictEqual(field('date-time-input'), 'date');assert.strictEqual(field('model-select'), 'model');assert.strictEqual(field('text-input'), 'text', 'anything else stores plain text');diff --git a/docker/Dockerfile b/docker/Dockerfileindex cd114265..dede03c3 100644--- a/docker/Dockerfile+++ b/docker/Dockerfile@@ -76,7 +76,7 @@ ENV QUEUE_CONNECTION=redisENV CADDYFILE_PATH=/fleetbase/CaddyfileENV CONSOLE_PATH=/fleetbase/consoleENV OCTANE_SERVER=frankenphp-ENV FLEETBASE_VERSION=0.7.55+ENV FLEETBASE_VERSION=0.7.56# Set environmentARG ENVIRONMENT=production