aglinxinyuan opened a new issue, #6252:
URL: https://github.com/apache/texera/issues/6252

   ### Task Summary
   
   Add a dedicated `MediaGenCodegenSpec.scala` that pins the payload/parse 
Python-snippet contract of `MediaGenCodegen` — the Hugging Face codegen for 
prompt-driven media generation (text-to-image / text-to-video). Mirror the 
existing `TextGenCodegenSpec` (same package) as the template.
   
   ## Background
   
   `MediaGenCodegen` 
(`common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/MediaGenCodegen.scala`)
 is an `object extends TaskCodegen` and the simplest of the family. The payload 
is a static `{"inputs": prompt_value}`; the parse snippet normalizes the 
several provider response shapes (raw bytes, OpenAI-style `b64_json`, or URLs) 
to a stable data-URL string via the shared `_url_to_data_url` helper.
   
   ```scala
   override val task: String = "text-to-image"
   override val tasks: Set[String] = Set("text-to-image", "text-to-video")
   ```
   
   ## Behavior to pin
   
   | Member | Contract |
   | --- | --- |
   | `task` | equals `"text-to-image"` |
   | `tasks` | equals exactly `Set("text-to-image", "text-to-video")` |
   | `payloadPython` | emits the static `payload = {"inputs": prompt_value}` |
   | `parsePython` | has distinct `text-to-image` and `text-to-video` branches; 
both route http URLs through `self._url_to_data_url` and fall back to 
`json.dumps(body)`; the image branch also handles `b64_json` |
   | context-independence | payload/parse reference only `self.*` / static text 
— two `CodegenContext`s with different user values (task fixed) produce 
byte-identical output (mirror `TextGenCodegenSpec`'s "identical output 
regardless of context" test) |
   | no raw-value leakage | with sentinel `CodegenContext` fields, neither 
snippet contains the sentinel |
   
   Build the `CodegenContext` with a `makeCtx` helper as in 
`TextGenCodegenSpec`. Assert on snippet structure / marker substrings, not 
exact whitespace.
   
   ## Scope
   
   - New spec: `MediaGenCodegenSpec.scala` under 
`common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/codegen/`.
   - No production-code changes.
   
   ### Task Type
   
   - [ ] Refactor / Cleanup
   - [ ] DevOps / Deployment / CI
   - [x] Testing / QA
   - [ ] Documentation
   - [ ] Performance
   - [ ] Other
   


-- 
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