38 lines
2.5 KiB
PHP
38 lines
2.5 KiB
PHP
<?php
|
|
// Record the user's observation only. No application or database access.
|
|
$path = __DIR__.'/acceptance-396c-results.json';
|
|
$original = file_get_contents($path);
|
|
$backup = __DIR__.'/acceptance-396c-results.before-line04-manual-20261015.json';
|
|
if (file_get_contents($backup) !== $original) { throw new RuntimeException('Evidence changed since preparation.'); }
|
|
$before = json_decode($original, true, 512, JSON_THROW_ON_ERROR);
|
|
$data = $before;
|
|
$caseIndex = array_search(4, array_column($data['cases'], 'scenario'), true);
|
|
$lineIndex = array_search(4, array_column($data['cases'][$caseIndex]['fixed_passage_lines'], 'line'), true);
|
|
$line = $data['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex];
|
|
if ($line['result'] !== 'não observado' || count($line['observations']) !== 1) { throw new RuntimeException('Unexpected state.'); }
|
|
$observation = $line['observations'][0];
|
|
$history = $observation;
|
|
$observation['prior_attempt_history'] = [$history];
|
|
$observation['result'] = 'passou';
|
|
$observation['observed_at'] = '2026-10-15';
|
|
$observation['observed_at_precision'] = 'local_date_only';
|
|
$observation['observation_timezone'] = 'Africa/Johannesburg';
|
|
$observation['observed_urls_from_context'] = $observation['entry_urls'];
|
|
$observation['operator'] = 'Confirmação manual do responsável na conversa';
|
|
$observation['observed'] = 'verifiquei e esta tudo conforme — resposta à conferência do mapa público e do corredor da carteira.';
|
|
$observation['evidence'][] = 'acceptance-396c-line04-manual-confirmation-20261015.json';
|
|
unset($observation['not_observed_reason']);
|
|
$line['observations'][0] = $observation;
|
|
$line['result'] = 'passou';
|
|
$line['progress_note'] = 'Duas partes da linha 04 confirmadas manualmente; não repetir. Estados agregados preservados.';
|
|
$data['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex] = $line;
|
|
$comparison = $data;
|
|
$comparison['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex] = $before['cases'][$caseIndex]['fixed_passage_lines'][$lineIndex];
|
|
if ($comparison !== $before) { throw new RuntimeException('Unrelated data changed.'); }
|
|
$encoded = json_encode($data, JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES|JSON_THROW_ON_ERROR);
|
|
$encoded = preg_replace_callback('/^ +/m', fn ($m) => str_repeat(' ', intdiv(strlen($m[0]), 2)), $encoded);
|
|
file_put_contents($path, $encoded."\n");
|
|
$saved = json_decode(file_get_contents($path), true, 512, JSON_THROW_ON_ERROR);
|
|
if ($saved !== $data) { throw new RuntimeException('Saved record differs.'); }
|
|
echo "Linha 04 passou; restantes linhas e estados agregados preservados.\n";
|