Aplicar Pint aos 18 ficheiros que falhavam lint:check
Só formatação. 16 já falhavam em fase5-producao; 2 vêm de c9bd6db.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,9 +56,9 @@ final class CommonStockReadController extends Controller
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return response()->json(['status' => 'unavailable', 'message' => 'A fonte de stock está indisponível ou incompatível. Actualize a consulta mais tarde.'], 503)->header('Cache-Control','no-store');
|
||||
return response()->json(['status' => 'unavailable', 'message' => 'A fonte de stock está indisponível ou incompatível. Actualize a consulta mais tarde.'], 503)->header('Cache-Control', 'no-store');
|
||||
}
|
||||
|
||||
return response()->json($result)->header('Cache-Control','no-store');
|
||||
return response()->json($result)->header('Cache-Control', 'no-store');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ final class WarehouseReturnController extends Controller
|
||||
DB::statement('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY');
|
||||
}
|
||||
|
||||
return $run();
|
||||
return $run();
|
||||
}) : $run();
|
||||
|
||||
return response()->json($result)->header('Cache-Control', 'no-store');
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Services;
|
||||
|
||||
use App\Models\ConflictDeclaration;
|
||||
use App\Models\ConflictRelease;
|
||||
use App\Models\User;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
@@ -128,9 +128,9 @@ if ($action === 'prepare') {
|
||||
$budget = $db->table('cb_budgets')->first();
|
||||
$decision = $db->table('ir_steps')->first();
|
||||
$report = ['passed' => true, 'identity' => $identity, 'scope' => '1:1:1', 'added_grants' => $added, 'existing_grants_preserved' => true, 'existing_accounts_preserved' => true, 'single_approved_request' => true, 'single_reservation' => true, 'reservation' => $db->table('cb_budget_entries')->where('kind', 'reserve')->first(), 'budget' => $budget, 'decision' => $decision, 'pointer_preserved' => true, 'backup_sha256' => $baseline['backup_sha256'], 'recovery_directory' => $recovery, 'checked_at' => gmdate('c'), 'owner_runtime_limitation' => true, 'visual_review' => false, 'read_only_record_visibility_limitation' => true];
|
||||
file_put_contents($root.'/docs/proofs/sgf-demo-8039-delivery.json',json_encode($report,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
file_put_contents($host.'/config/purchasing-access.php','<?php return ["initialisation_scopes"=>[]];');
|
||||
echo json_encode($report,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
||||
file_put_contents($root.'/docs/proofs/sgf-demo-8039-delivery.json', json_encode($report, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
file_put_contents($host.'/config/purchasing-access.php', '<?php return ["initialisation_scopes"=>[]];');
|
||||
echo json_encode($report, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
||||
} else {
|
||||
throw new RuntimeException('Use prepare, install or verify');
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ $fingerprints = function () use ($db) {
|
||||
$hashes[$t->tablename] = hash('sha256', json_encode(array_column($rows, 'data'), JSON_THROW_ON_ERROR));
|
||||
}
|
||||
|
||||
return $hashes;
|
||||
return $hashes;
|
||||
});
|
||||
};
|
||||
$action = $argv[1] ?? '';
|
||||
@@ -97,11 +97,11 @@ if ($action === 'prepare') {
|
||||
} elseif (in_array($action, ['apply', 'reapply'], true)) {
|
||||
$plan = $deploy->plan($candidate['directory'], $candidate['archive']['manifest_sha256']);
|
||||
$result = $deploy->apply($candidate['directory'], $candidate['archive']['manifest_sha256'], $plan['target_sha256'], 'Authorised read-only visibility correction 8039', true);
|
||||
file_put_contents($recovery.'/'.($action === 'apply' ? 'applied' : 'reapplied').'.json',json_encode($result,JSON_PRETTY_PRINT));
|
||||
file_put_contents($recovery.'/'.($action === 'apply' ? 'applied' : 'reapplied').'.json', json_encode($result, JSON_PRETTY_PRINT));
|
||||
} else {
|
||||
throw new RuntimeException('Use prepare/apply/rollback/reapply/verify');
|
||||
}
|
||||
unlink($host.'/storage/framework/down');
|
||||
echo json_encode($result,JSON_PRETTY_PRINT);
|
||||
echo json_encode($result, JSON_PRETTY_PRINT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,5 @@ foreach ([...array_keys($payload), 'manifest.json'] as $path) {
|
||||
}
|
||||
$zip->close();
|
||||
$result = ['directory' => $dir, 'archive' => ['file' => $archive, 'sha256' => hash_file('sha256', $archive), 'manifest_sha256' => hash('sha256', $manifestText)], 'prior_manifest_sha256' => $prior['artifact']['archive']['manifest_sha256'], 'changed_files' => [$file], 'schema_changed' => false, 'rights_changed' => false, 'installed_real' => false];
|
||||
file_put_contents($root.'/docs/proofs/sgf-read-candidate.json', json_encode($result,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($result,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
||||
file_put_contents($root.'/docs/proofs/sgf-read-candidate.json', json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
||||
|
||||
@@ -66,5 +66,5 @@ $check($ok['confirmed']['confirmed_by'] === 4 && $ok['confirmed']['proposal']['p
|
||||
$deny(fn () => $step($ok, 1, 'quote', []), 409, 'Confirmed process cannot be rewritten');
|
||||
$check($state['proposals'][0]['comparison']['fingerprint'] === $comparison['fingerprint'], 'Comparison snapshot and justification preserved');
|
||||
$report = ['passed' => true, 'checks' => $checks, 'synthetic_only' => true, 'persistent_demo_accounts_created' => false, 'checked_at' => gmdate('c')];
|
||||
file_put_contents(dirname(__DIR__).'/docs/proofs/sgf-sourcing-core.json',json_encode($report,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($report,JSON_PRETTY_PRINT);
|
||||
file_put_contents(dirname(__DIR__).'/docs/proofs/sgf-sourcing-core.json', json_encode($report, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($report, JSON_PRETTY_PRINT);
|
||||
|
||||
@@ -153,12 +153,12 @@ try {
|
||||
throw new RuntimeException('Incomplete comparison must not be awarded');
|
||||
}
|
||||
$report = ['passed' => true, 'identity' => $identity, 'scope' => '1:1:1', 'candidate' => $candidate, 'protected_users_requisition_reservation_consumption_unchanged' => true, 'previous_grants_preserved' => true, 'new_grants' => $new, 'persistent_accounts_created' => false, 'proposals' => 0, 'confirmed' => false, 'suppliers_selected' => count($state['suppliers']), 'quotations' => count($state['quotes']), 'pending' => 'Second eligible evaluator and independent confirmer absent; no account created by owner decision.', 'backup_sha256' => $baseline['backup_sha256'], 'recovery_directory' => $recovery, 'checked_at' => gmdate('c')];
|
||||
file_put_contents($root.'/docs/proofs/sgf-sourcing-demo.json',json_encode($report,JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($report,JSON_PRETTY_PRINT);
|
||||
file_put_contents($root.'/docs/proofs/sgf-sourcing-demo.json', json_encode($report, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($report, JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
throw new RuntimeException('Use prepare/apply/verify');
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
fwrite(STDERR,$e->getMessage()."\n");
|
||||
fwrite(STDERR, $e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -60,6 +60,6 @@ try {
|
||||
file_put_contents($host.'/storage/app/private/module-deployments/schema-transition-'.$manifestHash.'.json', json_encode($receipt, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
echo json_encode($result + ['activated' => false, 'rights_granted' => false], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
|
||||
} catch (Throwable $e) {
|
||||
fwrite(STDERR,$e->getMessage()."\n");
|
||||
fwrite(STDERR, $e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -154,6 +154,6 @@ final class CommonReceiptStockTest extends TestCase
|
||||
file_put_contents($root.'/receipt-results.json', json_encode(['identity' => $i, 'physical_accepted_milli' => 4000, 'rejected_milli' => 2000, 'movement_count_main' => 1,
|
||||
'source_version_stale_refused' => true, 'core_replay_same_movement' => true, 'fault_atomic_and_recovered' => true, 'concurrency' => ['actual_lock_wait' => true, 'wait_event' => $wait->wait_event, 'same_receipt' => true, 'one_movement' => true],
|
||||
'link' => ['tenant' => (int) $f['tenant']->id, 'warehouse' => (int) $f['warehouse']->id, 'item' => (int) $f['stock']->id, 'movement' => (int) $movement->id, 'reference' => $movement->snapshot['reference']],
|
||||
'writer_manifest_sha256' => hash_file('sha256',base_path('packages/inventory-write/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
'writer_manifest_sha256' => hash_file('sha256', base_path('packages/inventory-write/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,10 +13,13 @@ use App\Models\Supplier;
|
||||
use App\Models\Tenant;
|
||||
use App\Models\User;
|
||||
use App\Services\ConflictGuard;
|
||||
use App\Services\ConflictReleases;
|
||||
use App\Services\RequisitionWorkflow;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Str;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Tempo\Purchasing\Composition\ExecutionContext;
|
||||
|
||||
function personalConflict(int $supplierId, ?int $requisitionId = null, bool $hasConflict = true): array
|
||||
{
|
||||
@@ -385,10 +388,10 @@ test('guests cannot consult or submit declarations', function () {
|
||||
|
||||
test('composed conflict authority is scoped and never inferred from the environment', function () {
|
||||
require_once dirname(__DIR__, 2).'/packages/purchasing/src/ExecutionContext.php';
|
||||
$execution = new \Tempo\Purchasing\Composition\ExecutionContext;
|
||||
app()->instance(\Tempo\Purchasing\Composition\ExecutionContext::class, $execution);
|
||||
$execution = new ExecutionContext;
|
||||
app()->instance(ExecutionContext::class, $execution);
|
||||
config(['conflict-releases.qa_enabled' => true]);
|
||||
$service = app(\App\Services\ConflictReleases::class);
|
||||
$service = app(ConflictReleases::class);
|
||||
expect($service->ready())->toBeFalse();
|
||||
$this->post('/conflitos', personalConflict($this->supplier->id, $this->r->id))->assertSessionHasNoErrors();
|
||||
$declaration = ConflictDeclaration::query()->firstOrFail();
|
||||
@@ -409,11 +412,11 @@ test('composed conflict authority is scoped and never inferred from the environm
|
||||
expect($service->authorise($this->admin, $declaration, $input)->id)->toBe($first->id)
|
||||
->and(ConflictRelease::query()->count())->toBe(1);
|
||||
DB::table('organization_memberships')->where('user_id', $this->admin->id)->delete();
|
||||
expect(fn () => $service->authorise($this->admin, $declaration, $input))->toThrow(\Symfony\Component\HttpKernel\Exception\HttpException::class);
|
||||
expect(fn () => $service->authorise($this->admin, $declaration, $input))->toThrow(HttpException::class);
|
||||
});
|
||||
expect($service->ready())->toBeFalse()->and($declaration->fresh()->getAttributes())->toBe($before);
|
||||
} finally {
|
||||
app()->instance('env', 'testing');
|
||||
app()->forgetInstance(\Tempo\Purchasing\Composition\ExecutionContext::class);
|
||||
app()->forgetInstance(ExecutionContext::class);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -273,11 +273,11 @@ final class NativePayablePageTest extends TestCase
|
||||
$pipes = [];
|
||||
$environment = getenv();
|
||||
$environment['COMMON_PAYABLES_PATH'] = base_path('packages/payables');
|
||||
$p = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input],[0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']],$pipes,base_path(),$environment);
|
||||
$p = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']], $pipes, base_path(), $environment);
|
||||
$this->assertIsResource($p);
|
||||
fclose($pipes[0]);
|
||||
$this->assertSame(0,proc_close($p));
|
||||
$r = json_decode(file_get_contents($input.'.result'),true);
|
||||
$this->assertSame(503,$r['status']);
|
||||
$this->assertSame(0, proc_close($p));
|
||||
$r = json_decode(file_get_contents($input.'.result'), true);
|
||||
$this->assertSame(503, $r['status']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,16 +562,16 @@ final class WarehouseReturnIntegrationTest extends TestCase
|
||||
});
|
||||
$first = $this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total', 51)->assertJsonPath('pagination.last_page', 3)->assertJsonCount(25, 'rows')->json('rows');
|
||||
$capture = false;
|
||||
$this->assertLessThanOrEqual(4,count($queries));
|
||||
$second = $this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25,'rows')->json('rows');
|
||||
$this->assertEmpty(array_intersect(array_column($first,'id'),array_column($second,'id')));
|
||||
$this->assertGreaterThan($second[0]['id'],$first[24]['id']);
|
||||
$this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1,'rows');
|
||||
$this->assertLessThanOrEqual(4, count($queries));
|
||||
$second = $this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25, 'rows')->json('rows');
|
||||
$this->assertEmpty(array_intersect(array_column($first, 'id'), array_column($second, 'id')));
|
||||
$this->assertGreaterThan($second[0]['id'], $first[24]['id']);
|
||||
$this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1, 'rows');
|
||||
$this->actingAs($this->f['receiver']);
|
||||
$this->confirm($p)->assertOk();
|
||||
$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',50);
|
||||
$this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total',1);
|
||||
$this->assertSame(8000,$this->balance());
|
||||
file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json',json_encode(['fixture_records' => 51, 'page_size' => 25, 'supply_record_selects_for_page' => count($queries), 'pages_disjoint' => true, 'state_filters_cover_latest_versions' => true, 'not_a_load_capacity_benchmark' => true],JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total', 50);
|
||||
$this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total', 1);
|
||||
$this->assertSame(8000, $this->balance());
|
||||
file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json', json_encode(['fixture_records' => 51, 'page_size' => 25, 'supply_record_selects_for_page' => count($queries), 'pages_disjoint' => true, 'state_filters_cover_latest_versions' => true, 'not_a_load_capacity_benchmark' => true], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,13 +385,13 @@ final class SgfInvoiceDispatchesTest extends TestCase
|
||||
file_put_contents($this->privateRoot.'/screen-preview.html', $html);
|
||||
$this->post('/facturas/envio-sgf/1/operar', ['version' => 3, 'action' => 'confirm', 'reason' => 'Confirmar apenas este impacto mostrado.', 'approval_hash' => $match[1]])->assertRedirect('/facturas/envio-sgf/1');
|
||||
$done = $this->get('/facturas/envio-sgf/1')->assertOk()->assertSee('Recibo conservado')->assertDontSee('Confirmar individualmente')->assertSee('http://127.0.0.1:8085/compras?', false)->getContent();
|
||||
file_put_contents($this->privateRoot.'/screen-receipt.html',$done);
|
||||
self::assertCount(1,$this->remote);
|
||||
file_put_contents($this->privateRoot.'/screen-receipt.html', $done);
|
||||
self::assertCount(1, $this->remote);
|
||||
}
|
||||
|
||||
public function test_missing_schema_is_refused_without_activating_or_migrating(): void
|
||||
{
|
||||
$migration = require dirname(__DIR__,2).'/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php';
|
||||
$migration = require dirname(__DIR__, 2).'/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php';
|
||||
$migration->down();
|
||||
$this->get('/facturas/envio-sgf')->assertStatus(503);
|
||||
Http::assertNothingSent();
|
||||
@@ -402,8 +402,8 @@ final class SgfInvoiceDispatchesTest extends TestCase
|
||||
{
|
||||
$row = $this->prepared();
|
||||
$event = DB::table('sgf_invoice_dispatch_events')->orderByDesc('id')->first();
|
||||
$state = json_decode($event->after_state,true);
|
||||
self::assertSame(1,$state['preview_actor_id']);
|
||||
self::assertSame($row->source_context_hash,$state['source_context_hash']);
|
||||
$state = json_decode($event->after_state, true);
|
||||
self::assertSame(1, $state['preview_actor_id']);
|
||||
self::assertSame($row->source_context_hash, $state['source_context_hash']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,4 +38,4 @@ try {
|
||||
$result = ['status' => $e->getStatusCode()];
|
||||
}
|
||||
$result['elapsed_ms'] = round((hrtime(true) - $start) / 1e6, 3);
|
||||
file_put_contents($file.'.result', json_encode($result,JSON_THROW_ON_ERROR));
|
||||
file_put_contents($file.'.result', json_encode($result, JSON_THROW_ON_ERROR));
|
||||
|
||||
@@ -65,4 +65,4 @@ foreach (['equipment', 'part'] as $unsupported) {
|
||||
}
|
||||
$data = json_decode(DB::table('ir_requests')->where('id', $id)->value('data'), true, 32, JSON_THROW_ON_ERROR);
|
||||
$check(array_column($data['items'], 'purchase_type') === ['consumable', 'service', 'other'], 'approved lifecycle covers the three supported basic types');
|
||||
$check(DB::table('ir_requests')->count() === 1 && DB::table('cb_budget_entries')->where('kind','reserve')->count() === 1, 'unsupported types create neither a second request nor reservation');
|
||||
$check(DB::table('ir_requests')->count() === 1 && DB::table('cb_budget_entries')->where('kind', 'reserve')->count() === 1, 'unsupported types create neither a second request nor reservation');
|
||||
|
||||
@@ -126,6 +126,6 @@ try {
|
||||
throw new RuntimeException('Use setup/verify');
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
fwrite(STDERR,get_class($e).': '.$e->getMessage()."\n");
|
||||
fwrite(STDERR, get_class($e).': '.$e->getMessage()."\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -46,4 +46,4 @@ try {
|
||||
} catch (HttpExceptionInterface $e) {
|
||||
$out = ['status' => $e->getStatusCode()];
|
||||
}
|
||||
file_put_contents($file.'.result',json_encode($out,JSON_THROW_ON_ERROR));
|
||||
file_put_contents($file.'.result', json_encode($out, JSON_THROW_ON_ERROR));
|
||||
|
||||
Reference in New Issue
Block a user