fix(content): pin non-i18n meta to default locale; upgrade contentrain to 2.x#155
Merged
Conversation
…n to 2.x Coordinated upgrade of the Contentrain ecosystem trio (forced — mcp 2.0.1 and query 7.0.1 both pin @contentrain/types@0.9.0 exactly): - @contentrain/mcp 1.10.0 -> 2.0.1 - @contentrain/types 0.8.0 -> 0.9.0 - @contentrain/query ^6.2.1 -> ^7.0.1 MCP 2.x changed two contracts Studio depends on: - planContentDelete now requires `defaultLocale`; thread config.locales.default through delete-content.ts. - metaFilePath pins a non-i18n model's single meta record to the default locale. Studio's resolveMetaPath used the raw request locale, so a non-i18n save / status-change / delete at a non-default locale wrote meta to a path the readers never looked at — the status override silently no-op'd, the entry reset to draft, and it dropped from the CDN build. Reachable via the content editor API, the status PATCH route, and the chat agent tools. Delegate content + meta path assembly to MCP's contentFilePath / documentFilePath / metaFilePath so Studio can no longer drift from planContentSave's write path. Studio keeps only what MCP deliberately omits: the content_path security guard (assertSafeContentPath), the contentRoot prefix, and the slug-absent directory return. Thread defaultLocale through every resolveMetaPath caller (save-content, save-document, update-status incl. copyLocale/copyDocumentLocale, init-project, brain-cache, cdn-builder) and drop the now-redundant read-side `=== 'data' ? defaultLocale : locale` workarounds. Ecosystem-sync process: group @contentrain/* in dependabot so ecosystem bumps land as one reviewable PR; align CI/release to the pinned `contentrain-query generate` bin (no `contentrain` bin exists); add docs/CONTENTRAIN_UPGRADE.md. Tests updated for types@0.9.0's stricter validator messages, the resolveMetaPath signature, and the new config read in updateEntryStatus/copyLocale.
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.
Ne / neden
Contentrain ekosistem paketlerinin üçünde de 2026-07-16'da büyük sürüm çıktı. Studio üçüne de bağımlı; bu koordineli bir geçiş (mcp 2.0.1 ve query 7.0.1 ikisi de
@contentrain/types@0.9.0'a exact bağlı — ayrı ayrı bump'lanamaz).@contentrain/mcp@contentrain/types@contentrain/queryDeğişiklikler
Kesin kırılma (derleme): MCP 2.x'te
planContentDeleteartıkdefaultLocaleistiyor →delete-content.ts'econfig.locales.defaultthreadlendi.Canlı hata (non-i18n meta): MCP 2.x
metaFilePath'ii18n:falsebir modelin tek meta kaydını default locale'e sabitliyor. Studio ham request locale'i kullanıyordu; non-i18n bir model default-olmayan locale ile kaydedilince/status değişince/silinince meta, okuyucuların (brain/CDN) hiç bakmadığı bir yola yazılıyordu → status override sessizce düşüyor, kayıtdraft'a dönüyor, CDN build'den kayboluyordu. Content editor API, status PATCH ve chat agent tool'ları üzerinden erişilebilirdi.Çözüm:
content-paths.ts'te content + meta path üretimi MCP'nincontentFilePath/documentFilePath/metaFilePath'ine devredildi — Studio artıkplanContentSave'in yazma yolundan sapamaz. Studio yalnız MCP'nin bilinçli olarak kapsamadığını tutuyor:content_pathgüvenlik guard'ı (assertSafeContentPath),contentRootprefix'i, ve slug'sız dizin dönüşü.defaultLocaletümresolveMetaPathçağıranlarına threadlendi; read-side=== 'data'workaround'ları kalktı.Süreç (ekosistem senkron): dependabot'a
@contentrain/*grubu (majör bump'lar tek PR); CI/releasenpx contentrain generate→pnpm exec contentrain-query generate(pinlenmiş doğru bin);docs/CONTENTRAIN_UPGRADE.mdrunbook.Doğrulama
pnpm typecheck✅ ·pnpm lint✅ (0 hata) ·pnpm test✅ (1068/1068) ·pnpm build✅ (v7 client + Nuxt)Merge sonrası (staging'de doğrulanacak)
Mock'lu git testleri MCP write-path davranışını gizler. Railway staging'de gerçek write-path:
contentrain_validate→ types 0.9.0'ın yeni semantik hatalarının (bozuk slug/date/percent) kapsamını çıkarNot (upstream fırsatı)
@contentrain/mcp/core/opscontentDirPath'i export etmiyor; edilirse Studio son yerel content-dir helper'ını da bırakabilir (bu PR gerektirmiyor).