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:
adc6a4ac4d79f0302534228d119ea2c22f393db7 / Kunwoo (Chris) 
<[email protected]>
fix(file-service, frontend): reject slash in version names (#8883)

### What changes were proposed in this PR?

Root cause. `createDatasetVersion` names a version `v{N} -
{description}` from whatever the user typed, and the UI accepted a `/`.
The version name is one segment of the logical path
`/<prefix>/owner/resource/version/file`, and
`FileResolver.parsePrefixedPath` splits that path on `/`. For the path
in the issue, `/texera/bughunt-version-name/v3 - //file_name.png`, the
version becomes `v3 - ` and `/file_name.png` becomes the file path, so
the version lookup misses and `presign-download` returns a 500.
`createModelVersion` builds its name the same way, so model versions
have the same problem.

Fix. `ResourceNaming.validateVersionDescription` rejects a description
containing `/` with a 400. `createDatasetVersion` and
`createModelVersion` call it right after the write-access check, before
the LakeFS commit, so the staged files stay staged and the user can fix
the description and retry. The version uploader, which datasets and
models both use, shows the error under the input and disables Submit,
and `Enter` no longer submits either.

```
Before:  description "/"  ->  version "v3 - /"  ->  every file in it fails with 
presign-download 500
After:   description "/"  ->  400 "Invalid version description"  (UI: inline 
error, Submit disabled)
```

Not included. Versions already stored with a `/` in their name stay
unopenable, and repairing them needs a data migration. A `%` or `+` in a
name has a separate problem, because `resolveVersionedFile` URL-decodes
`filePath` a second time.

### Any related issues, documentation, discussions?

Closes #8882

### How was this PR tested?

Tests were added for the validator, for both resources, and for the
version uploader, and they were written first and failed against the old
code.

```
sbt "FileService/testOnly org.apache.texera.service.resource.ResourceNamingSpec 
org.apache.texera.service.resource.DatasetResourceSpec 
org.apache.texera.service.resource.ModelUploadResourceSpec"
cd frontend && yarn ng test --watch=false 
--include='**/version-uploader.component.spec.ts'
```

The first command passes 177 tests and the second passes 73.
`scalafixAll`, `scalafmtAll`, `prettier-eslint` and `eslint` ran clean
on the changed files.


https://github.com/user-attachments/assets/8c7bb472-b845-4bed-9b51-da38ef3b3397

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

Generated-by: Claude Code, Claude Sonnet 5.5

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

With regards,
GitHub Actions via GitBox

Reply via email to