## Summary - move the Laravel application into `apps/platform` and keep the repository root for orchestration, docs, and tooling - update the local command model, Sail/Docker wiring, runtime paths, and ignore rules around the new platform location - add relocation quickstart/contracts plus focused smoke coverage for bootstrap, command model, routes, and runtime behavior ## Validation - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/PlatformRelocation` - integrated browser smoke validated `/up`, `/`, `/admin`, `/admin/choose-workspace`, and tenant route semantics for `200`, `403`, and `404` ## Remaining Rollout Checks - validate Dokploy build context and working-directory assumptions against the new `apps/platform` layout - confirm web, queue, and scheduler processes all start from the expected working directory in staging/production - verify no legacy volume mounts or asset-publish paths still point at the old root-level `public/` or `storage/` locations Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #213
79 lines
2.5 KiB
PHP
79 lines
2.5 KiB
PHP
<?php
|
|
|
|
use App\Jobs\Middleware\TrackOperationRun;
|
|
use App\Models\OperationRun;
|
|
use App\Services\OperationRunService;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
it('does not mark an operation run completed when the job is released', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
/** @var OperationRunService $operationRunService */
|
|
$operationRunService = app(OperationRunService::class);
|
|
$operationRun = $operationRunService->ensureRun(
|
|
tenant: $tenant,
|
|
type: 'test.release',
|
|
inputs: ['foo' => 'bar'],
|
|
initiator: $user,
|
|
);
|
|
|
|
$job = new class($operationRun) implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public function __construct(public OperationRun $operationRun)
|
|
{
|
|
$this->withFakeQueueInteractions();
|
|
}
|
|
};
|
|
|
|
$middleware = new TrackOperationRun;
|
|
|
|
$middleware->handle($job, function ($job): void {
|
|
$job->release(60);
|
|
});
|
|
|
|
$operationRun->refresh();
|
|
expect($operationRun->status)->toBe('running');
|
|
expect($operationRun->outcome)->toBe('pending');
|
|
});
|
|
|
|
it('marks an operation run failed when the wrapped job throws inside middleware execution', function () {
|
|
[$user, $tenant] = createUserWithTenant(role: 'owner');
|
|
|
|
/** @var OperationRunService $operationRunService */
|
|
$operationRunService = app(OperationRunService::class);
|
|
$operationRun = $operationRunService->ensureRun(
|
|
tenant: $tenant,
|
|
type: 'test.exception',
|
|
inputs: ['foo' => 'bar'],
|
|
initiator: $user,
|
|
);
|
|
|
|
$job = new class($operationRun) implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
public function __construct(public OperationRun $operationRun)
|
|
{
|
|
$this->withFakeQueueInteractions();
|
|
}
|
|
};
|
|
|
|
$middleware = new TrackOperationRun;
|
|
|
|
expect(fn () => $middleware->handle($job, function (): void {
|
|
throw new RuntimeException('wrapped job failure');
|
|
}))->toThrow(RuntimeException::class);
|
|
|
|
$operationRun->refresh();
|
|
|
|
expect($operationRun->status)->toBe('completed')
|
|
->and($operationRun->outcome)->toBe('failed')
|
|
->and(data_get($operationRun->failure_summary, '0.code'))->toBe('exception.unhandled');
|
|
});
|