Files
Investidor-V2/outputs/investmoz-audit-current-20261012/record-line01-QA21-manual-20261015.php
T
nala c13f250b87
tests / ci (push) Canceled after 0s
versao compilada
2026-10-15 17:37:00 +02:00

56 lines
3.4 KiB
PHP

<?php
// Documentation only: no application bootstrap, HTTP requests or database access.
$path = __DIR__.'/acceptance-396c-results.json';
$original = file_get_contents($path);
$data = json_decode($original, true, 512, JSON_THROW_ON_ERROR);
$before = $data;
$backup = __DIR__.'/acceptance-396c-results.before-line01-QA21-manual-20261015.json';
if ((is_file($backup) && file_get_contents($backup) !== $original) || $data['base_review'] !== '396c691930bc' || $data['visual_acceptance_complete'] !== false) {
throw new RuntimeException('Preserve existing evidence and aggregate state.');
}
$caseIndex = array_search(1, array_column($data['cases'], 'scenario'), true);
$lineIndex = array_search(1, array_column($data['cases'][$caseIndex]['fixed_passage_lines'], 'line'), true);
$line = &$data['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex];
$observationIndex = array_search(1, array_column($line['observations'], 'phase'), true);
$observation = &$line['observations'][$observationIndex];
if ($observation['role'] !== 'QA21' || $observation['result'] !== 'não observado') {
throw new RuntimeException('Unexpected observation state.');
}
$observation['prior_attempt_history'] = [$observation];
$observation['result'] = 'passou';
$observation['observed_at'] = '2026-10-15';
$observation['observed_at_precision'] = 'local_date_only';
$observation['observation_timezone'] = 'Africa/Johannesburg';
$observation['observed_url'] = null;
$observation['observed_urls_from_context'] = [
'https://portal-investidor.test:18445/minhas-oportunidades/30/view',
'https://portal-investidor.test:18445/minhas-oportunidades/30/resources',
];
$observation['operator'] = 'Confirmação manual do responsável na conversa';
$observation['observed'] = 'Campos da licença conferidos e documento aberto e legível.';
$observation['failure'] = null;
$observation['evidence'][] = 'acceptance-396c-line01-QA21-manual-confirmation-20261015.json';
$observation['entry_urls'] = $observation['observed_urls_from_context'];
$line['entry_url'] = $line['first_phase_entry_url'] = $observation['entry_urls'][0];
$line['progress_note'] = 'QA21/fase 1 passou por confirmação manual; fase 2/QA24→QA25 não observada. Linha composta pendente.';
if ($line['result'] !== 'não observado') {
throw new RuntimeException('Composite line must remain pending.');
}
unset($observation, $line);
$updatedLine = $data['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex];
$comparison = $data;
$comparison['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex] = $before['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex];
if ($comparison !== $before) {
throw new RuntimeException('Unrelated state changed.');
}
foreach ($updatedLine['observations'] as $index => $item) {
if ($index !== $observationIndex && $item !== $before['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex]['observations'][$index]) {
throw new RuntimeException('Another phase changed.');
}
}
if (! is_file($backup)) { file_put_contents($backup, $original); }
$encoded = json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR);
$encoded = preg_replace_callback('/^ +/m', fn ($match) => str_repeat(' ', intdiv(strlen($match[0]), 2)), $encoded);
file_put_contents($path, $encoded."\n");
echo json_encode(['line'=>1, 'QA21'=>'passou', 'phase_2'=>'não observado', 'other_lines_and_aggregate_states_unchanged'=>true], JSON_UNESCAPED_UNICODE|JSON_THROW_ON_ERROR).PHP_EOL;