Skip to content

fix(swift,web): stop pointing deprecated TTS stop helpers at a deprecated API - #762

Open
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/deprecations-pointing-at-deprecated
Open

fix(swift,web): stop pointing deprecated TTS stop helpers at a deprecated API#762
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/deprecations-pointing-at-deprecated

Conversation

@ayaangazali

@ayaangazali ayaangazali commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What is wrong

Four deprecated TTS helpers, two in Swift and two in Web, send the caller to tts.stop(). tts.stop() is itself deprecated.

bindings/swift/.../Extensions/TTS/RunAnywhere+TTS.swift:55,76

@available(*, deprecated, renamed: "tts.stop()")
static func stopSynthesis() async

bindings/swift/.../API/Namespaces/TTSNamespace.swift:102

@available(*, deprecated, message: "Use the SpeechHandle returned by speak(_:options:) to interrupt one utterance")
public func stop() async

Web is the same pair. Public/API/Deprecated.ts:82,87 say ``Use RunAnywhere.tts.stop()``` while Namespaces/tts.ts:173` deprecates `stop()` in favour of the handle. The live namespace doc a few lines above it is explicit:

There is no global tts.stop(); interrupt playback through the returned handle.

Why it matters more on Swift

renamed: is not just prose, it produces a fix-it. Xcode offers to rewrite the call, and the rewrite lands on the deprecated API. Reduced to a self-contained file and compiled with the host swiftc:

dep-repro.swift:13:17: warning: 'stopSpeaking()' is deprecated: replaced by 'tts.stop()'
   |                 |- warning: 'stopSpeaking()' is deprecated: replaced by 'tts.stop()'
   |                 `- note: use 'tts.stop()' instead
dep-repro.swift:14:21: warning: 'stop()' is deprecated: Use the SpeechHandle returned by speak(_:options:) to interrupt one utterance

Take the compiler's advice on line 13 and you get line 14's warning. Net progress is zero.

What this changes

All four now name the SpeechHandle, reusing the wording tts.stop() already uses so the two hops collapse into one. Swift moves from renamed: to message: because the replacement is a value returned from speak(_:options:), not a symbol the call site can be rewritten to, so a fix-it would be wrong whatever it pointed at.

Kotlin's equivalents were the same defect and were fixed in #731; this is the Swift and Web half.

Scope

I checked every deprecation in the repo for this shape, not just the ones I happened to hit: 83 Swift, 23 TypeScript across web/react-native/electron, and the Dart ones. Cross-referencing each recommended replacement against the set of deprecated symbols leaves exactly these four. The other apparent hits are name collisions rather than real chains: the deprecated generate, generateStream and speak are the legacy shims in Deprecated.ts itself, while vlm.generate, vlm.generateStream and tts.speak are live. React Native has no stopSpeaking/stopSynthesis forwarders, so nothing to change there.

Verification

swiftc -parse on the changed Swift file passes. SwiftLint cannot run on this host (Command Line Tools only), so I checked the constraint by hand instead: line_length is warning: 150, and both new lines are 123 characters, the same length as the existing annotation on TTSNamespace.swift:102 they are modelled on.

scripts/validation/gates/check_deprecated_surfaces.sh passes on the branch.

The Web change is inside a JSDoc comment, so it carries no type or runtime effect.

Summary by CodeRabbit

  • Documentation
    • Updated deprecation guidance for legacy speech-stopping methods.
    • Developers are now directed to use the SpeechHandle returned by tts.speak to interrupt individual utterances.
    • Runtime behavior remains unchanged.

Copilot AI lite review requested due to automatic review settings August 22, 2026 20:06

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f840bce-1d03-4b16-aa87-e5414bbd7cf1

📥 Commits

Reviewing files that changed from the base of the PR and between c4a8fb2 and faf64e7.

📒 Files selected for processing (2)
  • bindings/swift/Sources/RunAnywhere/Public/Extensions/TTS/RunAnywhere+TTS.swift
  • bindings/web/packages/core/src/Public/API/Deprecated.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change updates deprecated TTS stop guidance in the Swift and web bindings. Both platforms now direct callers to the SpeechHandle returned by tts.speak. Runtime behavior and method signatures remain unchanged.

Changes

TTS deprecation guidance

Layer / File(s) Summary
Update deprecation messages
bindings/swift/Sources/RunAnywhere/Public/Extensions/TTS/RunAnywhere+TTS.swift, bindings/web/packages/core/src/Public/API/Deprecated.ts
Swift annotations and web comments recommend SpeechHandle-based interruption instead of tts.stop(). Method behavior and signatures are unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to faf64

This change corrects four deprecated TTS helpers so they direct callers to the returned speech handle instead of another deprecated API; it has no runtime behavior impact and no actionable merge-blocking risk remains.

Suggested reviewers: sanchitmonga22

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: deprecated Swift and Web TTS helpers no longer point to another deprecated API.
Description check ✅ Passed The description clearly explains the defect, affected APIs, rationale, scope, implementation, and verification results.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

bindings/web/packages/core/src/Public/API/Deprecated.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Still reproduces on today's main (00e879fa8). Re-verified both halves rather than assuming:

Swift. RunAnywhere+TTS.swift:55 and :76 both redirect callers with

@available(*, deprecated, renamed: "tts.stop()")

while the target is itself deprecated, TTSNamespace.swift:102:

@available(*, deprecated, message: "Use the SpeechHandle returned by speak(_:options:) to interrupt one utterance")
public func stop() async {

So Xcode's fix-it walks a caller from one deprecated symbol straight onto another.

Web. Deprecated.ts:82 and :87 both say @deprecated Use RunAnywhere.tts.stop(), and tts.ts:173 marks that method @deprecated Use the SpeechHandle returned by speak().

One detail I did not have in the description: the web speak() docstring goes further than deprecating it, tts.ts:162 states outright

There is no global tts.stop(); interrupt playback through the returned handle.

so the redirect target is documented as not existing, one file away from the deprecation notes that point at it.

Branch merges clean into current main, CI green (0 failing). Nothing pushed, since a rebase would be a no-op force-push that only resets the review state.

…ated API

stopSynthesis/stopSpeaking in both SDKs tell the caller to use tts.stop(),
which is itself deprecated in favour of the SpeechHandle returned by speak().
Following the advice trades one deprecation warning for another, and on Swift
`renamed:` gives Xcode a fix-it that performs the bad migration for you.

Retarget all four at the SpeechHandle, matching the wording tts.stop() already
uses. Swift drops `renamed:` for `message:` because the replacement is a
returned handle, not a symbol that can be substituted at the call site.
Kotlin's equivalents were fixed in RunanywhereAI#731.
@ayaangazali
ayaangazali force-pushed the fix/deprecations-pointing-at-deprecated branch from faf64e7 to a5d7e8b Compare September 2, 2026 19:19
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