Skip to content

Commit 87db3eb

Browse files
committed
Delete empty TTS profile parents
1 parent cb8d8ef commit 87db3eb

9 files changed

Lines changed: 582 additions & 228 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ function initializeTextToSpeechTool(root = document, { engine = new TextToSpeech
813813
const errors = [];
814814
if (!profile.name.trim()) errors.push("Profile Name is required.");
815815
if (!profile.language.trim()) errors.push("Language is required.");
816+
if (!profile.emotions.length) errors.push("At least one Emotion is required.");
816817
if (state.profiles.some((candidate) => candidate.id !== profile.id && candidate.name.toLowerCase() === profile.name.toLowerCase())) {
817818
errors.push("Profile Name must be unique.");
818819
}

docs_build/database/seed/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
"messages_records": [],
2929
"messages_segments": []
3030
},
31-
"note": "Seed names are applied by the server-side Messages Postgres service. Browser pages must not seed authoritative records. Retired TTS parent profiles Default Balanced Profile, Hero, Merchant, Neutral, and Robot are pruned server-side and must not be reintroduced as seed records."
31+
"note": "Seed names are applied by the server-side Messages Postgres service. Browser pages must not seed authoritative records. Retired TTS parent profiles Default Balanced Profile, Hero, Merchant, Neutral, and Robot are pruned server-side and must not be reintroduced as seed records. Empty TTS parent profiles without child emotion settings are also pruned instead of repaired with fallback children."
3232
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# PR_26177_BRAVO_008-delete-empty-tts-profile-parents
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+
- Added server-side cleanup for TTS parent profiles that have no child emotion settings.
10+
- Empty TTS parent profiles are deleted instead of repaired with fallback child rows.
11+
- Orphaned profile-emotion settings are pruned before empty-parent cleanup.
12+
- TTS profile creates now require at least one child emotion setting.
13+
- TTS profile updates that remove all child emotion settings delete the parent and return a 410 error.
14+
- TTS UI save validation now blocks empty parent saves before an API write.
15+
- Guest save redirect behavior to `account/sign-in.html` is preserved.
16+
17+
## Requirement Checklist
18+
- PASS: Empty parent TTS Profile rows are removed from service/runtime display.
19+
- PASS: Orphaned child emotion settings are removed.
20+
- PASS: No fallback child emotion rows are created.
21+
- PASS: Broken/empty profiles are deleted, not repaired.
22+
- PASS: UI save validation prevents creating empty parent rows.
23+
- PASS: Guest save redirect behavior is unchanged.
24+
- PASS: Targeted unit/API and impacted Playwright specs were updated.
25+
- PASS: No governance changes.
26+
- PASS: No unrelated cleanup or repo-wide refactor.
27+
28+
## File Inventory
29+
- `assets/toolbox/text-to-speech/js/index.js`
30+
- `docs_build/database/seed/messages.json`
31+
- `src/dev-runtime/messages/messages-postgres-service.mjs`
32+
- `tests/dev-runtime/MessagesPublishValidation.test.mjs`
33+
- `tests/playwright/tools/MessagesTool.spec.mjs`
34+
- `tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
35+
- `docs_build/dev/reports/PR_26177_BRAVO_008-delete-empty-tts-profile-parents.md`
36+
- `docs_build/dev/reports/codex_changed_files.txt`
37+
- `docs_build/dev/reports/codex_review.diff`
38+
39+
## DB/API Inventory
40+
- `messages_tts_profiles`: profiles without child settings are deleted.
41+
- `messages_tts_profile_emotion_settings`: orphaned rows are deleted before empty-parent evaluation.
42+
- `messages_records`, `messages_segments`, `messages_event_actions`: stale rows referencing deleted empty parents are removed to avoid orphaned database references.
43+
- `POST /api/messages/tts-profiles`: rejects empty parent saves.
44+
- `PATCH /api/messages/tts-profiles/:key`: deletes the parent when the requested emotion settings become empty.
45+
46+
## Test Inventory
47+
- Added/extended `Messages seed cleanup deletes retired parent TTS profiles and orphaned settings` to include empty parent cleanup and stale reference deletion.
48+
- Added `Messages TTS profile saves reject empty parent profiles instead of creating fallback children`.
49+
- Updated Text To Speech Playwright expectations to block empty UI saves and use API-created profiles with child settings for preview.
50+
- Updated Messages Playwright profile setup to create profiles through the Local API with child settings supplied up front.
51+
52+
## Validation Lane Report
53+
- PASS: `node --check assets/toolbox/text-to-speech/js/index.js`
54+
- PASS: `node --check src/dev-runtime/messages/messages-postgres-service.mjs`
55+
- PASS: `node --check tests/dev-runtime/MessagesPublishValidation.test.mjs`
56+
- PASS: `node --check tests/playwright/tools/TextToSpeechFunctional.spec.mjs`
57+
- PASS: `node --check tests/playwright/tools/MessagesTool.spec.mjs`
58+
- PASS: `node --test tests/dev-runtime/MessagesPublishValidation.test.mjs` (8/8)
59+
- PASS: `node --test --test-name-pattern "Messages Local API seeds" tests/dev-runtime/DbSeedIntegrity.test.mjs` (1/1)
60+
- PASS: `node --test tests/tools/Text2SpeechShell.test.mjs` (6/6)
61+
- BLOCKED: `npx playwright test tests/playwright/tools/TextToSpeechFunctional.spec.mjs tests/playwright/tools/MessagesTool.spec.mjs tests/playwright/tools/EventsTool.spec.mjs --project=playwright`
62+
- 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`.
63+
64+
## Manual Validation Notes
65+
- Reviewed the TTS profile create/update/list paths for empty-parent persistence.
66+
- Verified no local storage product-data path or fallback child creation was added.
67+
- Playwright/manual browser validation remains blocked by the missing local Chromium install.
68+
69+
## Known Issues
70+
- Playwright browser validation cannot complete in this environment until the matching Chromium browser is installed.
71+
72+
## Repo-Structured ZIP
73+
- `tmp/PR_26177_BRAVO_008-delete-empty-tts-profile-parents_delta.zip`
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
assets/toolbox/text-to-speech/js/index.js
12
docs_build/database/seed/messages.json
23
docs_build/dev/reports/codex_changed_files.txt
34
docs_build/dev/reports/codex_review.diff
4-
docs_build/dev/reports/PR_26177_BRAVO_007-delete-broken-tts-profile-parents.md
5+
docs_build/dev/reports/PR_26177_BRAVO_008-delete-empty-tts-profile-parents.md
56
src/dev-runtime/messages/messages-postgres-service.mjs
67
tests/dev-runtime/MessagesPublishValidation.test.mjs
8+
tests/playwright/tools/MessagesTool.spec.mjs
9+
tests/playwright/tools/TextToSpeechFunctional.spec.mjs

0 commit comments

Comments
 (0)