feat(web): Create file / Modify file triggers CL creation#1963
Conversation
- 固定使用 `mode: 'force_create'` 强制创建新 CL - 保留 `skip_build` 选项供用户控制构建行为
|
Claude finished @juanlou1217's task in 2m 4s —— View job Code Review
SummaryThis PR simplifies the CL creation strategy by always using
|
| Area | Status |
|---|---|
| BlobEditor simplification | ✅ Clean |
| NewCodeView commit dialog | |
| Error handling | ✅ onError handler present in NewCodeView |
| Code style | Minor issues |
| Tests |
The BlobEditor.tsx change is ready. The critical issue is the commitMessage/commitDescription in NewCodeView.tsx being collected but never used — the API type CreateEntryInfo has no commit_message field. Either the fields should be removed from the dialog or the API should be extended to use them.
- 固定使用 `mode: 'force_create'` 强制创建新 CL - 保留 `skip_build` 选项供用户控制构建行为
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1da7dac0e1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| author_email: currentUser?.email, | ||
| author_username: currentUser?.username | ||
| author_username: currentUser?.username, | ||
| mode: 'force_create', | ||
| skip_build: skipBuild, | ||
| }, |
There was a problem hiding this comment.
Wire commit text into create-entry mutation
The new create dialog collects commitMessage and commitDescription, but handlerSubmit never sends either value in createEntryHook.mutate(...), so users’ entered commit text is ignored and create-entry commits still use the server-generated default message. Since submission is also gated by !commitMessage.trim(), users can be blocked by validation for a field that has no effect, which is a functional mismatch in the new flow.
Useful? React with 👍 / 👎.
|
Claude finished @juanlou1217's task in 1m 37s —— View job Code Review
SummaryThis PR simplifies CL creation to always use
|
| Area | Status |
|---|---|
| BlobEditor simplification | ✅ Clean |
| NewCodeView commit dialog | ❌ Bug — commit message silently discarded |
| API type alignment | ❌ CreateEntryInfo has no commit_message |
entryPath calculation |
|
Duplicate id attribute |
|
| Code style/naming | |
| Tests |
The BlobEditor.tsx changes are ready to merge. The blocking issue is NewCodeView.tsx: the dialog collects a commit message that is never used and gates submission on it being non-empty — this creates a confusing UX that should be resolved before merging (either by removing the field or extending the API to accept it).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4b7f837a4d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| is_directory: fileType === 'folder', | ||
| content: fileType === 'file' ? content : '', |
There was a problem hiding this comment.
Include dialog commit text in create-entry mutation
The new "Commit changes" dialog lets users edit commitMessage and commitDescription, but handlerSubmit never sends either value in the createEntryHook.mutate payload, so any custom text is silently ignored and the required commit-message input is effectively cosmetic. This affects every file/folder creation through this flow and is likely to confuse users who expect their entered message to be used.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR updates the web CodeView flows to ensure creating a new file/folder and modifying a file always forces creation of a new Change List (CL), while still allowing users to opt out of automatic builds via skip_build.
Changes:
- NewCodeView (create file/folder) now submits with
mode: 'force_create'and adds a commit dialog that includes askip_buildtoggle. - BlobEditor (edit existing file) now always uses
mode: 'force_create'and removes the “try reuse existing CL” UI/logic. - Keeps
skip_builduser control in both creation and modification flows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| moon/apps/web/components/CodeView/NewCodeView/NewCodeView.tsx | Adds commit dialog + skip_build UI and forces create-entry calls to use mode: 'force_create'. |
| moon/apps/web/components/CodeView/BlobView/BlobEditor.tsx | Removes CL reuse selection and forces blob updates to always create a new CL (mode: 'force_create'). |
| author_username: currentUser?.username, | ||
| mode: 'force_create', | ||
| skip_build: skipBuild | ||
| }, |
There was a problem hiding this comment.
The dialog collects commitMessage / commitDescription but handlerSubmit never sends them to postApiCreateEntry (CreateEntryInfo has no commit_message). This makes the UI misleading and also blocks submission when commitMessage is empty even though the backend won’t use it. Either extend the create-entry API/types to accept a commit message (and pass the combined message here), or remove these fields + the !commitMessage.trim() disable logic from the dialog.
| <div className='flex flex-col gap-2'> | ||
| <label className='text-sm font-medium text-gray-700'>Commit message *</label> | ||
| <input | ||
| type='text' | ||
| value={commitMessage} | ||
| onChange={(e) => setCommitMessage(e.target.value)} | ||
| placeholder={`Create ${name}`} | ||
| className='w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500' | ||
| disabled={createEntryHook.isPending} | ||
| /> | ||
| </div> | ||
|
|
||
| <div className='flex flex-col gap-2'> | ||
| <label className='text-sm font-medium text-gray-700'>Extended description (optional)</label> | ||
| <textarea | ||
| value={commitDescription} | ||
| onChange={(e) => setCommitDescription(e.target.value)} | ||
| placeholder='Add an optional extended description...' | ||
| rows={4} |
There was a problem hiding this comment.
The new dialog’s text inputs use plain <label> elements without htmlFor + matching id on the associated <input>/<textarea>, which hurts screen-reader and click-to-focus behavior. Add stable ids for the commit message / description fields and wire them via htmlFor.
|
Claude finished @juanlou1217's task in 1m 56s —— View job Code Review
SummaryThe latest commit ( What Was Fixed ✅All critical issues from prior reviews are resolved in this commit:
|
| Area | Status |
|---|---|
| Previous critical bug (commitMessage discarded) | ✅ Fixed |
| BlobEditor simplification | ✅ Clean |
htmlFor label associations |
❌ Broken in both files |
Error handling in handleSave |
|
| Duplicate query refetch | |
| Stale commented code | |
| Tests |
The main blocking issue is the htmlFor mismatch in both files — the label click-to-focus behavior is broken for the skip_build checkbox. Everything else is minor.
|
处理创建与编辑视图的id重复问题 |
|
|
||
| if (fileType === 'file') { | ||
| router.push(`/${scope}/code/blob/${version}${fullPath}`) | ||
| router.push(`/${scope}/code/blob/${version}${path}`) |
Check warning
Code scanning / CodeQL
Client-side URL redirect Medium
| router.push(`/${scope}/code/blob/${version}${path}`) | ||
| } else { | ||
| router.push(`/${scope}/code/tree/${version}${fullPath}`) | ||
| router.push(`/${scope}/code/tree/${version}${path}`) |
Check warning
Code scanning / CodeQL
Client-side URL redirect Medium
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c6a4c8072
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| { | ||
| name: name, | ||
| path: entryPath, | ||
| path: currentPath, |
There was a problem hiding this comment.
Use edited path when creating a new entry
handleSubmit now sends path: currentPath, which ignores any directory edits made in PathInput (that component explicitly supports nested input via /). When a user types something like subdir/new.ts, the mutation creates new.ts under the original currentPath instead of subdir, but success navigation still uses the edited path state, so the UI can redirect to a path that was never created.
Useful? React with 👍 / 👎.
mode: 'force_create'强制创建新 CLskip_build选项供用户控制构建行为