Repository navigation
fix(metadata): never let a forced AI re-translation replace provider text - #2214
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Visible changes lack evidence: the Evidence section only says the link is forthcoming.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
|
Both referenced validation cases are Suggested correction: Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…text The metadata editor's re-translate switch (force) let an AI job overwrite localized descriptions a metadata provider had supplied. AC4 of the AI metadata translation feature says machine translations must not overwrite human- or provider-supplied translations. AI writes now land only where a field is empty or holds earlier AI text, in both the translation service and the localization repository, so no caller can bypass it. force now means "also refresh earlier AI text"; provider and manual text is always kept. The editor switch is renamed "Re-translate AI text" and its description says existing descriptions are kept.
91c8f75 to
7619498
Compare
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Evidence is linked in the description now: https://evidence.siloserver.org/r/silo-server/pr-2214/ (an item with a provider German overview after a forced re-translate, and the editor switch, on desktop and mobile web, before and after). The |
Quick104
left a comment
There was a problem hiding this comment.
Review of 7619498. The rule itself is right: AI writes now land only on empty or AI-written fields, and the service and the repository agree for every source value the schema allows (provider, ai, manual, enforced by a CHECK constraint). Three inline findings below, plus two items with no diff line:
- Stale comments (low).
internal/models/media.goaboveLocalizationSourceProviderstill says AI may overwrite provider text "when the admin explicitly forces a re-translation", and thecollectFieldscomment ininternal/metadata/translation/service.gosays force "still respects manual provenance", implying it overrides provider text. Both now describe the behavior this PR removes. I'm fixing both in a commit on this branch, so there's no need to change them yourself. - Validation tasks line. #1213 C2 and #1214 C1 haven't been run yet, so this PR can't change a recorded result. It makes their criteria ("without overwriting human/provider values") passable, which the repository's format writes as
unblocks #1213 C2; unblocks #1214 C1. I'll update the PR body.
A summary with scores follows once the fixes are pushed.
…otes List TestAITranslationNeverOverwritesProviderOrManualText in the DB contracts so CI runs it against a migrated database; it skipped in every job before. Reuse the models provenance constants in translatableField and correct two comments that still said a forced job may overwrite provider text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
# Conflicts: # docs/admin-catalog-api.md # internal/metadata/translation/service_test.go # scripts/ci/db-contracts.txt
|
Review summary (reviewed head 3bfb2c5; findings came from 7619498) Fit: 9/10 · Readiness: 9/10 — ready (assuming CI is green) Fit: #1212 AC4 says machine translations must not overwrite provider or human text. This PR enforces that in the repository, the one place every AI write passes through, and narrows Readiness: the rule matches between Addressed
Remaining
Validated features User manual Apple / Android Review method |
|
The PR body currently says Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
Agreed. |
#4234) * fix(metadata): let a plain AI translation fill only fields still empty A plain AI translation job collects only fields whose localized value is empty, but its writes replaced any AI-sourced value. A forced re-translation that finished while a plain job was still running could then be overwritten with a translation of the older source text. The item, season and episode AI writes take the job's force flag again. A forced job keeps the rule #2214 set: fill an empty field or replace earlier AI text, never provider or manual text. A plain job fills only a field that is still empty when it writes. Closes #2472 Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(catalog): reuse localizationTestPool in the plain AI translation test Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Quick104 <[email protected]>
Problem
Related issue: #1212
Validation tasks: changes #1213 C2; changes #1214 C1
The metadata editor's re-translate switch let an AI job overwrite localized descriptions a metadata provider had supplied. AC4 of #1212 says machine translations must not overwrite human- or provider-supplied translations.
Approach
AI writes now land only where a field is empty or holds earlier AI text. The translation service and the localization repository both enforce this, so no caller can bypass it.
forcenow means "also refresh earlier AI text"; provider and manual text is always kept. The editor switch is renamed "Re-translate AI text", and its description says existing descriptions are kept.docs/admin-catalog-api.mdand the v2 field docs say the same.Validation
Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-2214/
Risks
Admins who used the switch to replace provider text can't do that any more, which is the point of AC4.
Checklist
AI Disclosure
/code-review(medium) over the combined diff of all [v1] AI metadata translation #1212 server branches before opening. It found one bug in the on-view language guard (see fix(metadata): limit on-view translation to the viewer's missing language #2211), which is fixed there; nothing in this branch.Note
Fix forced AI metadata re-translation to preserve provider and manual text
translation.LocalizationStore, the catalog repositories in localization_repo.go, and callers in service.go. SQL conflict updates now replace a value only when its current source is AI or empty.translation.translatableField) uses shared provenance constants: manual fields are always skipped, even when empty.TestAITranslationNeverOverwritesProviderOrManualTextand reworked service tests; registered in db-contracts.txt.UpsertAITranslationand theUpsertAIOverviewmethods in localization_repo.go for the new conflict clauses.Macroscope summarized 3bfb2c5.