Skip to content

Conversation

@levscaut
Copy link
Contributor

@levscaut levscaut commented Jan 14, 2026

Related Issues/PRs

N/A

What changes are proposed in this pull request?

This PR adds file validation parameters to OpenAIPrompt and improves error handling for file preparation:

  1. Graceful error handling for file preparation: Instead of failing the entire process when a file cannot be read (e.g., file not found), errors are now captured in errorCol with null in outputCol, allowing other rows to process normally.

  2. File size limit (setFileSizeLimitMB): New parameter to restrict maximum file size in megabytes. Files exceeding this limit produce an error in errorCol.

  3. SimpleHTTPTransformer enhancement: Modified to preserve existing errorCol values using coalesce, enabling upstream error propagation.

How is this patch tested?

  • I have written tests (not required for typo or doc fix) and confirmed the proposed feature/bug-fix/change works.

New test cases added:

  • file preparation error stores error in errorCol instead of failing
  • file size limit produces error when exceeded

Does this PR change any dependencies?

  • No. You can skip this section.

@github-actions
Copy link

Hey @levscaut 👋!
Thank you so much for contributing to our repository 🙌.
Someone from SynapseML Team will be reviewing this pull request soon.

We use semantic commit messages to streamline the release process.
Before your pull request can be merged, you should make sure your first commit and PR title start with a semantic prefix.
This helps us to create release messages and credit you for your hard work!

Examples of commit messages with semantic prefixes:

  • fix: Fix LightGBM crashes with empty partitions
  • feat: Make HTTP on Spark back-offs configurable
  • docs: Update Spark Serving usage
  • build: Add codecov support
  • perf: improve LightGBM memory usage
  • refactor: make python code generation rely on classes
  • style: Remove nulls from CNTKModel
  • test: Add test coverage for CNTKModel

To test your commit locally, please follow our guild on building from source.
Check out the developer guide for additional guidance on testing your change.

@levscaut levscaut requested a review from BrendanWalsh January 14, 2026 19:28
@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances file validation in OpenAIPrompt by adding configurable size and extension limits with graceful error handling for file preparation failures.

Changes:

  • Added file size limit parameter (fileSizeLimitMB) to restrict maximum file sizes
  • Added valid file extensions parameter (validFileExtensions) to restrict allowed file types
  • Modified error handling to capture file preparation errors in errorCol instead of failing the entire process
  • Enhanced SimpleHTTPTransformer to preserve upstream errors using coalesce

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIPrompt.scala Added file validation parameters and improved error handling for file operations
cognitive/src/test/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIPromptSuite.scala Added comprehensive tests for new validation features and error handling
core/src/main/scala/com/microsoft/azure/synapse/ml/io/http/SimpleHTTPTransformer.scala Modified to preserve existing errors from upstream transformations
Comments suppressed due to low confidence (1)

cognitive/src/main/scala/com/microsoft/azure/synapse/ml/services/openai/OpenAIPrompt.scala:255

  • The localParamNames sequence is missing the newly added parameters fileSizeLimitMB and validFileExtensions. These should be included if they are meant to be local parameters that are not passed to the underlying services.
  private val localParamNames = Seq(
    "promptTemplate", "outputCol", "postProcessing", "postProcessingOptions", "dropPrompt", "dropMessages",
    "systemPrompt", "apiType", "usageCol", "responseIdCol")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@codecov-commenter
Copy link

codecov-commenter commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 91.11111% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.44%. Comparing base (1405a37) to head (fb8371c).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...zure/synapse/ml/services/openai/OpenAIPrompt.scala 89.47% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2464      +/-   ##
==========================================
+ Coverage   84.42%   84.44%   +0.01%     
==========================================
  Files         335      335              
  Lines       17750    17782      +32     
  Branches     1622     1579      -43     
==========================================
+ Hits        14986    15016      +30     
- Misses       2764     2766       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut levscaut changed the title chore: Add argument to limit file sizes and types chore: Add argument to limit file size Jan 14, 2026
@levscaut levscaut changed the title chore: Add argument to limit file size chore: Add argument to limit file size, put file error to errorCol Jan 14, 2026
@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut levscaut enabled auto-merge (squash) January 15, 2026 22:13
@levscaut levscaut requested a review from smamindl January 16, 2026 18:18
@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@levscaut
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@ranadeepsingh ranadeepsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for looking at the feedback!

@levscaut levscaut merged commit 7a3b27c into microsoft:master Jan 16, 2026
68 of 69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants