Aplicar Pint e formatação de frontend; delimitar o âmbito do lint
Só formatação automática (pint, vp check --fix), sem alterar comportamento. Excluídos da formatação os registos e artefactos com bytes fixos: docs/, integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/, compras-release.json e AGENTS*.md. Scripts operacionais, integrations e auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,33 @@
|
||||
<?php
|
||||
$file=realpath($argv[1]??'');$private=realpath(getcwd().'/../private');
|
||||
if(!$file||!$private||!str_starts_with($file,$private.DIRECTORY_SEPARATOR))throw new LogicException('Private QA worker input refused');
|
||||
require getcwd().'/vendor/autoload.php';$app=require getcwd().'/bootstrap/app.php';$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
$p=json_decode(file_get_contents($file),true,64,JSON_THROW_ON_ERROR);$db=Illuminate\Support\Facades\DB::connection();$i=$db->selectOne("SELECT current_database() AS db,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster");
|
||||
if(!preg_match('/^compras_receipts_test_([a-f0-9]{12})$/D',$i->db,$m)||$i->role!=='stock_receipt_qa_'.$m[1]||(int)$i->port!==55439||$i->cluster!=='sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'))throw new LogicException('QA worker database refused');
|
||||
config(['common-payables.enabled'=>true,'common-payables.history_enabled'=>true,'common-payables.paged_read_enabled'=>true,'common-payables.source_instance'=>$p['instance']]);$u=App\Models\User::query()->findOrFail($p['actor']);auth()->setUser($u);$time=hrtime(true);
|
||||
try{$d=app(App\Services\SupplierPayables::class)->listing($u);$out=['status'=>200,'documents'=>count($d['documents']),'balances'=>array_column($d['obligations'],'balance_minor'),'time_ms'=>(hrtime(true)-$time)/1e6];}
|
||||
catch(Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e){$out=['status'=>$e->getStatusCode()];}
|
||||
file_put_contents($file.'.result',json_encode($out,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR));
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\SupplierPayables;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
|
||||
$file = realpath($argv[1] ?? '');
|
||||
$private = realpath(getcwd().'/../private');
|
||||
if (! $file || ! $private || ! str_starts_with($file, $private.DIRECTORY_SEPARATOR)) {
|
||||
throw new LogicException('Private QA worker input refused');
|
||||
}
|
||||
require getcwd().'/vendor/autoload.php';
|
||||
$app = require getcwd().'/bootstrap/app.php';
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
$p = json_decode(file_get_contents($file), true, 64, JSON_THROW_ON_ERROR);
|
||||
$db = DB::connection();
|
||||
$i = $db->selectOne("SELECT current_database() AS db,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster");
|
||||
if (! preg_match('/^compras_receipts_test_([a-f0-9]{12})$/D', $i->db, $m) || $i->role !== 'stock_receipt_qa_'.$m[1] || (int) $i->port !== 55439 || $i->cluster !== 'sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN')) {
|
||||
throw new LogicException('QA worker database refused');
|
||||
}
|
||||
config(['common-payables.enabled' => true, 'common-payables.history_enabled' => true, 'common-payables.paged_read_enabled' => true, 'common-payables.source_instance' => $p['instance']]);
|
||||
$u = User::query()->findOrFail($p['actor']);
|
||||
auth()->setUser($u);
|
||||
$time = hrtime(true);
|
||||
try {
|
||||
$d = app(SupplierPayables::class)->listing($u);
|
||||
$out = ['status' => 200, 'documents' => count($d['documents']), 'balances' => array_column($d['obligations'], 'balance_minor'), 'time_ms' => (hrtime(true) - $time) / 1e6];
|
||||
} catch (HttpExceptionInterface $e) {
|
||||
$out = ['status' => $e->getStatusCode()];
|
||||
}
|
||||
file_put_contents($file.'.result', json_encode($out, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
|
||||
|
||||
Reference in New Issue
Block a user