commit compras1 2811
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-28 07:11:35 +02:00
parent d58b75c87a
commit eb32c74c56
202 changed files with 17463 additions and 1526 deletions
@@ -0,0 +1,48 @@
<?php
use Illuminate\Support\Facades\DB;
use Tempo\Finance\Budget\BudgetControl;
use Tempo\Finance\Composition\Bundle;
use Tempo\Finance\GeneralLedger\LedgerSchema;
use Tempo\Finance\Payables\PayablesSchema;
/** Only the canonical QA source or the exact verified private runtime is accepted. */
function requisitionLedgerQaSource(): ?string
{
$source = getenv('RQ01_LEDGER_QA_SOURCE');
if (! is_string($source) || $source === '') {
return null;
}
if ($source === 'C:/laragon/www/sgf-tempo/packages/general-ledger') {
if (config('common-finance-bundle.manifest_sha256') === '182e10ceec556e120ecb14b57d17f0132ce0b555041cb054cdf9d17bcc1d51df') {
throw new LogicException('A pinned private composition cannot fall back to the canonical development source.');
}
return $source;
}
$root = base_path('storage/framework/testing/requisition-ledger-runtime-qa-182e10ceec556e12');
$pin = '182e10ceec556e120ecb14b57d17f0132ce0b555041cb054cdf9d17bcc1d51df';
$normal = static fn ($value) => is_string($value) && realpath($value) !== false ? str_replace('\\', '/', realpath($value)) : null;
if (! app()->environment('testing') || DB::connection()->getConfig('host') !== '127.0.0.1'
|| DB::connection()->getConfig('port') !== '55439'
|| ! preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', DB::connection()->getDatabaseName())
|| $normal($source) !== $normal($root.'/general-ledger')
|| $normal(config('common-finance-bundle.root')) !== $normal($root)
|| config('common-finance-bundle.manifest_sha256') !== $pin
|| $normal(config('general-ledger.path')) !== $normal($source)) {
throw new LogicException('Only the pinned independently verified private ledger runtime is allowed.');
}
// AppServiceProvider already verified the pinned loader before loading Bundle or Payables.
Bundle::verify($root, $pin);
require_once $source.'/bootstrap.php';
foreach ([LedgerSchema::class => $root.'/general-ledger',
BudgetControl::class => base_path('storage/framework/testing/requisition-cycles-qa-35701ec1614f871e/budget-control'),
PayablesSchema::class => $root.'/payables'] as $class => $boundary) {
$file = (new ReflectionClass($class))->getFileName();
if (! is_string($file) || ! str_starts_with($normal($file) ?? '', ($normal($boundary) ?? 'unavailable').'/')) {
throw new LogicException('A financial class escaped the pinned private composition.');
}
}
return $source;
}