Conversation
MOTIVATION: - Branch codex/wip-book-switching-shelf-2026-03-29 had 12 conflicting files, making rebase impractical. Re-implement 3 features cleanly on current main. APPROACH: - Feature 1: dedup chapter dropdown labels — add titleAlreadyStartsWithNumber() and buildChapterDisplayLabel() to the hook; replace the old numPrefix string concatenation so "Ch 5: Chapter 5: The Title" becomes "Chapter 5: The Title". - Feature 2: translation settings snapshot — new utility file capturing the settings fields that affect translation output (provider, model, temperature, systemPrompt, contextDepth, fan-translation flags). Standalone utility only; wiring into the pipeline is deferred (touched too many conflicting files). - Feature 3: historical fan context setting — add the includeHistoricalFanTranslationsInContext boolean to AppSettings, default it to false in defaultSettings, and surface a toggle in TranslationParametersSection (with AdvancedPanel wired to pass the value and handler through). CHANGES: - hooks/useChapterDropdownOptions.ts: add titleAlreadyStartsWithNumber() and buildChapterDisplayLabel() (exported for tests); replace raw template-literal label with buildChapterDisplayLabel() call - services/translationSettingsSnapshot.ts: new file — TranslationSettingsSnapshot type, TranslationSettingsSnapshotInput, normalizeTranslationSettingsSnapshot() - types.ts: add includeHistoricalFanTranslationsInContext?: boolean to AppSettings - services/sessionManagementService.ts: default includeHistoricalFanTranslationsInContext to false - components/settings/TranslationParametersSection.tsx: add prop and checkbox UI for includeHistoricalFanTranslationsInContext - components/settings/AdvancedPanel.tsx: wire new prop and handler through to TranslationParametersSection IMPACT: - Dropdown no longer shows "Ch 5: Chapter 5: …" for chapters whose translated title already contains the chapter number. - Translation settings are now snapshottable for reproducibility/comparison. - Users can toggle historical fan-translation context inclusion in the Advanced panel. TESTING: - npx tsc --noEmit passes (only pre-existing errors in scripts/ and clientTelemetry.ts) - buildChapterDisplayLabel is exported for unit tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…nto pipeline MOTIVATION: - Translation settings snapshot utility existed but was not called during actual translation, so results lacked reproducibility metadata - Historical fan translation context toggle existed in UI but was not connected to the prompt builder, so enabling it had no effect - Dropdown dedup utility existed and was verified as already properly wired APPROACH: - Call normalizeTranslationSettingsSnapshot() after translation completes and attach to TranslationResult.translationSettings - Thread includeHistoricalFanTranslations through all three history-building paths (memory candidates, IDB hydration, prevUrl chain fallback) - Render fanTranslationReference in formatHistory() prompt output - Use normalized snapshots in shouldEnableRetranslation() for consistent comparison, including the new historicalFanChanged detection CHANGES: - types.ts: Add fanTranslationReference to HistoricalChapter, add includeHistoricalFanTranslationsInContext to TranslationSettingsSnapshot - services/translationService.ts: Import and call normalize snapshot, pass fan context flag through all history builders, update extractSettingsSnapshot and shouldEnableRetranslation - services/prompts.ts: Render fan translation reference block in formatHistory when present on a historical chapter IMPACT: - Translations now carry a settings snapshot for reproducibility - Retranslation detection now catches changes to the historical fan context toggle - When includeHistoricalFanTranslationsInContext is enabled, previous chapters' fan translations appear in the translation prompt context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Re-implements 3 features from
codex/wip-book-switching-shelf-2026-03-29cleanly on current main. The stale branch had 12 conflicting files making rebase infeasible, so each feature was re-implemented from scratch by reading the branch source.Feature 1 — Dropdown chapter label dedup: Chapter dropdown no longer shows
Ch 5: Chapter 5: The Title. AddedtitleAlreadyStartsWithNumber()andbuildChapterDisplayLabel()(exported for tests). The old raw template-literalnumPrefix + titleconcatenation is replaced by the dedup-aware function.Feature 2 — Translation settings snapshot: New file
services/translationSettingsSnapshot.ts. DefinesTranslationSettingsSnapshot(a typed Pick ofAppSettings),TranslationSettingsSnapshotInput, andnormalizeTranslationSettingsSnapshot(). Standalone utility only — wiring into the translation pipeline is deferred; it touched too many files that diverged heavily.Feature 3 — Historical fan context setting: Adds
includeHistoricalFanTranslationsInContext?: booleantoAppSettings, defaults tofalseindefaultSettings, and surfaces a checkbox toggle in the Advanced panel's Translation Parameters section. Prompt injection is deferred for the same reason as Feature 2.What was intentionally left out
Both Feature 2 and 3 stop short of wiring the settings into
translationService.ts— that file changed significantly and was the source of most conflicts. The settings storage and UI are complete; the actual prompt injection can be a follow-up PR once that file stabilizes.Test plan
npx tsc --noEmit— only pre-existing errors inscripts/sutta-studio/andservices/clientTelemetry.ts, zero new errors🤖 Generated with Claude Code