Repository navigation
fix(cli): translated component docs must not drop props - #3892
Merged
Merged
Conversation
A docsZh/docsDense block that carries its own `props` array was returned wholesale by the loader instead of being overlaid onto the English doc. That made the translation a REPLACEMENT, not an overlay: any prop the translation had not caught up with simply ceased to exist. $ astryx component Button --zh # isInterruptible and isIconOnly: absent. They exist in English. Ten components were affected — including MobileNav, Popover and Stack through the multi-component `components[]` shape, which a props-length check alone does not see. A reader of the translated docs cannot discover a prop that is not there, and CLAUDE.md instructs every AI agent to run `astryx component <Name>` before touching a component. A prop missing from the docs is a prop that never gets used. Translations are now overlaid, matched by prop NAME rather than position: a prop the translation does not cover falls back to its English entry instead of vanishing. The prop's contract (type, default, required) stays authoritative from the English doc while the translation supplies the prose, so a stale translation can no longer misstate a type either. Existing Chinese descriptions are untouched. Same principle as the reference-doc overlay fix (meta#2182): an overlay that covers a subset must not destroy what it does not cover. Claude-Session: https://claude.ai/code/session_01VYm8FsvUjk3xwDmonZRYeE
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis ReportNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | View full report |
AKnassa
marked this pull request as ready for review
July 13, 2026 01:16
Contributor
|
cc: @josephfarina for CLI docs. It looks like translation docs can override prop definitions from the canonical docs. I wonder if we should strip down the translation docs to just the description and enforce that via type or lint? Aside from the description, the rest of the doc properties seem like they would need to be consistent with the canonical English docs to be correct. |
This was referenced Jul 20, 2026
josephfarina
added a commit
that referenced
this pull request
Jul 20, 2026
… + CI gate - backfill stable block ids into theme (50) and layout (13) canonical docs - regenerate theme/tokens/layout dense+zh overlays as prose-only id-keyed blocks - extend docOverlays.test: every overlay block id resolves to a real base block, overrides are prose-only (id + text/items only), base block ids are unique; legacy positional `content` shape is now rejected - component-doc surface already safe via #3892 (overlayComponentDoc, name-matched) Refs #2182 Co-authored-by: Cursor <[email protected]>
josephfarina
added a commit
that referenced
this pull request
Jul 20, 2026
Make reference-doc dense/zh overlays structurally unable to drop, misalign, or override canonical content (the #2182 / #3891 bug class). - ContentBlock gains an optional stable id; ReferenceTranslationDoc is prose-only, id-keyed blocks and cannot express type/code/table/structure - api/docs.mjs merge is id-anchored and fail-safe: unmatched or unexpressible overrides fall back to canonical English; no array positions anywhere - all reference docs migrated: principles, theme, layout (per-block ids), tokens (ids emitted from scripts/generate-token-docs.mjs); overlays rewritten to blocks - docOverlays.test.mjs gate: every overlay block id resolves, prose-only, unique base ids, and the legacy positional content shape is rejected - component/hook overlays already safe on main via #3892 (overlayComponentDoc) Refs #2182 Co-authored-by: Cursor <[email protected]>
31 of 40 tasks
This branch was successfully deployed
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.
Found while fixing #2182 — same bug class, different surface. No issue filed for this one; happy to open one if you'd prefer it tracked.
The bug
A
docsZh/docsDenseblock that carries its ownpropsarray was returned wholesale by the loader instead of being overlaid onto the English doc. That makes the translation a replacement, not an overlay — so any prop the translation hasn't caught up with simply ceases to exist.Ten components are affected. Seven show up as a plain
props-length mismatch (Button, Card, Center, DateInput, FileInput, StatusDot, Tokenizer); three more — MobileNav, Popover, Stack — hide inside the multi-componentcomponents[]shape, which a length check doesn't see. The test found those three; I hadn't.Why it matters beyond i18n:
CLAUDE.mdinstructs every AI agent to runastryx component <Name>before touching a component. A prop that isn't in the docs is a prop that never gets used.The fix
Translations are overlaid, matched by prop name rather than position. A prop the translation doesn't cover falls back to its English entry instead of vanishing.
The prop's contract (
type,default,required) also stays authoritative from the English doc while the translation supplies only the prose — so a stale translation can no longer misstate a type, which is the same failure mode one step further along.Existing Chinese descriptions are untouched:
variantstill reads 视觉样式变体。Same principle as #2182 — an overlay that covers a subset must not destroy what it doesn't cover.
Test plan
pnpm exec vitest run— 337 files, 6487 tests, all passing.pnpm check:repo— all five gates pass.One thing to flag honestly: on my first full-suite run,
packages/cli/src/commands/template.path-safety.test.mjs > treats targetPath with .tsx extension as a filefailed. It is not caused by this change — it passes in isolation on this branch and on cleanmain, and a second unmodified full-suite run went green (337/337). It looks order-dependent under parallel execution. Mentioning it in case it's worth its own flake issue.