markTestSkipped('Recovery boundary requires the unchanged installed artifact.'); } $f = receiptFixture(); budgetDistributionFixtureSchema(); DB::connection()->getSchemaBuilder()->drop('budget_distributions'); $actor = User::factory()->create(['tenant_id' => $f['tenant']->id, 'purchasing_role' => PurchasingRole::Finance]); $this->actingAs($actor); try { app(CommonBudget::class)->for($actor); $this->fail('Partial optional schema cannot silently become a legacy balance.'); } catch (HttpException $error) { expect($error->getStatusCode())->toBe(503); } expect(DB::table('budget_entries')->count())->toBe(0); }); test('old pinned runtime refuses to ignore a distributed origin instead of presenting a false available balance', function () { if (method_exists(BudgetControl::class, 'recordDistribution')) { $this->markTestSkipped('This recovery boundary exercises the unchanged installed artifact.'); } $f = receiptFixture(); budgetDistributionFixtureSchema(); $actor = User::factory()->create(['tenant_id' => $f['tenant']->id, 'purchasing_role' => PurchasingRole::Finance]); $this->actingAs($actor); DB::table('budget_distributions')->insert(['tenant_id' => $actor->tenant_id, 'requisition_id' => $f['r']->id, 'phase' => 'reserve', 'snapshot' => '{}', 'created_by' => $actor->id, 'created_at' => now(), 'updated_at' => now()]); try { app(CommonBudget::class)->for($actor); $this->fail('An incompatible runtime must fail closed.'); } catch (HttpException $error) { expect($error->getStatusCode())->toBe(503); } expect(DB::table('budget_entries')->count())->toBe(0)->and(DB::table('budget_consumptions')->count())->toBe(0); });