add sources/ with some old files

This commit is contained in:
2026-10-07 14:50:30 -04:00
parent 0710f1e842
commit c91ec7a371
41 changed files with 90400 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
1. What the Model Broke
When we asked the Model to make sure users can only touch their own data, it tried to be slick and optimize database calls in voice-synthsizer-job-handler/index.js.
It put three database searches into Promise.all so they would run at the exact same time. But one of those searches looked for recordingId. The problem? recordingId isn't in the incoming queue job at all. In the original code, recordingId comes out of salutationToUpdate after salutationToUpdate finishes loading from MongoDB. By trying to search for recordingId before fetching salutationToUpdate, the Model used a variable that didn't exist yet.
On top of that, it moved the line that deletes the job from the SQS queue (deleteMessageFromSQS) way up in the file—deleting the queue message before running the Python audio script or uploading the finished audio to S3.
2. How We Proved It
File & Function: voice-synthesizer-job-handler/index.js inside processQueue.
Checking the Queue Payload: We looked at how SQS messages are built in app/services/sqs/. They only send salutationId, userAudioProfileId, and userId—never recordingId.
Checking the Code changes: Reviewing the code changes, we saw that the Model put recordingModel.findOne(...) right inside Promise.all next to salutationToUpdate. Since recordingId hasn't been defined yet, Node.js crashes with ReferenceError: recordingId is not defined.
Checking the Execution Order: We checked the code and saw deleteMessageFromSQS was moved above executeFile('python3', ...) and S3 upload calls.
3. What Happens in Real Life
100% Job Crash Rate: Desk checking the code, every single speech job crashes the second it hits the worker because of ReferenceError: recordingId is not defined. The system stops making audio completely.
Permanent Data Loss: Because the job is deleted from SQS before the audio script even runs, any glitch in Python, ffmpeg, or S3 means the job is wiped out forever without SQS ever trying again.