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:
2026-11-30 23:01:42 +02:00
co-authored by Claude Opus 5.5
parent 9f719695e3
commit ec934455e7
148 changed files with 9455 additions and 2413 deletions
+37 -26
View File
@@ -1,31 +1,42 @@
<?php
// Freeze only the authorised adapter correction over the previously proved artifact.
$root=dirname(__DIR__);
$prior=json_decode(file_get_contents($root.'/docs/proofs/sgf-corrected-delivery.json'),true,64,JSON_THROW_ON_ERROR);
$old=$prior['artifact']['directory'];
$manifest=json_decode(file_get_contents($old.'/manifest.json'),true,64,JSON_THROW_ON_ERROR);
$file='integrations/sgf/internal-requisitions/Port.php';
$payload=[];
foreach($manifest['support_files'] as $path=>$hash){
$text=file_get_contents($old.'/'.$path);
if(!hash_equals($hash,hash('sha256',$text)))throw new RuntimeException('Prior artifact changed');
$payload[$path]=$path===$file?file_get_contents($root.'/'.$file):$text;
$root = dirname(__DIR__);
$prior = json_decode(file_get_contents($root.'/docs/proofs/sgf-corrected-delivery.json'), true, 64, JSON_THROW_ON_ERROR);
$old = $prior['artifact']['directory'];
$manifest = json_decode(file_get_contents($old.'/manifest.json'), true, 64, JSON_THROW_ON_ERROR);
$file = 'integrations/sgf/internal-requisitions/Port.php';
$payload = [];
foreach ($manifest['support_files'] as $path => $hash) {
$text = file_get_contents($old.'/'.$path);
if (! hash_equals($hash, hash('sha256', $text))) {
throw new RuntimeException('Prior artifact changed');
}
$payload[$path] = $path === $file ? file_get_contents($root.'/'.$file) : $text;
}
$manifest['support_files'][$file]=hash('sha256',$payload[$file]);
$manifestText=json_encode($manifest,JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR);
$id='OPERATIONAL-CANDIDATE-'.substr(hash('sha256',$manifestText),0,16);
$dir=$root.'/storage/app/private/candidates/'.$id;
if(file_exists($dir))throw new RuntimeException('Candidate already exists; verify rather than overwrite');
mkdir($dir,0700,true);
foreach($payload+['manifest.json'=>$manifestText] as $path=>$text){
if(!is_dir(dirname($dir.'/'.$path)))mkdir(dirname($dir.'/'.$path),0700,true);
file_put_contents($dir.'/'.$path,$text);
$manifest['support_files'][$file] = hash('sha256', $payload[$file]);
$manifestText = json_encode($manifest, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR);
$id = 'OPERATIONAL-CANDIDATE-'.substr(hash('sha256', $manifestText), 0, 16);
$dir = $root.'/storage/app/private/candidates/'.$id;
if (file_exists($dir)) {
throw new RuntimeException('Candidate already exists; verify rather than overwrite');
}
mkdir($dir, 0700, true);
foreach ($payload + ['manifest.json' => $manifestText] as $path => $text) {
if (! is_dir(dirname($dir.'/'.$path))) {
mkdir(dirname($dir.'/'.$path), 0700, true);
}
file_put_contents($dir.'/'.$path, $text);
}
$archive = $root.'/storage/app/private/candidate-archives/'.$id.'.zip';
$zip = new ZipArchive;
if ($zip->open($archive, ZipArchive::CREATE | ZipArchive::EXCL) !== true) {
throw new RuntimeException('Archive collision');
}
foreach ([...array_keys($payload), 'manifest.json'] as $path) {
$zip->addFile($dir.'/'.$path, $path);
}
$archive=$root.'/storage/app/private/candidate-archives/'.$id.'.zip';
$zip=new ZipArchive;
if($zip->open($archive,ZipArchive::CREATE|ZipArchive::EXCL)!==true)throw new RuntimeException('Archive collision');
foreach([...array_keys($payload),'manifest.json'] as $path)$zip->addFile($dir.'/'.$path,$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);
$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);