Skip to content

Commit 027fca6

Browse files
committed
Delete broken TTS seed profiles
1 parent c983edb commit 027fca6

12 files changed

Lines changed: 983 additions & 817 deletions

File tree

assets/toolbox/text-to-speech/js/index.js

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ const TTS_PROVIDER_ADAPTER_PLAN = Object.freeze([
7777

7878
const TTS_PROFILE_CONTRACT_VERSION = "tts-profile-emotion-v1";
7979
const NEW_ROW_KEY = "__new__";
80-
const DEFAULT_TTS_PROFILE_ID = "default-balanced-profile";
81-
const DEFAULT_TTS_EMOTION_ID = "neutral";
80+
const DEFAULT_TTS_PROFILE_ID = "tts-profile";
81+
const DEFAULT_TTS_EMOTION_ID = "calm";
8282
const SIGN_IN_ROUTE = "account/sign-in.html";
8383

8484
const TTS_PROFILE_GENDER_OPTIONS = Object.freeze([
@@ -89,7 +89,6 @@ const TTS_PROFILE_GENDER_OPTIONS = Object.freeze([
8989
]);
9090

9191
const TTS_PROFILE_EMOTION_OPTIONS = Object.freeze([
92-
Object.freeze({ label: "Neutral", value: "neutral" }),
9392
Object.freeze({ label: "Happy", value: "happy" }),
9493
Object.freeze({ label: "Angry", value: "angry" }),
9594
Object.freeze({ label: "Scared", value: "scared" }),
@@ -115,7 +114,7 @@ function createTtsMessage({
115114
id,
116115
name,
117116
text,
118-
emotionKey = "neutral",
117+
emotionKey = DEFAULT_TTS_EMOTION_ID,
119118
voiceProfileKey = "browser-speech",
120119
languageCode = "en-US",
121120
status = "draft",
@@ -125,7 +124,7 @@ function createTtsMessage({
125124
id: String(id || "tts-message-draft"),
126125
name: String(name || "Untitled TTS Message"),
127126
text: String(text || ""),
128-
emotionKey: String(emotionKey || "neutral"),
127+
emotionKey: String(emotionKey || DEFAULT_TTS_EMOTION_ID),
129128
voiceProfileKey: String(voiceProfileKey || "browser-speech"),
130129
languageCode: String(languageCode || "en-US"),
131130
status: TTS_MESSAGE_STATUSES.includes(status) ? status : "draft",
@@ -141,7 +140,7 @@ function createTtsMessage({
141140
};
142141
}
143142

144-
function createEmotionProfile({ key = "neutral", name = "Neutral", intensity = 0.5 } = {}) {
143+
function createEmotionProfile({ key = DEFAULT_TTS_EMOTION_ID, name = "Calm", intensity = 0.5 } = {}) {
145144
const numericIntensity = Number(intensity);
146145
const safeIntensity = Number.isNaN(numericIntensity) ? 0.5 : Math.min(1, Math.max(0, numericIntensity));
147146
return { key: String(key), name: String(name), intensity: safeIntensity, owner: TTS_OWNERSHIP.AUDIO };
@@ -174,7 +173,7 @@ function labelForOption(options, value, fallback = "") {
174173
function createTextToSpeechProfileEmotion({
175174
active = true,
176175
displayOrder = 0,
177-
emotion = "neutral",
176+
emotion = DEFAULT_TTS_EMOTION_ID,
178177
emotionLabel = "",
179178
id = "",
180179
messageUsageCount = 0,
@@ -216,17 +215,17 @@ function createTextToSpeechProfile({
216215
id = "",
217216
language = TEXT_TO_SPEECH_DEFAULTS.language,
218217
messageStudioUsageCount = 0,
219-
name = "Default Balanced Profile",
218+
name = "Untitled TTS Profile",
220219
references = [],
221220
segmentUsageCount = 0,
222221
usageCount = 0,
223222
voice = "",
224223
voiceName = ""
225224
} = {}) {
226-
const profileName = String(name || "Default Balanced Profile").trim() || "Default Balanced Profile";
227-
const emotionRows = Array.isArray(emotions) && emotions.length
225+
const profileName = String(name || "Untitled TTS Profile").trim() || "Untitled TTS Profile";
226+
const emotionRows = Array.isArray(emotions)
228227
? emotions.map((emotion) => createTextToSpeechProfileEmotion(emotion))
229-
: [createTextToSpeechProfileEmotion()];
228+
: [];
230229
return {
231230
active: active !== false,
232231
age: String(age || TEXT_TO_SPEECH_DEFAULTS.voiceAge),
@@ -250,7 +249,7 @@ function createTextToSpeechProfileEmotionFromApi(setting = {}) {
250249
return createTextToSpeechProfileEmotion({
251250
active: setting.active !== false,
252251
displayOrder: setting.displayOrder || 0,
253-
emotion: setting.emotion || setting.emotionLabel || setting.name || "neutral",
252+
emotion: setting.emotion || setting.emotionLabel || setting.name || DEFAULT_TTS_EMOTION_ID,
254253
emotionLabel: setting.emotionLabel || setting.name || setting.emotion || "",
255254
id: setting.key || setting.emotionProfileKey || setting.emotion || "",
256255
messagePartsUsageCount: setting.segmentUsageCount ?? setting.messagePartsUsageCount ?? 0,
@@ -301,30 +300,12 @@ function defaultVoiceForProfile(voiceOptions = [], preferredGender = "") {
301300
return preferred || voiceOptions[0];
302301
}
303302

304-
function createDefaultEmotionSettings({ markNeutralInUse = false } = {}) {
305-
return [
306-
createTextToSpeechProfileEmotion({
307-
emotion: "neutral",
308-
messagePartsUsageCount: markNeutralInUse ? 1 : 0,
309-
}),
310-
createTextToSpeechProfileEmotion({ emotion: "calm" }),
311-
createTextToSpeechProfileEmotion({ emotion: "urgent", pitch: 1.08, rate: 1.15, volume: 1 }),
312-
];
303+
function createDefaultEmotionSettings() {
304+
return [];
313305
}
314306

315-
function createDefaultTextToSpeechProfiles(voiceOptions = []) {
316-
const balancedVoice = defaultVoiceForProfile(voiceOptions);
317-
return [
318-
createTextToSpeechProfile({
319-
emotions: createDefaultEmotionSettings({ markNeutralInUse: true }),
320-
id: DEFAULT_TTS_PROFILE_ID,
321-
language: balancedVoice?.language || TEXT_TO_SPEECH_DEFAULTS.language,
322-
messageStudioUsageCount: 1,
323-
name: "Default Balanced Profile",
324-
voice: balancedVoice?.value || "",
325-
voiceName: balancedVoice?.name || balancedVoice?.label || "Default browser voice"
326-
}),
327-
];
307+
function createDefaultTextToSpeechProfiles() {
308+
return [];
328309
}
329310

330311
function signInUrl() {
@@ -681,7 +662,7 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
681662
languageCell.append(createEditorSelect(profile?.language || TEXT_TO_SPEECH_DEFAULTS.language, "ttsProfileLanguage", languageSelectOptions()));
682663
const ageCell = document.createElement("td");
683664
ageCell.append(createEditorSelect(profile?.age || TEXT_TO_SPEECH_DEFAULTS.voiceAge, "ttsProfileAge", TEXT_TO_SPEECH_AGE_FILTER_OPTIONS));
684-
const emotionCountCell = createCell(profile ? String(profile.emotions.length) : "1");
665+
const emotionCountCell = createCell(profile ? String(profile.emotions.length) : "0");
685666
const usageCell = createCell(profile ? String(profile.usageCount || profile.messageStudioUsageCount || 0) : "0");
686667
const statusCell = document.createElement("td");
687668
statusCell.append(createCheckbox(profile?.active !== false, "ttsProfileActive"));
@@ -818,7 +799,7 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
818799
return createTextToSpeechProfile({
819800
active: editorChecked(row, "[data-tts-profile-active]"),
820801
age: editorValue(row, "[data-tts-profile-age]"),
821-
emotions: key === NEW_ROW_KEY ? [createTextToSpeechProfileEmotion()] : state.profiles.find((profile) => profile.id === key)?.emotions || [],
802+
emotions: key === NEW_ROW_KEY ? [] : state.profiles.find((profile) => profile.id === key)?.emotions || [],
822803
gender: editorValue(row, "[data-tts-profile-gender]"),
823804
id: key === NEW_ROW_KEY ? "" : key,
824805
language: editorValue(row, "[data-tts-profile-language]"),

docs_build/database/seed/messages.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"Notification"
1717
],
1818
"messages_emotion_profiles": [
19-
"Neutral",
2019
"Calm",
2120
"Urgent",
2221
"Whisper",
@@ -25,9 +24,7 @@
2524
"Sad",
2625
"Mysterious"
2726
],
28-
"messages_tts_profiles": [
29-
"Default Balanced Profile"
30-
],
27+
"messages_tts_profiles": [],
3128
"messages_records": [],
3229
"messages_segments": []
3330
},
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# PR_26177_BRAVO_006-delete-broken-tts-seed-profiles
2+
3+
## Branch Validation
4+
- PASS: Initial branch was `bravo/26177-text-to-speech`.
5+
- PASS: Work stayed on the active Bravo branch; main was not checked out.
6+
- PASS: No `start_of_day` folders were modified.
7+
8+
## Scope Summary
9+
- Deleted the broken Text To Speech seed profile set from the server/runtime seed path.
10+
- Removed the broken `Neutral` emotion seed and removed hidden default Neutral/profile creation in the TTS runtime helpers.
11+
- Preserved guest browsing and guest save redirect behavior to `account/sign-in.html`.
12+
- Updated targeted TTS, Messages API, seed integrity, and impacted Playwright specs to expect explicit working test profiles instead of broken seed records.
13+
14+
## Removed Invalid Profiles / Emotions
15+
- `Default Balanced Profile`: removed from server-side TTS seed inventory and browser runtime default profile helper output.
16+
- `Hero`: remains absent from the TTS seed/runtime profile set and is asserted absent in TTS Playwright coverage.
17+
- `Merchant`: remains absent from the TTS seed/runtime profile set and is asserted absent in TTS Playwright coverage.
18+
- `Neutral`: removed from the Messages emotion seed inventory and from TTS Profile emotion editor defaults/options. Existing `Neutral` voice gender terminology remains because it is a voice filter, not an Emotion Profile record.
19+
- `Robot`: remains absent from the TTS seed/runtime emotion set and is asserted absent in seed/UI coverage.
20+
21+
## File Inventory
22+
- `assets/toolbox/text-to-speech/js/index.js`
23+
- `docs_build/database/seed/messages.json`
24+
- `src/dev-runtime/messages/messages-postgres-service.mjs`
25+
- `tests/dev-runtime/DbSeedIntegrity.test.mjs`
26+
- `tests/dev-runtime/MessagesPublishValidation.test.mjs`
27+
- `tests/playwright/tools/EventsTool.spec.mjs`
28+
- `tests/playwright/tools/MessagesTool.spec.mjs`
29+
- `tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
30+
- `tests/tools/Text2SpeechShell.test.mjs`
31+
- `docs_build/dev/reports/PR_26177_BRAVO_006-delete-broken-tts-seed-profiles.md`
32+
- `docs_build/dev/reports/codex_changed_files.txt`
33+
- `docs_build/dev/reports/codex_review.diff`
34+
35+
## Guest Save Routing Checklist
36+
- PASS: TTS save/create/update/delete still require authenticated write checks.
37+
- PASS: Unauthenticated TTS profile save continues to route to `account/sign-in.html`.
38+
- PASS: Guest browsing remains allowed because profile reads still load without sign-in.
39+
- PASS: No local storage product-data fallback was added.
40+
41+
## Validation Lane Report
42+
- PASS: `node --check assets/toolbox/text-to-speech/js/index.js`
43+
- PASS: `node --check src/dev-runtime/messages/messages-postgres-service.mjs`
44+
- PASS: `node --check tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
45+
- PASS: `node --check tests/playwright/tools/MessagesTool.spec.mjs`
46+
- PASS: `node --check tests/playwright/tools/EventsTool.spec.mjs`
47+
- PASS: `node --test tests/tools/Text2SpeechShell.test.mjs` (6/6)
48+
- PASS: `node --test tests/dev-runtime/MessagesPublishValidation.test.mjs` (6/6)
49+
- PASS: `node --test --test-name-pattern "Messages Local API seeds" tests/dev-runtime/DbSeedIntegrity.test.mjs` (1/1)
50+
- BLOCKED: `npx playwright test tests/playwright/tools/TextToSpeechFunctional.spec.mjs tests/playwright/tools/MessagesTool.spec.mjs tests/playwright/tools/EventsTool.spec.mjs --project=playwright`
51+
- Browser launch failed before page code ran because Chromium is missing at `C:\Users\davidq\AppData\Local\ms-playwright\chromium-1217\chrome-win64\chrome.exe`.
52+
53+
## Manual Validation Notes
54+
- Reviewed seed/runtime references for `Default Balanced Profile`, `Hero`, `Merchant`, `Neutral`, and `Robot`.
55+
- Remaining `Neutral` source references are limited to voice gender/filter terminology, negative absence assertions, or descriptive prose for the `Calm` seed.
56+
- Playwright manual UI validation was not possible in this environment because the local Playwright Chromium binary is missing.
57+
58+
## Known Issues
59+
- Playwright browser validation remains blocked until the local Chromium browser is installed for this Playwright version.
60+
61+
## Repo-Structured ZIP
62+
- `tmp/PR_26177_BRAVO_006-delete-broken-tts-seed-profiles_delta.zip`

docs_build/dev/reports/codex_changed_files.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ assets/toolbox/text-to-speech/js/index.js
22
docs_build/database/seed/messages.json
33
docs_build/dev/reports/codex_changed_files.txt
44
docs_build/dev/reports/codex_review.diff
5-
docs_build/dev/reports/PR_26177_BRAVO_005-fix-tts-seed-profiles-and-guest-save-routing.md
5+
docs_build/dev/reports/PR_26177_BRAVO_006-delete-broken-tts-seed-profiles.md
66
src/dev-runtime/messages/messages-postgres-service.mjs
7-
src/dev-runtime/server/local-api-router.mjs
87
tests/dev-runtime/DbSeedIntegrity.test.mjs
98
tests/dev-runtime/MessagesPublishValidation.test.mjs
109
tests/playwright/tools/EventsTool.spec.mjs

0 commit comments

Comments
 (0)