|
| 1 | +# PR_26130_016-text-to-speech-v2-named-speech-selection |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +Update Text to Speech V2 named speech selection so speech items can be started independently, repeat controls are removed, and item naming is editable and schema-valid. |
| 6 | + |
| 7 | +## Scope |
| 8 | + |
| 9 | +Changed only Text to Speech V2 runtime/UI/schema/defaults, the shared Text to Speech engine/default modules, and Workspace Manager V2 Playwright coverage for this tool. |
| 10 | + |
| 11 | +No unrelated files were modified. No `start_of_day` files were changed. |
| 12 | + |
| 13 | +## Implementation Summary |
| 14 | + |
| 15 | +- Removed Repeat Count and Delay Between Repeats from UI, schema, defaults, item data, hydration, and tests. |
| 16 | +- Added safe migration for older queue items that still contain `repeatCount` or `delayBetweenRepeatsMs`; the fields are stripped before render and workspace launch data is marked dirty for migration. |
| 17 | +- Changed visible text labels from `Text` / `Speech text` to `Text to Speak`. |
| 18 | +- Added a Name input above Add/Duplicate/Delete. |
| 19 | +- Blocked Add when Name is empty with a visible status message. |
| 20 | +- Populated Name from the selected tile and wired Name edits to update the selected item name, tile label, summary, and dirty toolState. |
| 21 | +- Changed speech start behavior so starting another named speech item does not call global `speechSynthesis.cancel()`. |
| 22 | +- Added active speaker tracking by selected speech item id/name. |
| 23 | +- Added selected Stop handling that uses global cancel only when it will not stop other tracked speakers. |
| 24 | +- Added Stop All as the explicit global-cancel action for multiple active speakers. |
| 25 | +- Updated the `D&D Dungeon Master` preset to `ssmlLikePreset=normal`, `volume=1`, `rate=0.8`, and `pitch=0.5`. |
| 26 | + |
| 27 | +## Playwright Impact |
| 28 | + |
| 29 | +Playwright impacted: Yes. |
| 30 | + |
| 31 | +The Workspace Manager V2 Playwright suite validates: |
| 32 | + |
| 33 | +- Multiple named speech items can be started without canceling prior speakers. |
| 34 | +- Starting a new named speech item does not call global `speechSynthesis.cancel()`. |
| 35 | +- Stop refuses selected-speaker global cancel while multiple speakers are active, and Stop All is explicit. |
| 36 | +- Repeat Count and Delay Between Repeats controls are removed. |
| 37 | +- Schema/default queue items no longer require repeat or delay fields. |
| 38 | +- `Text to Speak` label appears and `Speech text` is not rendered. |
| 39 | +- Add is blocked when Name is empty. |
| 40 | +- Selected tiles populate Name. |
| 41 | +- Name edits update the selected tile/item and dirty toolState. |
| 42 | +- `D&D Dungeon Master` applies rate `0.8`, pitch `0.5`, volume `1`, and SSML-like preset `normal`. |
| 43 | + |
| 44 | +Expected pass behavior: named speech starts append active speakers without canceling existing ones, removed fields stay out of rendered/current queue data, and item naming changes remain schema-valid. |
| 45 | + |
| 46 | +Expected fail behavior: Playwright fails if removed controls reappear, schema still requires repeat/delay, starting another speech item calls cancel, or Name can create invalid empty queue items. |
| 47 | + |
| 48 | +## Validation |
| 49 | + |
| 50 | +Passed: |
| 51 | + |
| 52 | +```text |
| 53 | +npm run test:workspace-v2 |
| 54 | +``` |
| 55 | + |
| 56 | +Result: |
| 57 | + |
| 58 | +```text |
| 59 | +28 passed |
| 60 | +``` |
| 61 | + |
| 62 | +Additional checks passed: |
| 63 | + |
| 64 | +```text |
| 65 | +npx playwright test tests/playwright/tools/WorkspaceManagerV2.spec.mjs --project=playwright --workers=1 --reporter=list -g "Text to Speech V2" |
| 66 | +node --check src/engine/audio/TextToSpeechDefaults.js |
| 67 | +node --check src/engine/audio/TextToSpeechEngine.js |
| 68 | +node --check tools/text2speach-V2/js/TextToSpeechToolApp.js |
| 69 | +node --check tools/text2speach-V2/js/bootstrap.js |
| 70 | +node --check tools/text2speach-V2/js/controls/ActionNavControl.js |
| 71 | +node --check tools/text2speach-V2/js/controls/QueueControl.js |
| 72 | +node --check tools/text2speach-V2/js/controls/SpeechOptionsControl.js |
| 73 | +node --check tests/playwright/tools/WorkspaceManagerV2.spec.mjs |
| 74 | +node -e "JSON.parse(require('node:fs').readFileSync('tools/schemas/tools/text2speach-V2.schema.json','utf8')); console.log('schema ok')" |
| 75 | +git diff --check HEAD -- . |
| 76 | +rg -n -P "<script(?![^>]*\bsrc=)|<style|\son[a-zA-Z]+=" tools/text2speach-V2/index.html |
| 77 | +rg -n "tools/shared|imageDataUrl|start_of_day" src/engine/audio tools/text2speach-V2 tools/schemas/tools/text2speach-V2.schema.json tests/playwright/tools/WorkspaceManagerV2.spec.mjs |
| 78 | +``` |
| 79 | + |
| 80 | +The inline HTML restriction scan and forbidden-scope scan returned no matches. `git diff --check` reported only existing Windows line-ending warnings and no whitespace errors. |
| 81 | + |
| 82 | +## V8 Coverage |
| 83 | + |
| 84 | +The `npm run test:workspace-v2` run generated the Playwright V8 coverage report at: |
| 85 | + |
| 86 | +```text |
| 87 | +docs/dev/reports/playwright_v8_coverage_report.txt |
| 88 | +``` |
| 89 | + |
| 90 | +Changed runtime JS coverage included: |
| 91 | + |
| 92 | +- `src/engine/audio/TextToSpeechDefaults.js` |
| 93 | +- `src/engine/audio/TextToSpeechEngine.js` |
| 94 | +- `tools/text2speach-V2/js/TextToSpeechToolApp.js` |
| 95 | +- `tools/text2speach-V2/js/bootstrap.js` |
| 96 | +- `tools/text2speach-V2/js/controls/ActionNavControl.js` |
| 97 | +- `tools/text2speach-V2/js/controls/QueueControl.js` |
| 98 | +- `tools/text2speach-V2/js/controls/SpeechOptionsControl.js` |
| 99 | + |
| 100 | +The coverage guard reported no low-coverage changed runtime JS files. |
| 101 | + |
| 102 | +## Full Samples Smoke Test |
| 103 | + |
| 104 | +Skipped. This PR is limited to Text to Speech V2 named speech runtime behavior, UI controls, schema/default queue data, and Workspace Manager V2 tool coverage. It does not modify the shared sample loader, sample JSON, or broad game launch behavior. |
| 105 | + |
| 106 | +## ZIP Artifact |
| 107 | + |
| 108 | +Repo-structured delta ZIP: |
| 109 | + |
| 110 | +```text |
| 111 | +tmp/PR_26130_016-text-to-speech-v2-named-speech-selection_delta.zip |
| 112 | +``` |
| 113 | + |
| 114 | +## Manual Validation Steps |
| 115 | + |
| 116 | +1. Open `tools/text2speach-V2/index.html`. |
| 117 | +2. Confirm the center accordion reads `Text to Speak` and no visible `Speech text` label appears. |
| 118 | +3. Confirm Repeat Count and Delay Between Repeats controls are absent. |
| 119 | +4. Select different named speech tiles and confirm the Name input updates. |
| 120 | +5. Edit Name and confirm the selected tile label updates. |
| 121 | +6. Clear Name and click Add; confirm the status log blocks Add with an actionable message. |
| 122 | +7. Start one named speech item, select another tile, and start it; confirm the log shows two active speakers and no global cancel. |
| 123 | +8. Click Stop with multiple active speakers; confirm it refuses selected stop without global cancel. |
| 124 | +9. Click Stop All; confirm all tracked speakers clear. |
| 125 | +10. Select `D&D Dungeon Master` and confirm Rate is `0.8`, Pitch is `0.5`, Volume is `1`, and SSML-like preset is `normal`. |
| 126 | + |
| 127 | +Expected outcome: named speech selection and playback remain independent, removed repeat fields are not rendered or required, and Name edits keep queue data schema-valid. |
| 128 | + |
| 129 | +## Changed Files |
| 130 | + |
| 131 | +- `src/engine/audio/TextToSpeechDefaults.js` |
| 132 | +- `src/engine/audio/TextToSpeechEngine.js` |
| 133 | +- `tests/playwright/tools/WorkspaceManagerV2.spec.mjs` |
| 134 | +- `tools/schemas/tools/text2speach-V2.schema.json` |
| 135 | +- `tools/text2speach-V2/index.html` |
| 136 | +- `tools/text2speach-V2/js/TextToSpeechToolApp.js` |
| 137 | +- `tools/text2speach-V2/js/bootstrap.js` |
| 138 | +- `tools/text2speach-V2/js/controls/ActionNavControl.js` |
| 139 | +- `tools/text2speach-V2/js/controls/QueueControl.js` |
| 140 | +- `tools/text2speach-V2/js/controls/SpeechOptionsControl.js` |
| 141 | +- `tools/text2speach-V2/styles/text2speach-V2.css` |
| 142 | +- `docs/dev/reports/PR_26130_016-text-to-speech-v2-named-speech-selection.md` |
| 143 | +- `docs/dev/reports/codex_review.diff` |
| 144 | +- `docs/dev/reports/codex_changed_files.txt` |
| 145 | +- `docs/dev/codex_commands.md` |
| 146 | +- `docs/dev/commit_comment.txt` |
0 commit comments