The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
bf1f5897bed98a8d6f4adce554c4924553ce6e95 / Prateek Ganigi 
<[email protected]>
test(workflow-operator): add unit tests for ImageTaskCodegen (#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.

Report URL: https://github.com/apache/texera/actions/runs/29956719704

With regards,
GitHub Actions via GitBox

Reply via email to