This anchor is for native engineers extending SpeakTrue speech generation and Soundboard save behavior. After reading it, a native engineer should be able to re-run the Android parity evidence, understand which fields are guarded locally, and preserve the server-side artifact_path save parity path while keeping local upload as compatibility fallback.
Android is the current native anchor for the speech workflow contract. Its local unit tests cover the generation response parser and the TTS presentation state that stores or clears generated speech artifacts.
This is executable local proof only. It does not prove live Supabase, ElevenLabs, object-storage, authorization, or production provider behavior. Live workflow proof remains owned by the browser/runtime and edge-function checks listed in the canonical speech workflow contract.
Run the Android parity tests with:
./android/gradlew -p android :app:testDebugUnitTest --tests 'com.speaktrue.features.tts.data.TTSRepositoryTest' --tests 'com.speaktrue.features.tts.presentation.TTSViewModelTest'
The Android evidence is concentrated in these test classes:
TTSRepositoryTest
generate_withCanonicalSuccessEnvelope_returnsArtifactAndPlaybackPath proves Android accepts the canonical success envelope and stores artifact_id, artifact_path, audio_path, and download_path together.generate_withCanonicalSuccessMissingArtifactPath_returnsStructuredMalformedError, generate_withCanonicalSuccessMissingStatus_returnsStructuredMalformedError, and generate_withCanonicalSuccessWrongSuccessFlag_returnsStructuredMalformedError prove malformed canonical successes become structured non-retryable errors instead of stale artifacts.generate_withCanonicalSuccessTraversalArtifactPath_returnsStructuredMalformedError and generate_withCanonicalSuccessAbsoluteArtifactPath_returnsStructuredMalformedError prove path boundary checks reject traversal and absolute artifact paths.generate_withCanonicalFailureEnvelope_returnsStructuredDiagnostics proves structured failure diagnostics are parsed from error, error_code, operation, status, retryable, and bounded details.TTSViewModelTest
generate_withCanonicalSuccess_storesLatestSpeechArtifact proves presentation state exposes the latest generated artifact and clears previous diagnostics after a valid success.generate_withStructuredFailure_clearsStaleArtifactAndExposesDiagnostic proves structured generation failures clear stale artifacts and expose operation, error_code, status, and retryable diagnostics.generate_withMalformedSuccessError_clearsStaleArtifact proves malformed success evidence clears stale generated artifacts at the native UI state boundary.saveLastAudioToSoundboard_withCanonicalArtifactUsesServerSideSaveAndSkipsLocalUpload proves Android forwards canonical generated artifact metadata to the server-side Soundboard save function and skips local storage upload when artifact evidence exists.saveLastAudioToSoundboard_withServerArtifactSaveFailure_preservesArtifactForRetry proves the server-side save failure path keeps the valid artifact available for retry and exposes a deterministic save diagnostic.saveLastAudioToSoundboard_withLegacyUploadFailure_preservesAudioForRetry proves the compatibility upload failure path keeps the valid audio available for retry and exposes a deterministic save diagnostic.saveLastAudioToSoundboard_passesStateTextAsTranscriptText and saveLastAudioToSoundboard_usesIosStyleClipNamingContract prove the current Android save path carries the transcript text into the Soundboard upload contract.Android local unit evidence now covers these speech workflow contract expectations:
artifact_id, artifact_path, audio_path, and download_path are retained together on canonical generation success.operation.error_code values instead of requiring prose parsing.status for native branching.retryable for retry decisions.artifact_id, artifact_path, audio_path, download_path, category, clip name, and original text to soundboard-save-generated when a canonical artifact exists.Native diagnostics must remain useful to agents and tests without exposing secrets or local machine state.
Android now proves the native handoff to server-side save-to-Soundboard artifact_path parity when canonical artifact metadata exists. Full playback mode requests the Supabase TTS artifact response mode; that stores the generated audio as a server artifact and returns artifact_id, artifact_path, audio_path, and download_path. TTSViewModel.saveLastAudioToSoundboard() then calls SoundboardRepository.saveGeneratedArtifactClip(), which posts the canonical metadata to the soundboard-save-generated edge function instead of downloading and re-uploading the audio locally.
The local-upload path remains as compatibility behavior only when a generation response is binary/audio-url-only and no canonical artifact exists.
Remaining production proof is live Supabase/ElevenLabs smoke evidence against deployed tts-generate artifact mode plus soundboard-save-generated; local unit and Deno tests prove the client/server contract and failure semantics.
Run these checks before changing the native anchor or canonical speech workflow contract:
test -s docs/contracts/native-speech-parity-anchor.md && grep -q "TTSRepositoryTest" docs/contracts/native-speech-parity-anchor.md && grep -q "TTSViewModelTest" docs/contracts/native-speech-parity-anchor.md
./android/gradlew -p android :app:testDebugUnitTest --tests 'com.speaktrue.features.tts.data.TTSRepositoryTest' --tests 'com.speaktrue.features.tts.presentation.TTSViewModelTest' --tests 'com.speaktrue.features.soundboard.data.SoundboardRepositoryTest'
deno test backend/supabase/functions/soundboard-save-generated/handler_test.ts
node web/python-web-app/tests/js/tts_soundboard_workflow_runtime_check.mjs
deno test backend/supabase/functions/tts-generate/handler_test.ts
python3 -c "from graphify.watch import _rebuild_code; from pathlib import Path; _rebuild_code(Path('.'))"