Skip to content

Consolidate repository-cloning validation: trust API-layer types in the engine #103

Description

@coderabbitai

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions