feat(core): mock roAudioGuide, roTextToSpeech, roMicrophone, roDSA and roRSA#956
Merged
Conversation
…d roRSA Add mock implementations for these previously-unimplemented components so apps that use them no longer crash when CreateObject returns invalid. Each exposes its documented interface methods returning safe static values, but performs no real speech, recording or cryptographic signing: - roAudioGuide (ifAudioGuide) - roTextToSpeech (ifTextToSpeech + message port) - roMicrophone (ifMicrophone + message port) - roDSA (ifDsa) - roRSA (ifRSA) Wire them into the BrsObjects registry and brsTypes re-exports, add a test suite per component, and update docs/limitations.md to move them into the Mocked Components section. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address SonarQube S2933: the `port` field in RoTextToSpeech and RoMicrophone is never reassigned from within the class (the assignment is performed by the IfSetMessagePort helper through an any-typed reference), so it can be declared readonly without affecting the setMessagePort behavior. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds mock implementations for five previously-unimplemented BrightScript components so apps that reference them no longer crash (
CreateObjectwas returninginvalid, and any subsequent method call raised a runtime error). This follows the same compatibility approach already used forroStreamSocket,roDataGramSocket, Channel Store, etc.Each component registers its documented interface methods (per the
external/dev-docspec) and returns safe, static values, but performs no real work — no actual speech, recording, or cryptographic signing:roAudioGuideifAudioGuideSayreturns incrementing IDs,Flushno-op,Silenceechoes the durationroTextToSpeechifTextToSpeech+ message portvolume=1000,rate=0,pitch=0,language="en-US"),IsEnabledfalse, empty voice/language listsroMicrophoneifMicrophone+ message portroDSAifDsaSign→invalid,Verify→0roRSAifRSASign→invalid,Verify→0The two message-port components hold a
port?field withdispose()cleanup but never post events (the mock never speaks/records), so no event classes were added.Changes
src/core/brsTypes/components/BrsObjects.tsand re-exported frombrsTypes/index.tstest/brsTypes/components/(29 tests)docs/limitations.md: moved these out of "not implemented yet" into the Mocked Components sectionTesting
npm run lint+ prettier cleannpm run build:cli/build:sgcompile🤖 Generated with Claude Code