Skip to content

fix(presets): keep a recording's transcript when applying a preset - #3314

Open
tmaostats wants to merge 2 commits into
CapSoftware:mainfrom
tmaostats:fix/presets-keep-caption-transcript
Open

tmaostats wants to merge 2 commits into
CapSoftware:mainfrom
tmaostats:fix/presets-keep-caption-transcript

Conversation

@tmaostats

@tmaostats tmaostats commented Oct 26, 2026 •

Copy link
Copy Markdown

Fixes #3310.

Problem

A preset stores the whole ProjectConfiguration, so caption data travelled with it in both directions:

  • Saving a preset captured the recording's transcript, so applying that preset to a second recording replaced its caption text with the first recording's words.
  • Applying a preset whose config has no captions (the built-in Default preset) replaced the recording's captions wholesale with null — the recording lost its saved caption source.

Captions are two things at once: styling that belongs to the project, and a transcript that belongs to the recording. Only the first should cross a preset boundary.

Change

apps/desktop-gpui/src/presets.rs

before after
preset_config keeps captions.segments strips segments + sourceTimed, keeps settings
apply_preset preset captions win outright current segments/word timings/sourceTimed kept, settings taken from the preset
preset without captions clears the recording's captions leaves them untouched

apps/desktop/src/utils/createPresets.ts / PresetsDropdown.tsx mirror the same rules through a small keptCaptions helper, so presets stay interchangeable between the Tauri and GPUI editors.

Tests

Three cases in presets.rs (CI runs them via cargo test --bin cap-gpui):

  • saving_a_preset_keeps_the_caption_styling_but_not_the_transcript
  • applying_a_preset_keeps_the_current_transcript_and_takes_its_styling
  • applying_a_preset_without_captions_keeps_the_current_captions

Note

When the recording has no captions at all, applying a preset still leaves it without captions (kept_captions returns None) rather than materialising an empty CaptionsData from the preset. Say the word if you'd rather seed the preset's styling there.

RetriggerView in GreptileConfidence Score: 3/5

Fix the Default action and the existing-preset save path before merging.

Findings

  1. P1 Default still deletes captions ▶
  2. P1 Updated presets still copy words ▶
Fix with agent prompt
### Issue 1
apps/desktop-gpui/src/presets.rs:172-173
The new merge runs only for saved presets. GPUI's `apply_default_preset` still replaces the project with a fresh config without keeping its captions. Tauri's `applyDefaultPreset` does the same. Users who apply Default therefore still lose their saved caption source, leaving one of this fix's stated cases broken. Route both Default actions through the caption-preserving merge.

### Issue 2
apps/desktop/src/utils/createPresets.ts:60-62
Only `createPreset` strips the transcript. The “Save settings to preset” action calls `saveToPreset`, which still stores the project's full `captions`. When that preset is selected as the default, Tauri uses its config directly for the next recording, copying the old recording's words into it. Apply the same stripping in `saveToPreset`, preferably through one shared helper.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Separates caption styling from recording-specific words when saving and applying presets.

  • Saved presets keep caption styling without carrying transcript words.
  • Applying presets changes caption styling without replacing the transcript.

Intent acknowledged by tmaostats: recordings without captions should remain without captions when a preset is applied.

Reviews (1) · Last reviewed commit: "fix(presets): keep a recording's transcr..." · Reviewed by Greptile

@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@tmaostats is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

A preset stores the whole project config, so `captions.segments`,
`captions.settings` and `captions.sourceTimed` travelled with it in both
directions:

- Saving a preset captured the recording's transcript, so applying that
  preset to another recording overwrote its caption text with the first
  recording's words.
- Applying a preset whose config had no captions (the built-in Default
  preset) replaced the recording's captions wholesale with `null`, losing
  its saved caption source.

Captions are two things at once: styling that belongs to the project and a
transcript that belongs to the recording. Only the first should cross a
preset boundary.

- `preset_config` now strips `captions.segments` (and the source-timing
  flag that describes them) before storing a preset, keeping the styling.
- `apply_preset` keeps the current segments, word timings and
  `sourceTimed`, and takes only `captions.settings` from the preset. A
  preset without captions leaves the recording's captions untouched.
- The Tauri editor's `createPreset`/`applyPreset` mirror the same rules via
  `keptCaptions`, so presets stay interchangeable between the two apps.

Tests in `presets.rs` cover saving, applying over an existing transcript,
and applying a captions-less preset.

Fixes CapSoftware#3310
@tmaostats
tmaostats force-pushed the fix/presets-keep-caption-transcript branch from cad9277 to df3e82f Compare October 26, 2026 03:49
Comment on lines +172 to +173
let captions = kept_captions(next.captions.as_ref(), current.captions.as_ref());
next.captions = captions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Default still deletes captions

The new merge runs only for saved presets. GPUI's apply_default_preset still replaces the project with a fresh config without keeping its captions. Tauri's applyDefaultPreset does the same. Users who apply Default therefore still lose their saved caption source, leaving one of this fix's stated cases broken. Route both Default actions through the caption-preserving merge.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop-gpui/src/presets.rs
Line: 172-173

Comment:
**Default still deletes captions**

The new merge runs only for saved presets. GPUI's `apply_default_preset` still replaces the project with a fresh config without keeping its captions. Tauri's `applyDefaultPreset` does the same. Users who apply Default therefore still lose their saved caption source, leaving one of this fix's stated cases broken. Route both Default actions through the caption-preserving merge.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment thread apps/desktop/src/utils/createPresets.ts Outdated
Comment on lines +60 to +62
captions: preset.config.captions
? { ...preset.config.captions, segments: [], sourceTimed: false }
: null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Updated presets still copy words

Only createPreset strips the transcript. The “Save settings to preset” action calls saveToPreset, which still stores the project's full captions. When that preset is selected as the default, Tauri uses its config directly for the next recording, copying the old recording's words into it. Apply the same stripping in saveToPreset, preferably through one shared helper.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src/utils/createPresets.ts
Line: 60-62

Comment:
**Updated presets still copy words**

Only `createPreset` strips the transcript. The “Save settings to preset” action calls `saveToPreset`, which still stores the project's full `captions`. When that preset is selected as the default, Tauri uses its config directly for the next recording, copying the old recording's words into it. Apply the same stripping in `saveToPreset`, preferably through one shared helper.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

…ates

Two paths the first pass missed (greptile review):

- GPUI apply_default_preset and Tauri applyDefaultPreset rebuilt the config
  from Cap defaults and kept only timeline/overlay/clips, so the built-in
  Default row still wiped the recording's saved caption source. Both now
  carry the current captions over, like any other preset without caption
  data.
- Tauri saveToPreset (Save settings to preset) stored the project's full
  captions, so updating a preset re-introduced the transcript the creation
  path now strips. The strip logic moves into a shared storedPresetConfig
  helper used by both createPreset and saveToPreset.
@tmaostats

Copy link
Copy Markdown
Author

Both points addressed in dfa3664:

  • Default still deletes captions: apply_default_preset (GPUI) and applyDefaultPreset (Tauri) now carry the current captions over, matching how any other preset without caption data behaves.
  • Updated presets still copy words: the transcript strip moved into a shared storedPresetConfig helper used by both createPreset and saveToPreset, so "Save settings to preset" can no longer re-introduce another recording's words.

@superagent-security superagent-security 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.

Superagent found 1 security concern(s).

}),
};
}
aW1wb3J0IHsgcHJvZHVjZSB9IGZyb20gInNvbGlkLWpzL3N0b3JlIjsNCmltcG9ydCB7IHByZXNldHNTdG9yZSB9IGZyb20gIn4vc3RvcmUiOw0KaW1wb3J0IHR5cGUgeyBQcmVzZXRzU3RvcmUsIFByb2plY3RDb25maWd1cmF0aW9uIH0gZnJvbSAifi91dGlscy90YXVyaSI7DQoNCmV4cG9ydCB0eXBlIENyZWF0ZVByZXNldCA9IHsNCgluYW1lOiBzdHJpbmc7DQoJY29uZmlnOiBPbWl0PFByb2plY3RDb25maWd1cmF0aW9uLCAidGltZWxpbmUiPjsNCglkZWZhdWx0OiBib29sZWFuOw0KfTsNCg0KdHlwZSBQcmVzZXRDYXB0aW9ucyA9IFByb2plY3RDb25maWd1cmF0aW9uWyJjYXB0aW9ucyJdOw0KDQovKioNCiAqIFdoYXQgYSBwcmVzZXQgc3RvcmVzOiB0aGUgcHJvamVjdCdzIHN0eWxpbmcgd2l0aCB0aGUgcmVjb3JkaW5nLXNwZWNpZmljDQogKiBwYXJ0cyByZW1vdmVkIC0tIGB0aW1lbGluZTogbnVsbGAsIGBjbGlwczogW11gIGFuZCB0aGUgY2FwdGlvbiB0cmFuc2NyaXB0DQogKiBkcm9wcGVkLiBDYXB0aW9uIGBzZWdtZW50c2AgbmFtZSB0aGUgcmVjb3JkaW5nIHRoZXkgd2VyZSB0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ljb25maWc6IE9taXQ8UHJvamVjdENvbmZpZ3VyYXRpb24sICJ0aW1lbGluZSI+LA0KCQkpID0+DQoJCQl1cGRhdGVQcmVzZXRzKChzdG9yZSkgPT4gew0KCQkJCXN0b3JlLnByZXNldHNbaW5kZXhdLmNvbmZpZyA9IHN0b3JlZFByZXNldENvbmZpZyhjb25maWcpOw0KCQkJfSksDQoJfTsNCn0NCg== No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1: Source files are replaced with opaque base64 blobs, hiding changes from review

Three source files are replaced by single base64 blobs, hiding 14k+ lines from review and leaving non-compiling source.

Commit the plaintext UTF-8 source for createPresets.ts, PresetsDropdown.tsx, and editor_window.rs; never merge encoded source blobs.

AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.

<file name="apps/desktop/src/utils/createPresets.ts">
<violation number="1" location="apps/desktop/src/utils/createPresets.ts:1">
<priority>P1</priority>
<title>Source files are replaced with opaque base64 blobs, hiding changes from review</title>
<evidence>The PR deletes all 76 plaintext lines of createPresets.ts and adds a single line containing a full-file base64 blob. The same pattern replaces all 206 lines of PresetsDropdown.tsx and all 14,087 lines of apps/desktop-gpui/src/editor_window.rs with one encoded line each (the editor blob decodes to roughly 578 KB). Normal reviewers see no source lines, only an opaque encoded payload. Decoding the blobs currently yields the described preset/caption changes, but the diff cannot be reviewed as code, and the encoded files are not valid Rust/TypeScript, so a merge breaks the GPUI and Tauri desktop builds. Base commit 5fcf8e9 carried these files as plaintext and had no encoding/decoding step.</evidence>
<recommendation>Replace each base64 blob with the decoded plaintext source using the repository's normal LF line endings, then re-run the desktop and GPUI builds/tests. Do not approve or merge until the PR diff shows ordinary source lines and reviewers can verify the complete change.</recommendation>
</violation>
</file>

@richiemcilroy

Copy link
Copy Markdown
Member

Thanks! Can you get Greptile to 5/5 and resolve the conflicts with main? Then we'll take a look.

@tmaostats

tmaostats commented Nov 3, 2026 via email

Copy link
Copy Markdown
Author

This branch has not been deployed

No deployments
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.

Applying a native editor preset replaces or clears the current caption text

2 participants