Skip to content

fix(workflow-operator): accept single-segment HF model IDs and reject '..' in the model-id check - #7474

Open
PG1204 wants to merge 1 commit into
apache:mainfrom
PG1204:fix/hf-model-id-validation
Open

fix(workflow-operator): accept single-segment HF model IDs and reject '..' in the model-id check#7474
PG1204 wants to merge 1 commit into
apache:mainfrom
PG1204:fix/hf-model-id-validation

Conversation

@PG1204

@PG1204 PG1204 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

The generated model-ID validation regex (_HF_MODEL_ID_PATTERN) had two problems:

  1. It let .. path-traversal segments through: e.g. org/.. passed, even though the comment claimed .. was rejected (the character class allowed dots, so .. was a valid segment).
  2. It rejected legacy single-segment model IDs like gpt2 and bert-base-uncased, because it required at least one /.

This adds a (?!.*\.\.) lookahead to reject any .., and makes the trailing /segment group optional so single-segment IDs are accepted. The comment and the "Invalid Hugging Face model ID" error message are updated to match.

Any related issues?

Closes #7196

How was this PR tested?

  • Existing HuggingFace operator unit tests + the PythonCodeRawInvalidTextSpec py-compile guard (confirms the new regex is valid Python).
  • Extended the existing MODEL_ID spec test to assert the lookahead and the now-optional segment group are emitted.
  • Behavioral check of the emitted regex: gpt2, bert-base-uncased, t5-small, org/model, org/model/revision are accepted; org/.., org/../secret, .. are rejected.

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

This PR was co-authored with Claude in compliance with ASF policy.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
⚠️ release/v1.2 Not labeled automatically — none of the files this PR modifies exist on this branch (common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/huggingFace/codegen/HuggingFaceCodegenBase.scala, common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/huggingFace/HuggingFaceInferenceOpDescSpec.scala). The fix may target code that isn't on this release, or the files were moved/renamed after the branch was cut. Please check and add release/v1.2 by hand if this fix should be backported here.

Auto-label run.

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

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

  • No candidates found from git blame history.

@codecov-commenter

codecov-commenter commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.44%. Comparing base (114a610) to head (5250983).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7474   +/-   ##
=========================================
  Coverage     85.43%   85.44%           
  Complexity     4150     4150           
=========================================
  Files          1169     1169           
  Lines         46740    46740           
  Branches       5202     5202           
=========================================
+ Hits          39934    39935    +1     
+ Misses         5092     5091    -1     
  Partials       1714     1714           
Flag Coverage Δ *Carryforward flag
access-control-service 70.00% <ø> (ø)
agent-service 85.50% <ø> (ø) Carriedforward from 114a610
amber 80.88% <ø> (+<0.01%) ⬆️
computing-unit-managing-service 50.72% <ø> (ø)
config-service 65.97% <ø> (ø)
file-service 69.05% <ø> (ø)
frontend 88.11% <ø> (ø) Carriedforward from 114a610
notebook-migration-service 78.89% <ø> (ø)
pyamber 97.51% <ø> (ø) Carriedforward from 114a610
workflow-compiling-service 26.31% <ø> (ø)

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

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

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

Compared against main 114a610 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 413 0.252 24,144/30,027/30,027 us 🔴 +23.6% / 🔴 +83.9%
🟢 bs=100 sw=10 sl=64 922 0.563 106,429/132,653/132,653 us 🟢 -16.6% / 🔴 +17.9%
🔴 bs=1000 sw=10 sl=64 1,094 0.668 909,478/1,119,366/1,119,366 us 🔴 +12.5% / 🟢 +12.6%
Baseline details

Latest main 114a610 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 413 tuples/sec 464 tuples/sec 743.73 tuples/sec -11.0% -44.5%
bs=10 sw=10 sl=64 MB/s 0.252 MB/s 0.283 MB/s 0.454 MB/s -11.0% -44.5%
bs=10 sw=10 sl=64 p50 24,144 us 19,536 us 13,130 us +23.6% +83.9%
bs=10 sw=10 sl=64 p95 30,027 us 31,677 us 16,391 us -5.2% +83.2%
bs=10 sw=10 sl=64 p99 30,027 us 31,677 us 19,408 us -5.2% +54.7%
bs=100 sw=10 sl=64 throughput 922 tuples/sec 944 tuples/sec 944.04 tuples/sec -2.3% -2.3%
bs=100 sw=10 sl=64 MB/s 0.563 MB/s 0.576 MB/s 0.576 MB/s -2.3% -2.3%
bs=100 sw=10 sl=64 p50 106,429 us 104,068 us 105,853 us +2.3% +0.5%
bs=100 sw=10 sl=64 p95 132,653 us 159,118 us 112,493 us -16.6% +17.9%
bs=100 sw=10 sl=64 p99 132,653 us 159,118 us 122,200 us -16.6% +8.6%
bs=1000 sw=10 sl=64 throughput 1,094 tuples/sec 1,107 tuples/sec 972.22 tuples/sec -1.2% +12.5%
bs=1000 sw=10 sl=64 MB/s 0.668 MB/s 0.675 MB/s 0.593 MB/s -1.0% +12.6%
bs=1000 sw=10 sl=64 p50 909,478 us 897,538 us 1,033,856 us +1.3% -12.0%
bs=1000 sw=10 sl=64 p95 1,119,366 us 995,243 us 1,076,083 us +12.5% +4.0%
bs=1000 sw=10 sl=64 p99 1,119,366 us 995,243 us 1,107,701 us +12.5% +1.1%
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,484.01,200,128000,413,0.252,24143.96,30026.51,30026.51
1,100,10,64,20,2168.50,2000,1280000,922,0.563,106429.14,132652.83,132652.83
2,1000,10,64,20,18280.78,20000,12800000,1094,0.668,909478.14,1119365.54,1119365.54

@PG1204

PG1204 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

/request-review @xuang7

@github-actions
github-actions Bot requested a review from xuang7 August 9, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HuggingFace inference operator: model-ID regex allows '..' segments and rejects valid single-segment IDs

2 participants