The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-6715-56d270dfc8e5797fd7b5c6ef43955cc7d7dbee2e
 has succeeded.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
1c13d6b8998a1799bc205f298da9f36fb4b64b71 / 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/29953105303

With regards,
GitHub Actions via GitBox

Reply via email to