fix(agentic-localization): harden translation inspector writes#7
Merged
fix(agentic-localization): harden translation inspector writes#7
Conversation
…ence Enables purple presence indicators in Studio when Agent Actions (translate, prompt, generate) are processing documents.
…tadata lifecycle - Fix double-append bug: @sanity/client's Patch stores insert as a single slot, so chaining two .append() calls overwrites the first. Split metadata transaction into two patches (translations + workflowStates). - Deterministic metadata IDs via getTranslationMetadataId() using @sanity/id-utils, with createIfNotExists to prevent race-condition duplicates from concurrent tabs. - Validate result._id from translate API before using it. - Use Studio's documentStore.pair.editOperations() for approve, dismiss, and apply-pre-translation actions (permission-aware, proper doc lifecycle). - Add useDocumentPairPermissions RBAC gating on metadata writes. - Fix writeReviewProgress read-modify-write race with atomic array patches. - Fix useDocumentLanguage for draft-only docs by switching from preview store (useDocumentValues) to documentStore.listenQuery with raw perspective. - Don't clear locale selection until translation succeeds. - Seed realistic workflowStates and staleAnalysis into sample metadata docs. - Add unit tests for ids, staleAnalysisCache, types, and getStatusDisplay.
…ated fields - Remove LegacyDocumentStatus and TranslationDataStatus types from l10n package — dashboard-only lifecycle statuses (published, draft, inRelease, missingWithFallback) now live in the dashboard's TranslationStatusBadge. - Remove deprecated summary/materialityExplanation fields from StaleAnalysisResult and schema; consolidate on single explanation field. - Remove deprecated isPublished from LocaleTranslation (use documentState). - Use KeyedObject from sanity instead of manual _key: string on WorkflowStateEntry, ReviewProgress, and dashboard types. - Simplify parseAnalysisResponse in both function and hook to drop legacy field fallback logic.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ctual script Add missing "consolidates env files" step and a collapsed manual-steps section listing the individual CLI commands for each bootstrap step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@sanity/client'sPatchstoresinsertas a single slot; chaining two.append()calls silently overwrites the first. Split metadata transaction into two patches so bothtranslationsandworkflowStatespersist.getTranslationMetadataId()using@sanity/id-utilswithcreateIfNotExistsprevents race-condition duplicates from concurrent tabs.documentStore.pair.editOperations()replaces rawclient.patch()for permission-aware, lifecycle-correct writes. RBAC gating viauseDocumentPairPermissions.useDocumentLanguageswitched from preview store (useDocumentValues) todocumentStore.listenQuerywith raw perspective, fixing "no language set" on newly translated docs.LegacyDocumentStatus, deprecatedsummary/materialityExplanationfields, andisPublishedremoved. Dashboard-only lifecycle statuses moved toTranslationStatusBadge.writeReviewProgressrace — atomic array patches replace read-modify-write pattern.ids,staleAnalysisCache,types, andgetStatusDisplay.Test plan
pnpm --filter l10n test— 158 tests passpnpm generate-sample-data— only expected draft-reference warnings