Background
clone_repository_into_workspace in src/engine/connection/repository_clone/mod.rs re-validates repository owner/name segments, branch format, and workspace path — all invariants already enforced by RepositoryRef::parse, BranchName::parse, and WorkspacePath::parse in the API layer.
When callers pass pre-validated types, the engine validation is redundant. When callers construct RepositoryCloneRequest directly (which is possible since all fields are pub), the engine validation acts as defence in depth.
Required action
Decide on and document the validation strategy:
- Option A: Accept only pre-validated value objects in the engine (remove raw-string fields from
RepositoryCloneRequest, replace with &RepositoryRef, &BranchName, &WorkspacePath). Remove engine-layer validators.
- Option B: Keep both layers; document that the engine acts as a defence-in-depth guard. Remove the perceived duplication concern from CodeScene by adding an explanatory comment.
References
Background
clone_repository_into_workspaceinsrc/engine/connection/repository_clone/mod.rsre-validates repository owner/name segments, branch format, and workspace path — all invariants already enforced byRepositoryRef::parse,BranchName::parse, andWorkspacePath::parsein the API layer.When callers pass pre-validated types, the engine validation is redundant. When callers construct
RepositoryCloneRequestdirectly (which is possible since all fields arepub), the engine validation acts as defence in depth.Required action
Decide on and document the validation strategy:
RepositoryCloneRequest, replace with&RepositoryRef,&BranchName,&WorkspacePath). Remove engine-layer validators.References