feat: create file/folder by new cl#1949
Conversation
|
Claude finished @231220075's task in 3m 43s —— View job Code Review
SummaryThis PR refactors The refactor is generally well-structured, but there are several correctness, robustness, and safety issues worth addressing. Issues Found1. Bug:
|
|
Claude finished @231220075's task in 2m 24s —— View job Code Review (Updated — Post-Synchronize)This review reflects the current state of the branch after the latest push. It checks which issues from the previous review were addressed and identifies any remaining concerns. Previous Issues — Status
Remaining Issues1. Save order still inconsistent:
|
Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn> fix entry_path Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn> fix save order Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
|
Claude finished @231220075's task in 2m 36s —— View job Code Review (Updated — Post-Synchronize)
Previous Issues — Status
Remaining Issues1. Remaining
|
There was a problem hiding this comment.
Pull request overview
This pull request restructures the file and folder creation process to align with the Change List (CL) workflow, making it consistent with the file editing flow. The main change is transitioning from directly applying updates to the main branch to creating commits through the CL system, which enables code review, build validation, and approval workflows for newly created files and directories.
Changes:
- Changed API response from returning just a commit ID string to a structured
CreateEntryResultwith commit ID, blob OID, file path, and CL link - Added
skip_buildandmodefields toCreateEntryInfoto control build triggering and CL reuse behavior - Extracted duplicate commit binding logic into a reusable
upsert_commit_bindinghelper function - Refactored
create_monorepo_entryto use the CL workflow pattern (similar tosave_file_edit) instead of directly applying updates to refs
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| mono/src/api/router/preview_router.rs | Extracted upsert_commit_binding helper and updated create_entry endpoint to return structured CreateEntryResult |
| ceres/src/model/git.rs | Added skip_build and mode fields to CreateEntryInfo; added CreateEntryResult struct; removed leading newline from commit messages |
| ceres/src/api_service/mono_api_service.rs | Refactored create_monorepo_entry to use CL workflow; extracted logic into prepare_create_entry_update helper; improved error handling with LazyLock regex and better validation |
| ceres/src/api_service/mod.rs | Updated trait signature to return CreateEntryResult instead of String |
| ceres/src/api_service/import_api_service.rs | Updated stub implementation to match new trait signature |
| request_body = CreateEntryInfo, | ||
| responses( | ||
| (status = 200, body = CommonResult<String>, content_type = "application/json") | ||
| (status = 200, body = CommonResult<CreateEntryResult>, content_type = "application/json") |
There was a problem hiding this comment.
The API response type has been changed from CommonResult<String> to CommonResult<CreateEntryResult>, but the frontend TypeScript types in moon/packages/types/generated.ts still expect CommonResultString. The frontend types need to be regenerated from the updated OpenAPI specs to include the new CreateEntryResult type and update the PostApiCreateEntryData type mapping. Without this, frontend code will have type mismatches and may break at runtime.
| /// if true, skip build | ||
| #[serde(default)] | ||
| pub skip_build: bool, | ||
| /// Controls how CL is created or reused for this change. | ||
| #[serde(default = "default_create_mode")] | ||
| pub mode: EditCLMode, |
There was a problem hiding this comment.
The CreateEntryInfo struct now includes skip_build and mode fields, but the frontend TypeScript types in moon/packages/types/generated.ts (lines 4080-4091) don't include these new fields. The frontend types need to be regenerated to match the updated backend schema. This could cause issues when frontend code tries to send these new optional fields.
| format!("create new directory {}", self.name) | ||
| } else { | ||
| format!("\n create new file {}", self.name) | ||
| format!("create new file {}", self.name) |
There was a problem hiding this comment.
The commit message format has changed from having a leading newline (e.g., "\n create new directory foo") to not having one ("create new directory foo"). Verify this change is intentional and won't affect any commit message parsing or formatting elsewhere in the codebase. Consider if this affects commit history readability or any automated tooling that processes commit messages.
Restructure the process of creating new files/folders, update files through cl method, similar to editing files.