Skip to content

feat(frontend): add task-aware field visibility and preview to HuggingFace property editor#5568

Open
ELin2025 wants to merge 33 commits into
apache:mainfrom
ELin2025:hf/07-property-editor
Open

feat(frontend): add task-aware field visibility and preview to HuggingFace property editor#5568
ELin2025 wants to merge 33 commits into
apache:mainfrom
ELin2025:hf/07-property-editor

Conversation

@ELin2025

@ELin2025 ELin2025 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ This PR is stacked on #5567. Until that lands, the diff below may also include PR 6a/6b's task selector, model browser, and audio upload changes depending on which base GitHub is showing. The new code in this PR is the task-aware field visibility rules, task preview cards, and custom validators in operator-property-edit-frame.component.ts/.html/.scss, plus the test infrastructure (mockHuggingFaceSchema, mockHuggingFacePredicate) and 7 new spec tests. Once PR #5567 merges and this PR is retargeted to main, the diff should auto-clean to the PR 7 property-editor changes only.

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 6a/6b user-visible by mapping operator fields to custom field types in jsonSchemaMapIntercept.

Changes to operator-property-edit-frame.component.ts:

  • Map modelIdhuggingface formly type, imageInputhuggingface-image-upload, audioInputhuggingface-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
  • Task preview cards with sample media for 22 task types across 4 kinds (image, video, audio, text), plus a fallback for unknown tasks

Changes to test infrastructure:

  • mockHuggingFaceSchema in mock-operator-metadata.data.ts (added to mockOperatorSchemaList)
  • mockHuggingFacePredicate in mock-workflow-data.ts
  • 7 new spec tests covering task preview for known tasks (text, image, audio, video), unknown tasks (fallback), empty task, and non-HF operators

Any related issues, documentation, discussions?

How was this PR tested?

7 new spec tests added in operator-property-edit-frame.component.spec.ts:

  1. Non-HF operators return null task preview
  2. HF operator with text-generation returns text-kind preview with correct title
  3. Unknown task returns fallback text preview with formatted title
  4. image-classification returns image-kind preview
  5. text-to-speech returns audio-kind preview
  6. text-to-video returns video-kind preview
  7. Empty task returns null preview

Run with ng test.

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

Co-authored with Claude Opus 4.7

@github-actions github-actions Bot added frontend Changes related to the frontend GUI common labels Jun 8, 2026
@codecov-commenter

codecov-commenter commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.22388% with 501 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.62%. Comparing base (439ea72) to head (bdcd1c8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...e/component/hugging-face/hugging-face.component.ts 7.26% 267 Missing and 1 partial ⚠️
...component/hugging-face/hugging-face.component.html 0.00% 96 Missing ⚠️
...-frame/operator-property-edit-frame.component.html 3.84% 50 Missing ⚠️
...udio-upload/hugging-face-audio-upload.component.ts 44.44% 35 Missing and 5 partials ⚠️
...it-frame/operator-property-edit-frame.component.ts 71.28% 18 Missing and 11 partials ⚠️
...io-upload/hugging-face-audio-upload.component.html 28.00% 18 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5568      +/-   ##
============================================
- Coverage     54.09%   53.62%   -0.47%     
  Complexity     2817     2817              
============================================
  Files          1103     1108       +5     
  Lines         42650    43319     +669     
  Branches       4588     4715     +127     
============================================
+ Hits          23070    23229     +159     
- Misses        18236    18727     +491     
- Partials       1344     1363      +19     
Flag Coverage Δ *Carryforward flag
access-control-service 70.44% <ø> (ø)
agent-service 34.36% <ø> (ø) Carriedforward from c5f75b9
amber 55.63% <100.00%> (+0.01%) ⬆️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 57.35% <ø> (ø)
file-service 58.59% <ø> (ø)
frontend 47.16% <21.59%> (-0.94%) ⬇️
pyamber 90.20% <ø> (ø) Carriedforward from c5f75b9
python 90.76% <ø> (ø) Carriedforward from c5f75b9
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ELin2025

ELin2025 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @Ma77Ball

@Ma77Ball Ma77Ball left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left comments for review below.

@ELin2025 ELin2025 force-pushed the hf/07-property-editor branch from 553d90d to d1dc52a Compare June 11, 2026 23:38
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 0 better · 🔴 7 worse · ⚪ 8 noise (<±5%) · 0 without baseline

Compared against main 8803d08 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 546 0.333 17,499/25,560/25,560 us 🔴 -5.1% / 🟢 +32.9%
🔴 bs=100 sw=10 sl=64 1,117 0.682 83,957/207,433/207,433 us 🔴 +71.1% / 🔴 +48.4%
bs=1000 sw=10 sl=64 1,427 0.871 704,917/742,323/742,323 us ⚪ within ±5% / 🟢 +37.1%
Baseline details

Latest main 8803d08 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 546 tuples/sec 575 tuples/sec 410.82 tuples/sec -5.0% +32.9%
bs=10 sw=10 sl=64 MB/s 0.333 MB/s 0.351 MB/s 0.251 MB/s -5.1% +32.8%
bs=10 sw=10 sl=64 p50 17,499 us 17,282 us 23,785 us +1.3% -26.4%
bs=10 sw=10 sl=64 p95 25,560 us 25,456 us 34,980 us +0.4% -26.9%
bs=10 sw=10 sl=64 p99 25,560 us 25,456 us 34,980 us +0.4% -26.9%
bs=100 sw=10 sl=64 throughput 1,117 tuples/sec 1,204 tuples/sec 891.94 tuples/sec -7.2% +25.2%
bs=100 sw=10 sl=64 MB/s 0.682 MB/s 0.735 MB/s 0.544 MB/s -7.2% +25.3%
bs=100 sw=10 sl=64 p50 83,957 us 79,032 us 112,277 us +6.2% -25.2%
bs=100 sw=10 sl=64 p95 207,433 us 121,252 us 139,802 us +71.1% +48.4%
bs=100 sw=10 sl=64 p99 207,433 us 121,252 us 139,802 us +71.1% +48.4%
bs=1000 sw=10 sl=64 throughput 1,427 tuples/sec 1,437 tuples/sec 1,041 tuples/sec -0.7% +37.1%
bs=1000 sw=10 sl=64 MB/s 0.871 MB/s 0.877 MB/s 0.635 MB/s -0.7% +37.1%
bs=1000 sw=10 sl=64 p50 704,917 us 692,696 us 972,714 us +1.8% -27.5%
bs=1000 sw=10 sl=64 p95 742,323 us 725,950 us 1,023,057 us +2.3% -27.4%
bs=1000 sw=10 sl=64 p99 742,323 us 725,950 us 1,023,057 us +2.3% -27.4%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,366.34,200,128000,546,0.333,17499.00,25559.72,25559.72
1,100,10,64,20,1790.93,2000,1280000,1117,0.682,83956.62,207433.22,207433.22
2,1000,10,64,20,14013.20,20000,12800000,1427,0.871,704917.08,742322.75,742322.75

@ELin2025 ELin2025 force-pushed the hf/07-property-editor branch 3 times, most recently from eafce6d to c009c34 Compare June 12, 2026 00:09
@ELin2025 ELin2025 requested a review from Ma77Ball June 15, 2026 00:52
@ELin2025 ELin2025 force-pushed the hf/07-property-editor branch 2 times, most recently from 7d88b62 to 1bf97cb Compare June 16, 2026 18:08
@github-actions github-actions Bot added engine dependencies Pull requests that update a dependency file pyamber ci changes related to CI docs Changes related to documentations dev platform Non-amber Scala service paths agent-service labels Jun 16, 2026
@ELin2025 ELin2025 force-pushed the hf/07-property-editor branch from 1bf97cb to 5f3afac Compare June 16, 2026 18:14
@github-actions github-actions Bot removed engine dependencies Pull requests that update a dependency file pyamber ci changes related to CI docs Changes related to documentations dev labels Jun 16, 2026
ELin2025 and others added 27 commits June 23, 2026 09:31
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mponent

Satisfies the rxjs-angular/prefer-takeuntil lint rule.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…mponent

Fix setInterval/setTimeout leaks by tracking timer IDs and clearing them
in ngOnDestroy. Remove takeUntil(destroy$) from shared module-level task
fetch to prevent cache poisoning when the initiating component is destroyed.
Remove unused TASK_TAG_MAP and TASK_NAMES exports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…FaceComponent

inFlightByTag was written but never read, so multiple component instances
mounting for the same uncached task would each fire a full backend request.
Add an in-flight guard that polls for the existing request's completion,
matching the pattern already used for task fetches.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… in HuggingFaceComponent

Read X-Texera-Truncated header via { observe: "response" } to detect
when the backend's model list is incomplete. Show a notice prompting
users to search. When truncated, search queries are sent to the backend
search endpoint with debounce; otherwise local filtering is used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…r lint rule

Add back destroy$ and takeUntil(this.destroy$) on all subscribe calls.
For the shared task fetch, add finalize() to reset tasksFetchSubscription
when takeUntil fires before next/error, preventing the stale-guard bug
the reviewer originally flagged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…anup

Mirror the defensive pattern from the tasks fetch so that when
takeUntil(destroy$) cancels mid-flight, inFlightByTag is cleared
and subsequent component instances can re-fetch instead of polling
forever.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Elliot Lin <36275109+ELin2025@users.noreply.github.com>
- Fix model polling indefinite loop by detecting cancelled in-flight fetch
- Fix CSS class mismatch: hf-tasks-error → hf-error to match SCSS
- Remove unused imports in spec file

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Catch HTTP errors inside switchMap so search stream survives failures
- Use empty string instead of null when clearing model selection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register the huggingface-audio-upload formly field type and declare
HuggingFaceAudioUploadComponent in AppModule. Handles server-side audio
storage via the /huggingface/upload-audio endpoint with local preview.

Co-Authored-By: Anish Shivamurthy <anish@uci.edu>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… upload component

Add early return in onFileSelected when isUploading is true to prevent
race conditions from concurrent file selections. Remove the second spec
test that had a dead metadata variable and duplicated the first test's
assertion.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ponent

Add meaningful tests: reject non-audio files, successful upload sets
formControl value, and concurrent upload guard prevents race conditions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use preview URL as a token to detect if the user cleared during an
in-flight upload and discard the stale response.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gFace property editor

Show/hide operator fields based on the selected HuggingFace task (e.g.,
imageInput only for image tasks, contextColumn only for question-answering).
Adds task preview cards with media samples per task kind (image/video/audio/text),
custom validators for required inputs, and ~13 field visibility rules inside
the formly jsonSchemaMapIntercept.

Co-Authored-By: Anish Shivamurthy <anish@uci.edu>
Add mockHuggingFaceSchema and mockHuggingFacePredicate to test infrastructure.
Add 7 spec tests covering huggingFaceTaskPreview for known tasks (text, image,
audio, video), unknown tasks (fallback), empty tasks, and non-HF operators.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ew sample

Fix inverted fallback for systemPrompt/maxNewTokens/temperature: these
fields now correctly hide when no task is selected, matching the behavior
of all other HuggingFace fields. Add missing image-text-to-text entry to
huggingFaceTaskPreviewSamples so it no longer falls through to the
generic text fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add sample-video.mp4 and sample-audio.wav for task preview cards
- Check hasOperator() before getOperator() in isHuggingFaceOperator()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lassification

Prefer self.CANDIDATE_LABELS over prompt column for candidate labels,
with fallback to prompt_value for backward compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover hide expressions for imageInput, audioInput, promptColumn,
systemPrompt, contextColumn, and candidateLabels across task types.
Also test requiredPromptColumn, requiredImageInput, and
requiredAudioInput validators pass/fail for relevant tasks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ELin2025 ELin2025 force-pushed the hf/07-property-editor branch from 57f7306 to bdcd1c8 Compare June 23, 2026 16:33
@github-actions github-actions Bot removed the engine label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @anishshiva7, @rbelavadi, @PG1204
    You can notify them by mentioning @anishshiva7, @rbelavadi, @PG1204 in a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common frontend Changes related to the frontend GUI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add task-aware field visibility and preview to HuggingFace property editor

5 participants