feat(followup-audio): confirm role corrections and reextract cached transcripts
This commit is contained in:
@@ -36,9 +36,10 @@ final class FollowupAudioPipelineCheckpoint
|
||||
if ($version === 2) { $state += ['source_channels' => $sourceChannels, 'channel_policy' => self::CHANNEL_POLICY, 'silence_policy' => FollowupAudioPipelineMedia::SILENCE_POLICY]; }
|
||||
// Only new role-bound tasks carry this field. Historical checkpoints retain their exact shape.
|
||||
$ids = json_decode((string) ($task['upstream_ids_json'] ?? '{}'), true);
|
||||
if ($version === 2 && is_array($ids) && array_key_exists('channel_roles', $ids)) {
|
||||
$state['extraction_channel_roles'] = FollowupAudioStore::taskChannelRoles($task);
|
||||
if ($version === 2 && (is_array($ids) && array_key_exists('channel_roles', $ids) || (int) ($task['extraction_revision'] ?? 0) > 0)) {
|
||||
$state['extraction_channel_roles'] = FollowupAudioReextract::roles($task);
|
||||
}
|
||||
if ($binding = FollowupAudioReextract::binding($task)) { $state['extraction_binding'] = $binding; }
|
||||
return $state;
|
||||
}
|
||||
|
||||
@@ -53,8 +54,8 @@ final class FollowupAudioPipelineCheckpoint
|
||||
$version = $state['schema_version'] ?? 0;
|
||||
if (!in_array($version, [1, 2], true) || ($version === 2 && !is_int($state['source_channels'] ?? null))) { self::invalid(); }
|
||||
$expected = self::plan($task, $state['fingerprint'], $state['chunk_ms'], $version === 2 ? $state['source_channels'] : 1, $version);
|
||||
foreach (['schema_version', 'source_sha256', 'fingerprint', 'duration_ms', 'chunk_ms', 'source_channels', 'channel_policy', 'silence_policy', 'extraction_channel_roles'] as $field) {
|
||||
if (($state[$field] ?? null) !== ($expected[$field] ?? null)) { self::invalid(); }
|
||||
foreach (['schema_version', 'source_sha256', 'fingerprint', 'duration_ms', 'chunk_ms', 'source_channels', 'channel_policy', 'silence_policy', 'extraction_channel_roles', 'extraction_binding'] as $field) {
|
||||
if (FollowupAudioPolicy::canonical([$state[$field] ?? null]) !== FollowupAudioPolicy::canonical([$expected[$field] ?? null])) { self::invalid(); }
|
||||
}
|
||||
if (array_diff(array_keys($state), array_keys($expected)) || !is_array($state['chunks'] ?? null)
|
||||
|| !array_is_list($state['chunks']) || count($state['chunks']) !== count($expected['chunks'])) { self::invalid(); }
|
||||
@@ -118,8 +119,8 @@ final class FollowupAudioPipelineCheckpoint
|
||||
if ($expectedRevision !== $previous['revision'] || $next['revision'] !== $previous['revision'] + 1) {
|
||||
throw new FollowupAudioException('PIPELINE_CHECKPOINT_CONFLICT');
|
||||
}
|
||||
foreach (['schema_version', 'source_sha256', 'fingerprint', 'duration_ms', 'chunk_ms', 'source_channels', 'channel_policy', 'silence_policy', 'extraction_channel_roles'] as $key) {
|
||||
if (($next[$key] ?? null) !== ($previous[$key] ?? null)) { self::invalid(); }
|
||||
foreach (['schema_version', 'source_sha256', 'fingerprint', 'duration_ms', 'chunk_ms', 'source_channels', 'channel_policy', 'silence_policy', 'extraction_channel_roles', 'extraction_binding'] as $key) {
|
||||
if (FollowupAudioPolicy::canonical([$next[$key] ?? null]) !== FollowupAudioPolicy::canonical([$previous[$key] ?? null])) { self::invalid(); }
|
||||
}
|
||||
$changed = 0;
|
||||
foreach (array_merge($previous['chunks'], [$previous['extraction']]) as $index => $before) {
|
||||
|
||||
Reference in New Issue
Block a user