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

   ### What changes were proposed in this PR?
   
   `createDataset` created the dataset's LakeFS repository before checking its 
contributors. An invalid contributor (missing name, invalid or duplicate email, 
a field over 256 characters) correctly failed with 400, and the transaction 
rolled back the dataset row, but the `dataset-<did>` repository stayed in 
LakeFS with nothing pointing to it.
   
   - **Validate first**: the contributor checks move out of 
`insertContributors` into `DatasetResource.validateContributors`, which 
`createDataset` now runs right after the name checks, before any row or 
repository exists. `insertContributors` still runs them, so updating 
contributors is unchanged.
   - **Roll back on later failures**: new 
`LakeFSStorageClient.withRepoRollback(repoName) { ... }` runs the steps after 
the repository is created and deletes the repository if they fail, rethrowing 
the original error (a failed delete is attached as suppressed). `createDataset` 
and `createModel` both use it.
   
   Before / after on a local stack, same request with `"email": "not-an-email"`:
   
   | | Response | LakeFS `dataset-*` repositories |
   |---|---|---|
   | Before | 400 `Invalid contributor email: not-an-email` | 46 → 47 
(`dataset-218`, no dataset row) |
   | After | 400 `Invalid contributor email: not-an-email` | 47 → 47 |
   
   ### Any related issues, documentation, discussions?
   
   Closes #9335.
   
   ### How was this PR tested?
   
   - `DatasetResourceSpec`: an invalid contributor consumes no dataset id, and 
the `dataset-<id>` name the old order created is still free in LakeFS. It fails 
with the early validation removed.
   - `LakeFSStorageClientSpec` (stub server): `withRepoRollback` sends nothing 
on success, deletes the repository and rethrows on failure, and still rethrows 
the original failure when the delete fails.
   - `DatasetResourceSpec` (163), `ModelResourceSpec` (22) and 
`LakeFSStorageClientSpec` (31) pass; `scalafmtCheckAll` and `scalafixAll 
--check` are clean.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   


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