PG1204 opened a new pull request, #6715:
URL: https://github.com/apache/texera/pull/6715

   ### What changes were proposed in this PR?
   Adds dedicated unit test coverage for ImageTaskCodegen, the TaskCodegen 
object that generates the Python payload/parse snippets for the Hugging Face 
image-pipeline task family (9 tasks spanning image-only, image+prompt, and 
zero-shot validation paths). This class previously had no direct test coverage.
   
   A new spec file, ImageTaskCodegenSpec.scala, was created in the same test 
package, mirroring the structure and patterns of TextGenCodegenSpec (shared 
makeCtx helper; assertions on snippet structure/markers rather than exact 
whitespace). It adds 10 tests covering:
   
   - task equals "image-classification"; tasks equals exactly the 9 
image-pipeline tasks
   - payloadPython sends raw image bytes for image-only tasks (payload = 
current_image_bytes, use_raw_binary_body = True)
   - VQA / document-QA payloads bundle a base64 image via 
self._image_input_as_base64(current_image_bytes) with "question": prompt_value
   - Zero-shot image classification raises ValueError when fewer than 2 
candidate labels are supplied parsePython extracts chat-style content, 
normalizes image-to-image URL responses through _url_to_data_url (including 
b64_json → data URL), and falls back to json.dumps(body)
   - Snippets never inline raw CodegenContext string values (no sentinel 
leakage)
   - Context-independence: identical output across two unrelated CodegenContext 
instances
   
   ### Any related issues, documentation, discussions?
   Closes #6250
   
   ### How was this PR tested?
   Added 10 unit tests in the new spec file, all passing via sbt:
   
   sbt "WorkflowOperator/testOnly 
org.apache.texera.amber.operator.huggingFace.codegen.ImageTaskCodegenSpec"
   
   [info] Tests: succeeded 10, failed 0, canceled 0, ignored 0, pending 0
   [info] All tests passed.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   Co-authored with Claude Opus 4.8 in compliance with ASF.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to