fix: preserve confirmed followup snapshots and expand flow checks

This commit is contained in:
2026-10-09 17:46:25 +08:00
parent 9185c6db04
commit e762a367da
7 changed files with 334 additions and 7 deletions
+4 -2
View File
@@ -182,10 +182,12 @@ final class FollowupAudioProbe extends Command
/** Checks synthetic audio-only canaries, tail event, and distinct normalized temporal facts. */
public static function verifyExtraction(array $result, array $expected): array
{
$transcript = preg_replace('/\s+/u', '', (string) ($result['transcript'] ?? ''));
// ASR punctuation/spacing is not a lexical error; changed words still fail.
$spokenWords = static fn (string $text): string => preg_replace('/[\p{P}\p{Z}\s]+/u', '', $text);
$transcript = $spokenWords((string) ($result['transcript'] ?? ''));
$canaries = true;
foreach ($expected['canaries'] ?? [] as $canary) {
$canaries = $canaries && is_string($canary) && $canary !== '' && str_contains($transcript, preg_replace('/\s+/u', '', $canary));
$canaries = $canaries && is_string($canary) && $canary !== '' && str_contains($transcript, $spokenWords($canary));
}
$matched = [];
foreach ($expected['facts'] ?? [] as $index => $fact) {
@@ -147,6 +147,8 @@ final class FollowupAudioApply
}
Db::name('followup_audio_task')->where('id', $taskId)->update([
'status' => 'applied', 'stage' => 'applied', 'version' => (int) $task['version'] + 1,
// The completed detail must show exactly the edits/selection confirmed in this transaction.
'review_cipher' => FollowupAudioStore::seal($taskId, 'review', array_replace($review, ['items' => $merged])),
'applied_cipher' => FollowupAudioStore::seal($taskId, 'applied', ['items' => $applied] + $roleAnnotation),
'applied_at' => time(), 'updated_at' => time(),
]);