Skip to content

Feat/commit user binding#1434

Merged
benjamin-747 merged 12 commits into
gitmono-dev:mainfrom
231220075:feat/commit-user-binding
Sep 11, 2025
Merged

Feat/commit user binding#1434
benjamin-747 merged 12 commits into
gitmono-dev:mainfrom
231220075:feat/commit-user-binding

Conversation

@231220075

Copy link
Copy Markdown
Contributor

Addition: merge GET commit-binding API into GET latest-commit API

  • Add CommitBindingInfo to LatestCommitInfo response structure.
  • Move GET functionality from commit binding endpoint to latest-commit.
  • Simplify commit binding router to focus on PUT operations only.

231220075 and others added 7 commits September 8, 2025 11:29
…st version)

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>

feat(commit-message-binding):finish binding commit-message to user (2st version)

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>

feat: implement commit-user binding

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
…ev#1409)

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
Signed-off-by: Ruizhi Huang <166112492+231220075@users.noreply.github.com>
Signed-off-by: Ruizhi Huang <166112492+231220075@users.noreply.github.com>
…ev#1409)

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>

fix bugs in ceres/src/protocol/smart.rs

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
@vercel

vercel Bot commented Sep 11, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
mega Ready Ready Preview Comment Sep 11, 2025 11:30am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR consolidates commit binding functionality by merging the GET commit-binding API into the GET latest-commit API and simplifying the commit router to handle only PUT operations.

Key changes:

  • Added CommitBindingInfo to LatestCommitInfo response structure
  • Moved GET commit binding functionality from dedicated endpoint to latest-commit endpoint
  • Removed GET route from commit router, keeping only PUT operations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
mono/src/api/commit/commit_router.rs Removed GET endpoint and its implementation, simplified router to PUT operations only
mono/src/api/api_router.rs Enhanced get_latest_commit to include commit binding information in response
docs/api.md Updated documentation to reflect removal of GET commit binding endpoint
ceres/src/model/git.rs Added CommitBindingInfo struct and integrated it into LatestCommitInfo

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread mono/src/api/commit/commit_router.rs Outdated
request.is_anonymous,
).await
.map_err(|e| ApiError::from(anyhow::anyhow!("Failed to update binding: {}", e)))?;

Copilot AI Sep 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing whitespace on line 81.

Suggested change

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/commit/commit_router.rs Outdated
get_commit_binding(State(state), Path(sha)).await
// Return success response with complete information
Ok(Json(CommonResult::success(Some(CommitBindingResponse {
binding: None, // Could optionally include updated binding details

Copilot AI Sep 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binding field is hardcoded to None with a comment suggesting it could include details. This creates an inconsistent API response compared to the latest-commit endpoint. Consider either populating this field with the actual binding data or removing the misleading comment.

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/api_router.rs Outdated
let query_path: std::path::PathBuf = query.path.into();
let import_dir = state.storage.config().monorepo.import_dir.clone();
if let Ok(rest) = query_path.strip_prefix(import_dir) {
let import_dir = state.storage.config().monorepo.import_dir.clone();

Copilot AI Sep 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the trailing whitespace at the end of line 128.

Suggested change
let import_dir = state.storage.config().monorepo.import_dir.clone();
let import_dir = state.storage.config().monorepo.import_dir.clone();

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/api_router.rs Outdated
Comment on lines +129 to +151
let mut commit_info = if let Ok(rest) = query_path.strip_prefix(import_dir) {
if rest.components().count() == 1 {
let res = state
.monorepo()
.get_latest_commit(query_path.clone())
.await?;
return Ok(Json(res));
res
} else {
let res = state
.api_handler(&query_path)
.await?
.get_latest_commit(query_path)
.await?;
res
}
} else {
let res = state
.api_handler(&query_path)
.await?
.get_latest_commit(query_path)
.await?;
res
};

Copilot AI Sep 11, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's duplicated code in the else branch (lines 137-142 and 145-149). Consider extracting this common logic into a helper function or variable to reduce duplication.

Copilot uses AI. Check for mistakes.
Comment thread mono/src/api/api_router.rs Outdated
let commit_binding_storage = state.storage.commit_binding_storage();
let user_storage = state.storage.user_storage();

if let Ok(Some(binding_model)) = commit_binding_storage.find_by_sha(&commit_info.oid).await {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请将具体的逻辑转移到service 层处理,router 只保留接口转发功能

…ion from router to service layer

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
Signed-off-by: Ruizhi Huang <166112492+231220075@users.noreply.github.com>
Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
@benjamin-747
benjamin-747 added this pull request to the merge queue Sep 11, 2025
Merged via the queue into gitmono-dev:main with commit 053536e Sep 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants