Skip to content

Add lowercase and punctuation paste transforms#253

Merged
kitlangton merged 2 commits into
kitlangton:mainfrom
R44VC0RP:feature/lowercase-punctuation-transforms
Jul 8, 2026
Merged

Add lowercase and punctuation paste transforms#253
kitlangton merged 2 commits into
kitlangton:mainfrom
R44VC0RP:feature/lowercase-punctuation-transforms

Conversation

@R44VC0RP

@R44VC0RP R44VC0RP commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add independent toggles to lowercase transcripts and remove punctuation
  • persist both options and apply them after word removals/remappings before paste
  • show the final formatting in the transforms scratchpad preview

Testing

  • swift test --filter TranscriptFormattingTests
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer xcodebuild -scheme Hex -configuration Debug build CODE_SIGNING_ALLOWED=NO -skipMacroValidation
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added two new paste-formatting options: lowercase text and remove punctuation.
    • These options are available in settings and reflected in transcript previews and pasted transcription output.
  • Bug Fixes
    • Transcript formatting now applies consistently after word remapping, so previewed and pasted text match the selected settings.
  • Tests
    • Added coverage for formatting behavior and updated settings migration checks for the new defaults.

R44VC0RP added 2 commits July 8, 2026 12:01
Add independent settings to lowercase pasted transcripts and remove Unicode punctuation. Persist both options, include them in the transforms preview, and apply them after existing word modifications before paste and history storage.

Cover formatting combinations and legacy settings migration with tests.

Opencode-Session: ses_0bd949d00fferT6nCF6ntO80Mp
Opencode-Message: msg_f42760e83001l5zbmkL7mxckWu
Opencode-Agent: build
Opencode-Session: ses_0bd949d00fferT6nCF6ntO80Mp
Opencode-Message: msg_f4276da02001R7u6klN4JoUXT7
Opencode-Agent: build
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds two transcript formatting options—lowercase and punctuation removal—via a new TranscriptFormattingApplier utility, new HexSettings fields with schema wiring, SettingsFeature actions, UI toggles in WordRemappingsView, application in the transcription pipeline, related tests, and a changeset entry.

Changes

Paste Formatting Feature

Layer / File(s) Summary
Formatting utility and tests
HexCore/Sources/HexCore/Models/TranscriptFormatting.swift, HexCore/Tests/HexCoreTests/TranscriptFormattingTests.swift
New TranscriptFormattingApplier.apply static method lowercases text and/or removes punctuation, verified by four unit tests.
Settings model and schema wiring
HexCore/Sources/HexCore/Settings/HexSettings.swift, HexCore/Tests/HexCoreTests/HexSettingsMigrationTests.swift
Adds lowercaseTranscripts and removePunctuation properties, initializer parameters, coding keys, and schema field registrations, plus migration test assertions for default values.
SettingsFeature actions and reducer
Hex/Features/Settings/SettingsFeature.swift
Adds setLowercaseTranscripts and setRemovePunctuation actions and reducer handling that update state.hexSettings.
Transcription pipeline application
Hex/Features/Transcription/TranscriptionFeature.swift
Applies TranscriptFormattingApplier to remapped transcription text and logs when formatting changes output.
Word Remappings UI toggles and preview
Hex/Features/Remappings/WordRemappingsView.swift
Adds a "Paste Formatting" group with lowercase and punctuation-removal toggles, and extends the preview text pipeline to apply the new formatting.
Changeset entry
.changeset/b80ca233.md
Adds a minor changeset entry describing the new paste transforms.

Estimated code review effort: 2 (Simple) | ~12 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant WordRemappingsView
  participant SettingsFeature
  participant TranscriptionFeature
  participant TranscriptFormattingApplier

  User->>WordRemappingsView: Toggle "Lowercase Everything" / "Remove All Punctuation"
  WordRemappingsView->>SettingsFeature: setLowercaseTranscripts / setRemovePunctuation
  SettingsFeature->>SettingsFeature: Update state.hexSettings
  WordRemappingsView->>TranscriptFormattingApplier: apply(previewText, lowercase, removePunctuation)
  TranscriptFormattingApplier-->>WordRemappingsView: formatted preview text

  Note over TranscriptionFeature: On new transcription result
  TranscriptionFeature->>TranscriptFormattingApplier: apply(remappedResult, lowercaseTranscripts, removePunctuation)
  TranscriptFormattingApplier-->>TranscriptionFeature: formatted text
  TranscriptionFeature->>TranscriptionFeature: modifiedResult = formatted text
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding lowercase and punctuation paste transforms.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@kitlangton kitlangton merged commit 276da69 into kitlangton:main Jul 8, 2026
1 check was pending

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
Hex/Features/Transcription/TranscriptionFeature.swift (1)

461-462: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider logging which formatting options were applied.

The log message "Applied paste formatting" doesn't indicate whether lowercasing, punctuation removal, or both triggered the change. Including the active flags (e.g., "Applied paste formatting (lowercase: true, removePunctuation: false)") would aid debugging without exposing sensitive transcript content.

🔧 Suggested log improvement
       if formattedResult != remappedResult {
-        transcriptionFeatureLogger.info("Applied paste formatting")
+        transcriptionFeatureLogger.info("Applied paste formatting (lowercase: \(state.hexSettings.lowercaseTranscripts), removePunctuation: \(state.hexSettings.removePunctuation))")
       }
🤖 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 `@Hex/Features/Transcription/TranscriptionFeature.swift` around lines 461 -
462, The paste-formatting log in TranscriptionFeature should include which
formatting flags were active instead of only saying “Applied paste formatting.”
Update the logging in the formatting branch around the
formattedResult/remappedResult comparison to report the state of the lowercase
and removePunctuation options so the message clearly identifies which
transformation(s) caused the change, while keeping transcript content out of the
log.
Hex/Features/Remappings/WordRemappingsView.swift (1)

244-248: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting removalsSection or renaming it.

The new "Paste Formatting" GroupBox lives inside removalsSection, which is only visible under the "Removals" tab. Since paste formatting is conceptually distinct from word removals, users may not discover these toggles when navigating to "Remappings" or expecting a separate section. Consider either renaming removalsSection to something broader (e.g., modificationsSection) or pulling the GroupBox into its own section.

🤖 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 `@Hex/Features/Remappings/WordRemappingsView.swift` around lines 244 - 248, The
Paste Formatting GroupBox is currently embedded in `removalsSection`, which
makes it look like it belongs only to word removals and can hide it from users
browsing remappings/modification controls. Update `WordRemappingsView` by either
renaming `removalsSection` to a broader, more accurate name such as
`modificationsSection`, or by extracting the Paste Formatting GroupBox into its
own dedicated section so the UI grouping matches the functionality.
🤖 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 `@HexCore/Sources/HexCore/Models/TranscriptFormatting.swift`:
- Around line 10-12: The punctuation stripping in TranscriptFormatting’s
removePunctuation path is too aggressive and can corrupt numeric text like
decimals and grouped numbers. Update the logic in the relevant formatting method
to preserve punctuation used within numbers (for example decimal points and
thousands separators) or explicitly constrain the transformation to non-numeric
punctuation, using the existing removePunctuation branch in TranscriptFormatting
as the place to fix it.

---

Nitpick comments:
In `@Hex/Features/Remappings/WordRemappingsView.swift`:
- Around line 244-248: The Paste Formatting GroupBox is currently embedded in
`removalsSection`, which makes it look like it belongs only to word removals and
can hide it from users browsing remappings/modification controls. Update
`WordRemappingsView` by either renaming `removalsSection` to a broader, more
accurate name such as `modificationsSection`, or by extracting the Paste
Formatting GroupBox into its own dedicated section so the UI grouping matches
the functionality.

In `@Hex/Features/Transcription/TranscriptionFeature.swift`:
- Around line 461-462: The paste-formatting log in TranscriptionFeature should
include which formatting flags were active instead of only saying “Applied paste
formatting.” Update the logging in the formatting branch around the
formattedResult/remappedResult comparison to report the state of the lowercase
and removePunctuation options so the message clearly identifies which
transformation(s) caused the change, while keeping transcript content out of the
log.
🪄 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: 0992c3a1-ff28-44c7-9d44-1ad73aac4768

📥 Commits

Reviewing files that changed from the base of the PR and between 71878b7 and 49e1aa0.

📒 Files selected for processing (8)
  • .changeset/b80ca233.md
  • Hex/Features/Remappings/WordRemappingsView.swift
  • Hex/Features/Settings/SettingsFeature.swift
  • Hex/Features/Transcription/TranscriptionFeature.swift
  • HexCore/Sources/HexCore/Models/TranscriptFormatting.swift
  • HexCore/Sources/HexCore/Settings/HexSettings.swift
  • HexCore/Tests/HexCoreTests/HexSettingsMigrationTests.swift
  • HexCore/Tests/HexCoreTests/TranscriptFormattingTests.swift

Comment on lines +10 to +12
if removePunctuation {
output = output.components(separatedBy: .punctuationCharacters).joined()
}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Punctuation removal may alter numbers in transcripts.

components(separatedBy: .punctuationCharacters).joined() strips all Unicode punctuation including decimal points and thousands separators. A transcript containing "3.14" or "1,000" would become "314" or "1000". If transcripts can contain numeric values, consider preserving decimal points and digit-grouping commas, or document this as expected behavior.

🤖 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 `@HexCore/Sources/HexCore/Models/TranscriptFormatting.swift` around lines 10 -
12, The punctuation stripping in TranscriptFormatting’s removePunctuation path
is too aggressive and can corrupt numeric text like decimals and grouped
numbers. Update the logic in the relevant formatting method to preserve
punctuation used within numbers (for example decimal points and thousands
separators) or explicitly constrain the transformation to non-numeric
punctuation, using the existing removePunctuation branch in TranscriptFormatting
as the place to fix it.

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