Repository navigation
feat(settings): let the Ghostty import read a config file you pick - #37353
Conversation
Findings
|
There was a problem hiding this comment.
Actionable comments posted: 2

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
530fdec0-e840-4f9f-acdb-5000e3825dae
Files selected for processing: 26-
src/main/ghostty/index.test.tssrc/main/ghostty/index.tssrc/main/import-source-validation.tssrc/main/ipc/settings.tssrc/main/terminal-config-import/choose-config-file.tssrc/main/warp-themes/index.tssrc/main/warp-themes/warp-theme-import-source-validation.tssrc/preload/api/settings-api.tssrc/preload/api/settings-bridge.tssrc/renderer/src/components/settings/GhosttyImportModal.tsxsrc/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.tssrc/renderer/src/components/settings/TerminalAppearanceSection.tsxsrc/renderer/src/components/settings/useGhosttyImport.tssrc/renderer/src/i18n/locales/de.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/pt.jsonsrc/renderer/src/i18n/locales/ru.jsonsrc/renderer/src/i18n/locales/tr.jsonsrc/renderer/src/i18n/locales/zh-Hant.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/ghostty-import-preview.tssrc/shared/global-settings-types.ts
Files with no reviewable changes: 11-
- src/main/warp-themes/warp-theme-import-source-validation.ts
- src/renderer/src/i18n/locales/zh.json
- src/renderer/src/i18n/locales/fr.json
- src/renderer/src/i18n/locales/de.json
- src/renderer/src/i18n/locales/ja.json
- src/renderer/src/i18n/locales/pt.json
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/zh-Hant.json
- src/renderer/src/i18n/locales/tr.json
- src/renderer/src/i18n/locales/es.json
- src/renderer/src/i18n/locales/ru.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
-
| // Await persistence before marking applied so rejected IPC cannot report success. | ||
| await updateSettings(merged) | ||
| if (mountedRef.current) { | ||
| if (mountedRef.current && requestId === requestIdRef.current) { |
There was a problem hiding this comment.
Keep file selection disabled while Apply is pending.
While updateSettings(merged) awaits persistence, the modal still permits Choose Config File. If the user picks another file before that write completes, the old settings can persist behind the new preview. The request-ID check here hides the old success state but does not stop the write. Track the pending apply operation and block file selection until it settles. (raw.githubusercontent.com)
| function handleOpenChange(newOpen: boolean): void { | ||
| setOpen(newOpen) | ||
| if (!newOpen) { | ||
| requestIdRef.current++ |
There was a problem hiding this comment.
Clear picker state when closing the modal.
If the user closes the modal while a picked file is still loading, this line invalidates its preview but leaves choosingFile true. Reopening can show a completed automatic preview with Choose Config File and Apply Changes disabled until the old request finishes. Clear picker state on close. Make the old request’s finally clear state only if that request still owns it. (raw.githubusercontent.com)
Based on learnings: Temporary disabled state must clear on both completion and dismissal.
Source: Learnings
0281484 to
e23ca9b
Compare
e23ca9b to
141de79
Compare
Summary
The Ghostty import only read the config files Ghostty itself loads. If your config lived anywhere else (a dotfiles repo, a backup, another machine's copy), you had to overwrite
~/.config/ghostty/configto import it.The Ghostty import preview now has a Choose Config File button. It opens a native file picker, then runs the picked file through the same read → parse → map → diff → preview → apply path as auto-discovery. Cancelling the picker keeps the preview that was already showing. The "not found" state now points to the picker instead of ending the flow.
Builds on #18659 by @DeVFirmino, thank you. This keeps that PR's
{ kind: 'auto' | 'chooseFile' }IPC source and its unfiltered picker. The button lives inside the existing modal, not as a second section button, so the Kitty import planned in this cluster can reuse the same modal flow.Closes #18658
What changed
previewGhosttyImport(store, source?, webContents?): the source is validated so the renderer can only name a kind and can never send a path. Calls with no argument still auto-discover, so onboarding is unchanged.src/main/import-source-validation.ts: Warp's source validator, generalized and now shared by Warp and Ghostty. The Warp-only copy is deleted.src/main/terminal-config-import/choose-config-file.ts: a shared picker for the terminal config import pipeline. It is unfiltered, because canonical configs often have no extension, and it shows hidden files, because configs usually live in dot-directories./dev/zeroreports size 0 and would get past the byte limit.useGhosttyImport:Visual proof
Settings → Appearance → Terminal → Import from Ghostty, on a throwaway
HOME/XDG_CONFIG_HOMEwith temporary configs.~/dotfiles/ghostty/configMerge-risk assessment: Low
Negative user-facing tradeoffs
Validation
pnpm tc:web: clean.pnpm tc:node: clean for this change. The only error is pre-existing on main (agent-model-catalog-scaling.test.tsimports a module that Show agent sign-in notices before the first chat message #37191 removed).pnpm test src/main/ghostty src/main/warp-themes src/main/ipc/settings.test.ts src/main/ipc/settings-delayed-response.test.ts src/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.ts: 204 passed. This adds one test showing that a picked file is the only file read, that a renderer-suppliedpathis rejected, and that cancel reads nothing.verify:localization-extraction,verify:localization-catalogandverify:localization-coveragepass.ORCA_BACKGROUND_LAUNCH=1, CDP port 9365, throwawayHOME,XDG_CONFIG_HOMEand user-data dir. The native dialog was stubbed through the main-process inspector so no window had to be shown.keybindlisted as unsupported.terminalFontFamily=Iosevka Term,terminalFontSize=16,terminalPaddingX=12.gpt-6.1-sol, xhigh). Fixed all three findings: the regular-file check, stale responses overwriting a newer preview, and Apply racing a picked read. Also removed a stray test mock.Perf
stat+readFileper discovered path). The newisFile()check reuses the existingstatresult, so it adds no syscall.previewGhosttyImportauto took p50 0.60 ms / p95 4.60 ms, and the picked file took p50 0.40 ms / p95 1.10 ms with the dialog stubbed.