Skip to content

Comments

fix: Improve field access safety and duration parsing to prevent runtime exceptions#689

Merged
Avijit-Microsoft merged 3 commits intomicrosoft:mainfrom
cyberflying:fix-cu-result
Jan 19, 2026
Merged

fix: Improve field access safety and duration parsing to prevent runtime exceptions#689
Avijit-Microsoft merged 3 commits intomicrosoft:mainfrom
cyberflying:fix-cu-result

Conversation

@cyberflying
Copy link
Contributor

Purpose

  • Refactored data processing scripts to improve error handling and code robustness.
  • Use get_field_value() helper function for safer field access to avoid KeyError exceptions
  • Add try-except block for duration parsing to handle ValueError and TypeError gracefully
  • Default to 0 when duration field is missing or contains invalid data

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • ...

Other Information

@Avijit-Microsoft
Copy link
Contributor

Hi @cyberflying,
Thank you for raising the PR. We’ve reviewed and validated the changes and observed that duplicate conversation IDs are being generated. Could you please review this on your end and let us know if any support is needed from our side?

@cyberflying
Copy link
Contributor Author

Hi @Avijit-Microsoft ,
Thanks for pointing out the issue about duplicate conversation IDs being generated.
This was caused by a missing step in my custom audio processing logic in 04_cu_process_custom_data.py. Specifically, I missed extracting the conversation_id from the file name using:
conversation_id = file_name.split('convo_', 1)[1].split('_')[0]

I’ve updated the code to include this logic.
In addition, I’ve synced the PR with the latest commits from upstream and validated the changes through testing. Everything is now working as expected.

Additionally, get_field_value() is used as a defensive approach to avoid a potential KeyError. When a WAV file does not include compliant content, CU processing will not generate the complaint field. In such cases, directly accessing fields['complaint']['valueString'] would fail.

Please refer to the screenshot for the results of my test:
790c41a57342cb0b1019eff93e727f55
e4a4b0fda156ae6d9962068683eaebfc

@Avijit-Microsoft Avijit-Microsoft merged commit 28688c5 into microsoft:main Jan 19, 2026
5 checks passed
@github-actions
Copy link
Contributor

🎉 This PR is included in version 3.17.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants