fix(glossary): 绑定 QA identity 与人工 override
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

This commit is contained in:
2026-09-09 00:25:49 +08:00
parent 0275a890bc
commit 68c6c91b1e
22 changed files with 844 additions and 92 deletions
+51
View File
@@ -352,6 +352,12 @@ pub struct LocalizedPatchOperation {
/// Review state used by the publication input.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub review_status: Option<String>,
/// Glossary QA recomputed for this publication.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub glossary_qa: Option<bat_core::domain::GlossaryQaReport>,
/// Human confirmation bound to the published Glossary QA identity.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub glossary_override: Option<bat_core::domain::GlossaryOverride>,
}
/// Rollback information recorded for a localized publication.
@@ -962,6 +968,8 @@ impl LocalizedPatchOperation {
translation_source_kind: None,
translation_memory_record_id: None,
review_status: None,
glossary_qa: None,
glossary_override: None,
},
metadata,
)
@@ -989,6 +997,8 @@ impl LocalizedPatchOperation {
translation_source_kind: None,
translation_memory_record_id: None,
review_status: None,
glossary_qa: None,
glossary_override: None,
},
metadata,
)
@@ -1015,6 +1025,8 @@ impl LocalizedPatchOperation {
translation_source_kind: None,
translation_memory_record_id: None,
review_status: None,
glossary_qa: None,
glossary_override: None,
},
metadata,
))
@@ -1032,6 +1044,8 @@ impl LocalizedPatchOperation {
operation.translation_source_kind = metadata.translation_source_kind.clone();
operation.translation_memory_record_id = metadata.translation_memory_record_id.clone();
operation.review_status = Some(metadata.review_status.clone());
operation.glossary_qa = metadata.glossary_qa.clone();
operation.glossary_override = metadata.glossary_override.clone();
}
operation
}
@@ -1058,6 +1072,8 @@ impl Default for LocalizedPatchOperation {
translation_source_kind: None,
translation_memory_record_id: None,
review_status: None,
glossary_qa: None,
glossary_override: None,
}
}
}
@@ -1432,6 +1448,8 @@ mod tests {
translation_source_kind: Some("provider".to_string()),
translation_memory_record_id: None,
review_status: Some("provider_completed".to_string()),
glossary_qa: None,
glossary_override: None,
}],
}],
rollback: LocalizedPatchRollbackInfo {
@@ -1461,6 +1479,39 @@ mod tests {
);
}
#[test]
fn manifest_operation_keeps_current_glossary_qa_provenance() {
let qa = bat_core::domain::GlossaryQaReport {
qa_identity: "gqa-v1-current".to_string(),
status: bat_core::domain::GlossaryQaStatus::Pass,
constraints: Vec::new(),
diagnostics: Vec::new(),
};
let input = LocalizedPatchInput::TextAsset(LocalizedTextAssetPatch {
bundle_path: "Bundles/file.bundle".to_string(),
text_asset: TextAssetPatch::new("CAB-asset", 1, b"target".to_vec()),
metadata: Some(LocalizedPatchOperationMetadata {
text_unit_id: "unit-1".to_string(),
source_text_blake3: "source-hash".to_string(),
translation_provider: None,
provider_run_id: None,
translation_source_kind: Some("manual".to_string()),
translation_memory_record_id: None,
review_status: "manual_reviewed".to_string(),
glossary_qa: Some(qa.clone()),
glossary_override: None,
}),
});
let operation = input.manifest_operation().unwrap();
assert_eq!(
operation
.glossary_qa
.as_ref()
.map(|report| report.qa_identity.as_str()),
Some("gqa-v1-current")
);
}
#[cfg(unix)]
#[test]
fn publishes_a_separate_localized_release_atomically() {