feat(ai-translation): translate Lexical Poll node - #2709
Merged
Conversation
The vite define macros added in 1783b79 are not substituted in vitest's globalSetup (which runs in Node directly, not through vite), causing a ReferenceError when env.global is imported via the globalSetup -> path.constant chain. Add typeof guards with process.env fallbacks so the module works in both contexts.
… labels Parser walks Poll nodes (type: 'poll') and emits a PropertySegment for the question and one per non-empty option label. Mirrors the existing Excalidraw special-case: extract before skip-block checks and emit segments against the appropriate node ref (option object for labels) so the existing string-path restore writes back to option.label directly. Restore path and property whitelist util are unchanged. Spec: docs/superpowers/specs/2026-05-12-lexical-poll-translation-design.md
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
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
type: 'poll'): thequestionand every non-emptyoption.labelare now extracted asPropertySegments by the translation parser, translated, and written back in place. All non-translatable metadata (pollId,options[i].id,mode,closeAt,showResults,type,version) is preserved verbatim.walkNode: extract before the skip-block checks and emit segments with the appropriatenoderef (the option object itself for labels) so the existing string-path restore writes back tooption.labeldirectly. No changes torestoreLexicalTranslationor the property-whitelist util.fix(build): guard __DEV__/__TEST__ macros for non-vite contexts) — the vite define macros added in 1783b79 are not substituted in vitest's globalSetup (which runs outside vite), causingReferenceError: __DEV__ is not definedand breaking the entire test suite. Guards added so the module works in both contexts.Spec
docs/superpowers/specs/2026-05-12-lexical-poll-translation-design.mdTest plan
pnpm -C apps/core exec vitest run test/src/modules/ai/lexical-translation-parser.spec.ts— all 54 cases pass, including 4 new poll cases (parse, round-trip restore, empty-label skip, nested in details)pnpm -C apps/core exec eslint --max-warnings 0clean on all changed files