Skip to content

Fix reader translation popover defaults - #27

Merged
nonnil merged 8 commits into
fix/performfrom
fix/anything
May 30, 2026
Merged

Fix reader translation popover defaults#27
nonnil merged 8 commits into
fix/performfrom
fix/anything

Conversation

@nonnil

@nonnil nonnil commented May 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Add the Task 21 workflow exec-plan docs and implement the UI/integration fixes.
  • Move reader translation settings onto the shared translucent Popup surface with outside-click/Escape cancel semantics and stronger primary button contrast.
  • Persist and preserve Codex translation model/reasoning-effort defaults so the reader popover reopens with DB-backed remembered values.
  • Add regression coverage for settings persistence, reader default selection/dismissal, shared popup chrome, and Git-hook-safe backup test fixtures.

Verification

  • TMPDIR=/private/tmp bun run typecheck
  • TMPDIR=/private/tmp bun run test
  • TMPDIR=/private/tmp bun run build
  • TMPDIR=/private/tmp bun run test:e2e e2e/reader.spec.ts e2e/cross-device-responsive.spec.ts
  • GIT_DIR=/Users/vvx/projekt/www/trauma/.git/worktrees/trauma-fix-anything GIT_WORK_TREE=/private/tmp/trauma-fix-anything TMPDIR=/private/tmp bun run test tests/server/backup/backup-environment.test.ts

Notes: build emits the existing Node DEP0155 warning from defuddle -> temml package exports. Full Vitest output includes expected backup-failsafe fixture diagnostics.

Summary by CodeRabbit

  • New Features

    • Translation preferences now persist and automatically populate translation dialogs on subsequent uses
    • Unified transparent popover styling across the application for consistent visual experience
  • Documentation

    • Updated architecture and design system references for popover and translation UI contracts
    • Added comprehensive workflow task specifications for popover and translation feature improvements

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5329d36b-d213-4da4-a9c0-0d2602022277

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR implements Task 21, a comprehensive workflow to unify Codex translation popovers via a shared translucent Popup component, introduce database-backed persistence for translation defaults (model and reasoning effort), and migrate the reader translation confirmation UI while ensuring state refreshes and integration contracts are maintained.

Changes

Task 21: Popover and Translation UI Fixes

Layer / File(s) Summary
Architecture and workflow documentation
docs/architecture/data-and-storage.md, docs/references/configuration.md, docs/references/design-system/components-and-surfaces.md, docs/references/design-system/interaction-and-accessibility.md, docs/references/design-system/verification.md, docs/workflows/README.md, docs/workflows/task-21-popover-and-translation-ui-fixes/*
Architecture documentation now includes the app_settings table contract for persisting Codex translation defaults (model and reasoning effort). Design-system guidance specifies that Popup provides translucent elevated panel styling with backdrop blur and rounding while consumers provide only layout/placement constraints; popover dismissal via Escape/outside-click is treated as cancel for confirmation dialogs. Complete workflow specification (Task 21.1–21.7) covers persistence contract, settings API, shared popover styling, reader translation migration, popover consumer audit, regression checks, and browser verification.
Database schema and settings repository
src/server/db/repositories.ts, tests/server/db/schema.test.ts, tests/server/settings/settings.test.ts
SettingsRepository.updateCodexTranslationDefaults now accepts optional model and reasoningEffort fields to support partial updates; only provided fields are persisted while omitted fields retain prior values. Schema validation test ensures unsupported codex_translation_reasoning_effort values are rejected. Repository test verifies partial-update preservation across sequential calls.
Settings API and reader route state
src/components/settings/settings-loader.ts, tests/components/settings-loader.test.ts, tests/server/routes/api-settings.test.ts
revalidateSettingsState() now revalidates both settings and reader-translation query caches. API endpoint PATCH /api/settings/translation-codex-defaults accepts partial model/reasoning updates with normalization and validation. Route loaders expose persisted defaults to MemoryReader via page data. Tests verify cache revalidation count and partial-update persistence.
Shared Popup visual contract
src/components/ui/Popup.tsx, src/components/memories/TaxonomyAddControl.tsx, src/components/ui/KebabActionMenu.tsx, tests/components/popup.test.tsx
Popup now provides default translucent panel styling (bg-trauma-bg-elev/50, backdrop-blur, rounded borders) via panelBaseClass and wraps onOpenChange/onClose callbacks with untrack to prevent reactive tracking. Related components (TaxonomyAddControl, KebabActionMenu) inherit padding. Popup tests verify untrack wrapper presence and styling classes.
Reader translation popover migration to Popup
src/components/reader/MemoryReader.tsx, tests/components/memory-reader-actions.test.ts
MemoryReader refactors translation UI from inline dialog to Popup-based component with persisted defaults. New signals (translationDefaultModel, translationDefaultEffort, translationDefaultLanguage) seed the form; resetTranslationFormToDefaults() helper syncs form state when dialog opens. Submit handler calls submitCodexTranslationDefaults() for persistence, uses returned canonical model/effort to start translation, and triggers revalidateSettingsState() to refresh. Tests verify Popup wiring, default selection, submit-button styling, and state passing from route loaders.
E2E verification and integration tests
e2e/reader.spec.ts, tests/components/dismissable-layer.test.ts
E2E adds waitForReaderReady(page) helper to ensure reader content is marked ready before interactions; new test verifies translation popover seeding defaults, validating dialog population, Escape dismissal (no API call), and Submit payload. Helper seedReaderTranslationDefaults() writes settings directly to SQLite. Dismissable-layer test verifies useDismissableLayer is implemented in Popup, not MemoryReader. All reader tests now use readiness waits.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • hauntedfail/Trauma#6: Introduces the reader pipeline and MemoryReader component; this PR refactors MemoryReader.tsx translation UI and state management, making it a direct code-level follow-up.

Poem

🐰 A popover, translucent and bright,
Now wears the shared styling just right,
Translation defaults persist in the store,
No more losing choices—remember once more!
Popup and Reader in harmony dance, ✨
Task 21 gives UI its second chance.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix reader translation popover defaults' clearly and specifically describes the main change: persisting and fixing how Codex translation model/reasoning-effort defaults are remembered and reopened in the reader translation popover.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/anything

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nonnil
nonnil marked this pull request as ready for review May 28, 2026 08:54
@nonnil

nonnil commented May 28, 2026

Copy link
Copy Markdown
Member Author

review @copilot @codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 833222862f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/reader/MemoryReader.tsx
@nonnil

nonnil commented May 30, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@nonnil

nonnil commented May 30, 2026

Copy link
Copy Markdown
Member Author

review @coderabbitai

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch PR details and diff
gh pr view 27 --repo hauntedfail/Trauma --json title,body,files,additions,deletions,changedFiles 2>/dev/null | jq .

echo "=== PR FILES ==="
gh pr diff 27 --repo hauntedfail/Trauma 2>/dev/null | head -2000

Length of output: 98554


🏁 Script executed:

#!/bin/bash
gh pr diff 27 --repo hauntedfail/Trauma 2>/dev/null | tail -n +2001 | head -2000

Length of output: 11268



@nonnil Here is the full review of #27.


Fix reader translation popover defaults — Review

The overall approach is solid: migrating to the shared Popup shell, canonicalizing the model value, unifying dismiss/cancel semantics, and adding well-targeted regression coverage. A few issues worth addressing before merge:


🔴 Issue 1 — Translation submit does not persist defaults to the DB

startTranslation() updates local signals and immediately calls revalidateSettingsState(), but there is no PATCH /api/settings/translation-codex-defaults call before or after:

// src/components/reader/MemoryReader.tsx
setTranslationDefaultLanguage(input.langCode);
setTranslationDefaultModel(input.model ?? "");
setTranslationDefaultEffort(input.reasoningEffort ?? "");
void revalidateSettingsState();         // re-fetches DB — still has OLD values

Because revalidateSettingsState() re-fetches from the DB (which was never written to), the subsequent createEffect will sync props.translationModel back to the stale DB values, reverting the local signal updates. On the next popover open the user's just-submitted model/effort choice will be gone. The persistence step described in the task 04 doc ("persist explicit model/effort choices through the existing backend settings update path before future popover opens are seeded") appears to be missing from the final implementation.

Suggested fix — call the settings PATCH before revalidating:

// Before revalidateSettingsState()
if (input.model !== null || input.reasoningEffort !== null) {
  await fetch("/api/settings/translation-codex-defaults", {
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      ...(input.model !== null && { model: input.model }),
      ...(input.reasoningEffort !== null && { reasoning_effort: input.reasoningEffort }),
    }),
  });
}
void revalidateSettingsState();

Or route through the existing submitReadCodexModels helper (which is already imported but not called in the new path).


🟡 Issue 2 — AppShell.tsx may have lost its panel padding

p-2 was removed from panelBaseClass in Popup.tsx and explicitly re-added to KebabActionMenu.tsx and TaxonomyAddControl.tsx. However AppShell.tsx (Add memory + Theme panels) is not in this diff. If its panelClass strings did not already include p-2, those panels will now render flush against the border. Worth a quick audit.


🟡 Issue 3 — submitReadCodexModels is a dead import

submitReadCodexModels is still imported from ../settings/settings-submit but is not called anywhere in the new startTranslation path. If it was the intended vehicle for the persistence step above, it should be wired up. Otherwise it should be removed.


✅ What's well done

  • untrack() in Popup.tsx callbacks — correctly breaks reactive loops that would otherwise cause onOpenChange to re-trigger the effect that set open.
  • untrack(translationDialogOpen) in the createEffect inside MemoryReader — prevents the prop-sync effect from re-running when the dialog opens, guarding draft state correctly.
  • canonicalTranslationModel() — clean normalization to model.model for the API payload, with correct catalog-miss fallback option rendering.
  • Partial update in repositories.ts — the conditional values builder is clean; the previous always-overwrite behavior was a bug waiting to happen.
  • revalidateSettingsState() dual cache — correctly invalidates both getSettingsState and getReaderTranslationSettingsState.
  • Backup runGit helper — clearing GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE from the child env is the right fix for the worktree isolation problem.
  • waitForReaderReady extraction — reduces repetition across 11 test sites.
  • Schema constraint test — good coverage that the DB-level CHECK on codex_translation_reasoning_effort actually fires.
  • Job historical state test — correctly verifies that changing settings does not mutate completed job rows.
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nonnil

nonnil commented May 30, 2026

Copy link
Copy Markdown
Member Author

Handled the new review from CodeRabbit: #27 (comment)

Classifications and outcomes:

  • Issue 1: fixed in efec039. Reader translation submit now awaits submitCodexTranslationDefaults() before startReaderTranslation(), then uses the persisted normalized codexTranslationModel / codexTranslationReasoningEffort values for translation start and local default state before settings revalidation. This covers the current, active, and queued/started paths rather than relying only on the translation runner side effect.
  • Issue 2: no code change. I audited AppShell.tsx; Add memory still supplies panel spacing through AddMemoryForm with formClass="grid gap-3.5 p-2", and Theme still supplies inner spacing through ThemeBlock with px-2 py-2.5. The shared Popup chrome remaining paddingless is consistent with the consumer-owned spacing design.
  • Issue 3: no code change. submitReadCodexModels is still used by refreshTranslationCatalog() in MemoryReader.tsx, so it is not a dead import.
  • Copilot review: no actionable code feedback; the reviewer reported that it encountered an error and could not review.

Validation:

  • TMPDIR=/private/tmp bun run test tests/components/memory-reader-actions.test.ts tests/components/settings-page.test.ts tests/server/routes/api-settings.test.ts
  • TMPDIR=/private/tmp bun run typecheck
  • TMPDIR=/private/tmp bun run test tests/components/app-shell.test.ts tests/components/app-shell-taxonomy.test.ts tests/components/mobile-responsive-contract.test.ts tests/components/popup.test.tsx
  • git diff --check
  • TMPDIR=/private/tmp bun run build
  • TMPDIR=/private/tmp bun run test passed unrestricted after the sandboxed attempt failed on GPG keybox and Unix-socket restrictions.

@nonnil

nonnil commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
docs/references/design-system/components-and-surfaces.md (1)

125-126: 💤 Low value

Consider rephrasing for readability.

Three successive sentences begin with "Theme", which may reduce readability. Consider varying sentence structure.

✍️ Suggested rephrase
 - Theme, Add memory, action-menu, taxonomy, and reader translation popovers use
   the shared translucent elevated panel with backdrop blur.
-- Theme selected state is visible inside the popover in every theme.
-- Theme popover buttons remain labelled and readable below desktop.
+- Selected state is visible inside the theme popover in every theme.
+- Popover buttons remain labelled and readable below desktop.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/references/design-system/components-and-surfaces.md` around lines 125 -
126, The three consecutive sentences starting with the word "Theme" reduce
readability; rephrase them to vary sentence openings and improve flow—locate the
sentences that reference the placeholder `text-trauma-text-placeholder` and the
minimum height `42px` in the "components-and-surfaces.md" section and rewrite so
one or two sentences start with alternative constructions (e.g., "This
theme...", "For this theme...", or by leading with the capability or constraint)
while preserving the meaning and the exact technical tokens
`text-trauma-text-placeholder` and `42px`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/reader.spec.ts`:
- Around line 130-141: Replace the race-prone assertion that checks the
route-side counter (translationStartCount) after dialog.getByRole(...).click
with an explicit network sync: after triggering the Translate button
(dialog.getByRole(...).click), wait for the matching POST request/response (the
/translate route used by the page.route handler) using Playwright's
waitForRequest or waitForResponse, then assert the request payload equals the
expected object (compare the parsed JSON to the expected
lang_code/model/reasoning_effort) and that the dialog is closed
(expect(dialog).toHaveCount(0)); remove reliance on translationStartCount and
keep lastTranslationBody assertions tied to the awaited request.

In `@src/components/reader/MemoryReader.tsx`:
- Around line 613-625: The submitTranslationDialog currently reads
translationFormLanguage() but relies on canStartTranslation(), which only
inspects props.translationTargetLanguage, allowing duplicate requests when the
user selects a different language; update the validation so
submitTranslationDialog (and the similar handler around startTranslation later)
checks the selected language/effort directly before calling startTranslation —
specifically, use translationFormLanguage() (and translationFormEffort()) to
verify no existing variant/duplicate exists instead of relying on
canStartTranslation(), and only call startTranslation({ close, langCode, model:
canonicalTranslationModel(), ... }) when that selected-language check passes.
- Around line 651-666: The bug is that after submitCodexTranslationDefaults()
succeeds but startReaderTranslation() throws, the UI state
(setTranslationDefaultLanguage/setTranslationDefaultModel/setTranslationDefaultEffort)
and revalidateSettingsState() never run, leaving stale defaults; fix by ensuring
those state updates and revalidation run immediately after
submitCodexTranslationDefaults() succeeds (using
persistedModel/persistedReasoningEffort/langCode) and before calling
startReaderTranslation(), or alternatively move them into a finally block so
they always execute even if startReaderTranslation() throws; update the block
around submitCodexTranslationDefaults, startReaderTranslation,
setTranslationDefaultLanguage, setTranslationDefaultModel,
setTranslationDefaultEffort, and revalidateSettingsState accordingly.

---

Nitpick comments:
In `@docs/references/design-system/components-and-surfaces.md`:
- Around line 125-126: The three consecutive sentences starting with the word
"Theme" reduce readability; rephrase them to vary sentence openings and improve
flow—locate the sentences that reference the placeholder
`text-trauma-text-placeholder` and the minimum height `42px` in the
"components-and-surfaces.md" section and rewrite so one or two sentences start
with alternative constructions (e.g., "This theme...", "For this theme...", or
by leading with the capability or constraint) while preserving the meaning and
the exact technical tokens `text-trauma-text-placeholder` and `42px`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: beb80bc6-62c7-4926-a46f-b462d149cf6c

📥 Commits

Reviewing files that changed from the base of the PR and between 4c91ffb and efec039.

📒 Files selected for processing (30)
  • docs/architecture/data-and-storage.md
  • docs/references/configuration.md
  • docs/references/design-system/components-and-surfaces.md
  • docs/references/design-system/interaction-and-accessibility.md
  • docs/references/design-system/verification.md
  • docs/workflows/README.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/01-codex-default-persistence-contract.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/02-settings-api-and-route-state.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/03-shared-popover-visual-contract.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/04-reader-translation-popover-migration.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/05-popover-consumer-audit.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/06-translation-integration-regression-checks.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/07-browser-verification-and-handoff.md
  • docs/workflows/task-21-popover-and-translation-ui-fixes/README.md
  • e2e/reader.spec.ts
  • src/components/memories/TaxonomyAddControl.tsx
  • src/components/reader/MemoryReader.tsx
  • src/components/settings/settings-loader.ts
  • src/components/ui/KebabActionMenu.tsx
  • src/components/ui/Popup.tsx
  • src/server/db/repositories.ts
  • tests/components/dismissable-layer.test.ts
  • tests/components/memory-reader-actions.test.ts
  • tests/components/popup.test.tsx
  • tests/components/settings-loader.test.ts
  • tests/server/backup/backup-environment.test.ts
  • tests/server/db/schema.test.ts
  • tests/server/routes/api-settings.test.ts
  • tests/server/settings/settings.test.ts
  • tests/server/translation/translation-repositories.test.ts

Comment thread e2e/reader.spec.ts
Comment thread src/components/reader/MemoryReader.tsx
Comment thread src/components/reader/MemoryReader.tsx Outdated
@nonnil

nonnil commented May 30, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@nonnil nonnil left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nonnil
nonnil merged commit a060510 into fix/perform May 30, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9cbd54fb4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +662 to +663
model: persistedModel,
reasoningEffort: persistedReasoningEffort,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve null Codex defaults when starting translation

When the user leaves either select on the “Codex app-server default” / “Selected model default” option, the settings PATCH correctly returns null, but these changed arguments still send those null values as explicit fields in the translation POST. The translation runner treats any defined model or reasoningEffort as an explicit override and then writes the resolved concrete selection back to settings (src/server/translation/runner.ts lines 259-273), so a translation immediately overwrites the just-preserved null default with e.g. the current default model/effort and the popover no longer reopens on the default choices. Omit these fields when the persisted value is null/undefined so the runner uses settings without re-persisting a concrete selection.

Useful? React with 👍 / 👎.

});
const persistedModel = settings.codexTranslationModel;
const persistedReasoningEffort = settings.codexTranslationReasoningEffort;
setTranslationDefaultLanguage(input.langCode);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not cache an unpersisted translation language

When the user changes the popover Language to anything other than the configured translation_target_language, the defaults PATCH above still succeeds because it only updates model/effort, but this line promotes that requested language to the in-memory default before the translation POST runs. The server then rejects the POST via its requestedLangCode !== settings.translationTargetLanguage check, yet closing and reopening the popover resets to the unpersisted failed language instead of the DB-backed target until a later settings revalidation overwrites it.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants