fix(server): return already_exists for duplicate sandbox names#695
Open
fix(server): return already_exists for duplicate sandbox names#695
Conversation
Check for existing sandbox name before persisting, matching the provider-creation pattern. The CLI now surfaces a clear hint instead of a raw UNIQUE constraint error. Closes #691
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Return a proper
AlreadyExistsgRPC status when creating a sandbox with a duplicate name, instead of leaking a raw SQLiteUNIQUE constraint failederror as anInternalstatus.Related Issue
Closes #691
Changes
crates/openshell-server/src/grpc.rs: Added aget_message_by_name::<Sandbox>pre-check beforeput_messageincreate_sandbox, following the identical pattern used bycreate_provider. ReturnsStatus::already_exists("sandbox '<name>' already exists")when a duplicate is found.crates/openshell-cli/src/run.rs: HandleAlreadyExistsstatus in the sandbox create path to show a user-friendly message with a hint to delete or rename.e2e/python/test_inference_routing.py: Removed the workaround that matchedINTERNALstatus with"UNIQUE constraint failed"in the error string—now onlyALREADY_EXISTSis needed.Testing
mise run pre-commitpassescargo test --workspace)Checklist