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

Head commit for run:
dce6cf196f5a9336ffee13c9126a908f097e7a92 / Tanishq Gandhi 
<[email protected]>
fix(file-service): return 404 for another dataset's version and 400 for a 
missing upload type (#9099)

### What changes were proposed in this PR?

Two dataset endpoints skipped input checks the model endpoints already
make, so bad input produced a 500:

1. **A version from another dataset.** The version file-list endpoints
(owner and public) and `versionZip` checked access on `did` but loaded
version `dvid` without checking it belongs to `did`.
`getDatasetVersionByID` now filters on `did` as well, like
`getModelVersionByID`, so a version from another dataset returns 404.
2. **No `type` on multipart upload.** `POST /dataset/multipart-upload`
called `toLowerCase` on a missing `type`. The model endpoint's check is
now a shared `ResourceUploadService.multipartOperationOrThrow`, used by
both, which returns 400 for a missing or unknown `type`.

```
                                                                    before   
after
GET  /dataset/215/publicVersion/16/rootFileNodes   (16 belongs to 216)   500    
  404
GET  /dataset/215/publicVersion/15/rootFileNodes   (its own version)     200    
  200
POST /dataset/multipart-upload  (no type)                                500    
  400
```

### Any related issues, documentation, discussions?

Closes #9098

### How was this PR tested?

Added three cases to `DatasetResourceSpec`: another dataset's version
returns 404 from the public and owner file-list endpoints and from
`versionZip`, and a missing `type` returns 400. All fail without the
fix.

```
sbt "FileService/testOnly *DatasetResourceSpec *ModelResourceSpec 
*ModelUploadResourceSpec"
# Tests: succeeded 197, failed 0
```

Also checked against a local stack with `curl` (table above).

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

Generated-by: Claude Code (Claude Opus 5.5)

Co-authored-by: Meng Wang <[email protected]>

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

With regards,
GitHub Actions via GitBox

Reply via email to