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

Head commit for run:
e9b208ada375a435b7f346851290a07d6ca5e51a / Elliot Lin 
<[email protected]>
feat(frontend): add task-aware field visibility and preview to HuggingFace 
property editor (#5568)

### What changes were proposed in this PR?

Wire up the HuggingFace operator's property editor so that selecting a
task dynamically controls which fields are visible and shows a media
preview card. This is the PR that makes the formly components from PRs
#5566/ #5567 user-visible by mapping operator fields to custom field
types in `jsonSchemaMapIntercept`.

Changes to `operator-property-edit-frame.component.ts`:
- Map `modelId` → `huggingface` formly type, `imageInput` →
`huggingface-image-upload`, `audioInput` → `huggingface-audio-upload`
- Hide the `task` field (it is controlled by the HuggingFaceComponent's
task dropdown instead)
- ~13 field visibility rules via formly expressions that show/hide
fields based on the selected task (e.g., `imageInput` only for image
tasks, `contextColumn` only for question-answering,
`systemPrompt`/`maxNewTokens`/`temperature` only for text-generation)
- 3 custom validators: `requiredImageInput`, `requiredAudioInput`,
`requiredPromptColumn` — each checks whether the direct input or the
corresponding column selector is filled
- Removed `validation: { show: true }` from imageInput, audioInput, and
promptColumn so errors only appear after the field is touched, not on a
freshly-added operator
- Added `image-to-video` to `imageInputTasks` so the image input field
appears for that task
- Task preview cards with sample media for 22 task types across 4 kinds
(image, video, audio, text), plus a fallback for unknown tasks
(sample-video.mp4 and sample-audio.wav are self-created)
- Operator description truncation — clamps to 3 lines with CSS and adds
a tooltip for the full text on hover

Changes to test infrastructure:
- `mockHuggingFaceSchema` in `mock-operator-metadata.data.ts` (added to
`mockOperatorSchemaList`)
- `mockHuggingFacePredicate` in `mock-workflow-data.ts`

### Any related issues, documentation, discussions?

- Tracking issue: #5316
- Closes: #5316 
- Stacked on: #5567
- Parent issue: #5041

### How was this PR tested?

**`operator-property-edit-frame.component.spec.ts`** — 123 new tests
- **Task preview**: all 20+ tasks (text-generation,
image-classification, text-to-speech, text-to-video, ASR,
image-to-image, object-detection, image-segmentation, image-to-text,
document-question-answering, zero-shot-image-classification,
image-text-to-text, sentence-similarity, text-ranking, translation,
summarization, text-classification, token-classification,
table-question-answering, feature-extraction, fill-mask), unknown task
fallback, empty/whitespace task, non-HF operator, deleted operator
guard, preview content validation (assetSrc, pills, outputBody)
- **Field type assignments**: `modelId` → `huggingface`, `imageInput` →
`huggingface-image-upload`, `audioInput` → `huggingface-audio-upload`
- **Field visibility**: imageInput, audioInput, inputImageColumn,
inputAudioColumn, promptColumn, contextColumn, candidateLabels,
sentencesColumn, systemPrompt, maxNewTokens, temperature — tested across
15+ tasks including mixed-input tasks (visual-question-answering,
document-question-answering, image-text-to-text) and media-generation
tasks (text-to-image, text-to-speech)
- **Undefined task visibility**: all 11 fields hide when no task is
selected
- **Validators**: requiredPromptColumn, requiredImageInput,
requiredAudioInput — pass/fail for empty, whitespace, model values,
formControl values, inputColumn alternatives,
zero-shot-image-classification edge cases, error message strings
- **getSelectedTask fallback**: model.task → form.get →
formControl.parent chain
- **Operator description**: tooltip rendering, hidden when unset
- **Task field hidden for HF operators**

**`hugging-face-image-upload.component.spec.ts`** — 27 new tests
- **Successful upload**: happy path (fileName, formControl, model,
dirty/touched), clears prior error
- **Compression pipeline**: FileReader error, ArrayBuffer result, null
result, Image onerror, null canvas context, quality reduction, dimension
reduction, never fits, non-image toDataURL, 1x1 pixel, extreme aspect
ratio
- **clearImage edge cases**: non-string key guard, dirty/touched
- **Consecutive uploads**: second upload replaces first

**`hugging-face.component.spec.ts`** — 11 new tests
- **Pagination edge cases**: prevPage at page 0, goToPage on empty list
- **Task state snapshots**: defaults on first visit to new task,
preserve across switches
- **Server search edge cases**: error handling, query superseding
- **getCurrentTaskTag / model selection / retryLoad** edge cases

**`hugging-face-audio-upload.component.spec.ts`** — 7 new tests
- **formControl state**: dirty/touched after upload and clear
- **Model update**: non-string key skips model write
- **previewSrc edge cases**: non-audio data URL, alternate audio MIME
type
- **Consecutive uploads**: replacement
- **revokePreviewUrl**: no throw without preview

Run with `ng test`.

### Was this PR authored or co-authored using generative AI tooling?

Co-authored with Claude Opus 4.6

---------

Co-authored-by: Elliot <[email protected]>
Co-authored-by: Anish Shivamurthy <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>

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

With regards,
GitHub Actions via GitBox

Reply via email to