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
+3 -2
View File
@@ -1944,7 +1944,7 @@ func TestAdminControlForwardsAllowlistedActions(t *testing.T) {
{name: "repair", action: "repair", rpcMethod: "resource.repair", call: "resource.repair"},
{name: "catalog refresh", action: "catalog-refresh", rpcMethod: "catalog.refresh", call: "catalog.refresh"},
{name: "task cancel", action: "task-cancel", body: `{"task_id":"task-sync-1"}`, rpcMethod: "task.cancel", call: "task.cancel"},
{name: "translation task update", action: "translation-task-update", body: `{"task_id":"textunit/v-current/Scenario","status":"completed","provider":"manual","provider_run_id":"manual-run-1","translation_results":[{"unit_id":"direct:a#unit:0","source_text":"source","translated_text":"译文","glossary_override":{"reviewer":"reviewer","reason":"approved deviation","provenance":"manual-review","confirmed_unix_seconds":100}}]}`, rpcMethod: "translation.task.update", call: "translation.task.update"},
{name: "translation task update", action: "translation-task-update", body: `{"task_id":"textunit/v-current/Scenario","status":"completed","provider":"manual","provider_run_id":"manual-run-1","translation_results":[{"unit_id":"direct:a#unit:0","source_text":"source","translated_text":"译文","glossary_override":{"qa_identity":"gqa-v1-test","reviewer":"reviewer","reason":"approved deviation","provenance":"manual-review","confirmed_unix_seconds":100}}]}`, rpcMethod: "translation.task.update", call: "translation.task.update"},
{name: "translation worker run", action: "translation-worker-run", body: `{"provider":"mock","concurrency":8,"max_tasks":2,"retry_backoff_seconds":0,"worker_id":"dashboard-worker"}`, rpcMethod: "translation.worker.run", call: "translation.worker.run"},
{name: "translation proofread", action: "translation-proofread", rpcMethod: "translation.proofread", call: "translation.proofread"},
{name: "translation memory confirm", action: "translation-memory-confirm", body: `{"record_id":"tm-record-1","reviewer":"reviewer","reason":"reviewed"}`, rpcMethod: "translation.memory.confirm", call: "translation.memory.confirm"},
@@ -1983,7 +1983,8 @@ func TestAdminControlForwardsAllowlistedActions(t *testing.T) {
len(backend.translationTaskUpdates[0].TranslationResults) != 1 ||
backend.translationTaskUpdates[0].TranslationResults[0].TranslatedText != "译文" ||
backend.translationTaskUpdates[0].TranslationResults[0].GlossaryOverride == nil ||
backend.translationTaskUpdates[0].TranslationResults[0].GlossaryOverride.Reviewer != "reviewer" {
backend.translationTaskUpdates[0].TranslationResults[0].GlossaryOverride.Reviewer != "reviewer" ||
backend.translationTaskUpdates[0].TranslationResults[0].GlossaryOverride.QAIdentity != "gqa-v1-test" {
t.Fatalf("translation task updates=%#v", backend.translationTaskUpdates)
}
if len(backend.translationMemoryConfirmParams) != 1 ||
+5 -2
View File
@@ -534,7 +534,7 @@ paths:
type: string
responses:
"200":
description: Glossary constraints, diagnostics, and blocked decision.
description: Glossary constraints, diagnostics, blocked decision, and stable qa_identity.
"400":
description: Missing source text or invalid context.
"401":
@@ -628,9 +628,12 @@ paths:
type: string
glossary_override:
type: object
required: [reviewer, reason, provenance, confirmed_unix_seconds]
required: [qa_identity, reviewer, reason, provenance, confirmed_unix_seconds]
additionalProperties: false
properties:
qa_identity:
type: string
minLength: 1
reviewer:
type: string
reason:
+1
View File
@@ -513,6 +513,7 @@ type GlossaryTermSnapshot struct {
// GlossaryOverride records explicit human approval for a deviation.
type GlossaryOverride struct {
QAIdentity string `json:"qa_identity"`
Reviewer string `json:"reviewer"`
Reason string `json:"reason"`
Provenance string `json:"provenance"`
+1
View File
@@ -464,6 +464,7 @@ func TestTranslationTaskUpdateSendsWorkerParams(t *testing.T) {
SourceText: "source",
TranslatedText: "译文",
GlossaryOverride: &GlossaryOverride{
QAIdentity: "gqa-v1-test",
Reviewer: "reviewer",
Reason: "approved deviation",
Provenance: "manual-review",