Exige motivo na reversão territorial e prepara novo plano

This commit is contained in:
2026-10-09 02:15:36 +02:00
parent 6a71aa47e3
commit 6c7a9c9442
9 changed files with 129 additions and 11 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ $proof['dossiers'] = $pdo->query('SELECT id,project_id,cluster_id,title,source,c
$proof['legal_sources'] = $pdo->query('SELECT id,title,url,diploma,article,competent_entity,validation_status,validated_at,version_no,valid_from,valid_until FROM investment_legal_sources ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);
$proof['geo_sources'] = $pdo->query('SELECT id,name,responsible_entity,reference,checksum,source_version,status,approval_reference FROM geo_sources ORDER BY id')->fetchAll(PDO::FETCH_ASSOC);
$proof['geo_profiles'] = $pdo->query('SELECT geo_location_id,source_id,status,valid_from,valid_to FROM geo_territory_profiles ORDER BY geo_location_id')->fetchAll(PDO::FETCH_ASSOC);
$proof['traceability_events'] = $pdo->query("SELECT id,action,occurred_at FROM audit_events WHERE source_system='territory-traceability-v2' ORDER BY occurred_at,id")->fetchAll(PDO::FETCH_ASSOC);
$proof['traceability_events'] = $pdo->query("SELECT id,action,occurred_at,actor_user_id,after_data FROM audit_events WHERE source_system='territory-traceability-v2' ORDER BY occurred_at,id")->fetchAll(PDO::FETCH_ASSOC);
$pdo->exec('ROLLBACK');
file_put_contents(dirname(__DIR__).'/storage/app/private/investmoz-v2/territory-audit.json', json_encode($proof, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR));
echo json_encode(['identity' => $proof['identity'], 'records' => count($proof['records']), 'territories' => count($proof['geography']), 'geometries' => count($proof['geometries'])], JSON_THROW_ON_ERROR).PHP_EOL;
+1 -1
View File
@@ -56,7 +56,7 @@ if ($applied['changed'] !== count($plan['updates']) || ! $replayed['replayed'] |
throw new RuntimeException('Application/idempotence failed.');
}
$sources = $service->sources('economic_clusters', $plan['rows'][array_search('economic_clusters', array_column($plan['rows'], 'kind'))]['record_id']);
$reversed = $service->apply($qaHash, $actor, true);
$reversed = $service->apply($qaHash, $actor, true, 'Ensaio de reversão na cópia QA restaurada.');
$after = $snapshot();
foreach ($after as $index => $row) {
$expected = $before[$index];
@@ -121,6 +121,21 @@ const base = 'http://127.0.0.1:18093';
/citação recuperada; ponte ao exemplar oficial por recuperar/,
);
await page.goto(base + '/management/relationship-repair');
assert.equal(
await page
.getByRole('button', {
name: 'Reverter este incremento de rastreabilidade',
exact: true,
})
.isEnabled(),
false,
);
await page
.getByLabel('Motivo da reversão')
.fill('Ensaio consciente de reversão no navegador QA.');
await page
.getByLabel('Confirmo que pretendo reverter este incremento')
.check();
const reversal = page.waitForResponse(
(response) =>
response.request().method() === 'POST' &&