PG1204 opened a new pull request, #7474:
URL: https://github.com/apache/texera/pull/7474

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


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