commit compras5 2711
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-27 20:19:21 +02:00
parent 7486007fcf
commit d58b75c87a
57 changed files with 2803 additions and 116 deletions
+32
View File
@@ -7,12 +7,15 @@ test('cycle contention requires all three real lock and single-effect receipts',
$rows[] = ['scenario' => $scenario, 'statuses' => $statuses, 'blocked_writers_observed' => 2, 'returns' => 1, 'reserve_minor' => 0, 'late_approvals' => 0];
}
$rows[] = ['old_cycle_runtime_rejected_before_balance' => true, 'status' => 503];
$rows[] = ['scheduled_expiry_without_session' => true, 'scheduled_scope_closed' => true, 'scheduled_repeat_without_effects' => true,
'scheduled_audit_explicit' => true, 'scheduled_unrelated_operations_denied' => 3];
$output = function () use (&$rows) {
return implode("\n", array_map(fn ($row) => json_encode($row, JSON_THROW_ON_ERROR), $rows));
};
expect(landedQaReceiptsVerified($command, $output()))->toBeTrue();
$rows[2]['late_approvals'] = 1;
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
$rows[2]['late_approvals'] = 0;
array_pop($rows);
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
});
@@ -33,6 +36,35 @@ test('capital register contention requires both actual lock receipts and one imm
require_once __DIR__.'/../Support/LandedQaReceipts.php';
test('explicit expense contention requires one audited version with unchanged native financial sources', function () {
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'race-expense'];
$rows = [];
foreach (['same_operation' => [200, 200], 'same_version' => [200, 409]] as $scenario => $statuses) {
$rows[] = ['scenario' => $scenario, 'statuses' => $statuses, 'blocked_writers_observed' => 2,
'expense_versions_created' => 1, 'audits' => 1, 'financial_sources_unchanged' => true];
}
$output = function () use (&$rows) {
return implode("\n", array_map(fn ($row) => json_encode($row, JSON_THROW_ON_ERROR), $rows));
};
expect(landedQaReceiptsVerified($command, $output()))->toBeTrue();
$rows[1]['financial_sources_unchanged'] = false;
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
$rows[1]['financial_sources_unchanged'] = true;
array_pop($rows);
expect(landedQaReceiptsVerified($command, $output()))->toBeFalse();
});
test('cycle recovery requires exact table restoration replay and disposal receipts', function () {
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'recover-cycles'];
$valid = ['cycle_post_extension_all_tables_equal' => true, 'cycle_native_replays_without_effects' => true,
'cycle_history_and_reserve_restored' => true, 'cycle_reserved_minor' => 12000, 'cycle_pre_extension_all_tables_equal' => true];
$cleanup = json_encode(['isolated_restore_removed' => true], JSON_THROW_ON_ERROR);
expect(landedQaReceiptsVerified($command, json_encode($valid, JSON_THROW_ON_ERROR)."\n".$cleanup))->toBeTrue()
->and(landedQaReceiptsVerified($command, json_encode($valid, JSON_THROW_ON_ERROR)))->toBeFalse();
$valid['cycle_reserved_minor'] = 0;
expect(landedQaReceiptsVerified($command, json_encode($valid, JSON_THROW_ON_ERROR)."\n".$cleanup))->toBeFalse();
});
test('estimate contention receipts require all native uniqueness races and explicit estimate effects', function () {
$command = ['php', 'worker.php', 'compras_receipts_test_000000000001', 'race-estimate'];
$rows = [['old_runtime_rejected_before_balance' => true, 'old_estimate_runtime_rejected' => true,