Skip to content

fix: Fix the RecordNotInsert error caused by ON CONFLICT DO NOTHING in cla_storage.#2022

Open
231220075 wants to merge 1 commit intoweb3infra-foundation:mainfrom
231220075:pr_branch
Open

fix: Fix the RecordNotInsert error caused by ON CONFLICT DO NOTHING in cla_storage.#2022
231220075 wants to merge 1 commit intoweb3infra-foundation:mainfrom
231220075:pr_branch

Conversation

@231220075
Copy link
Contributor

  • In the CLA storage layer, resolve the insert error caused by ON CONFLICT DO NOTHING.
  • Perform an additional check and error reporting after the insert operation.

@genedna genedna requested review from benjamin-747 and Copilot March 14, 2026 15:08
@genedna
Copy link
Member

genedna commented Mar 14, 2026

@codex review

Copy link
Contributor

Copilot AI left a comment

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 fixes CLA status writes that can fail under SeaORM ON CONFLICT DO NOTHING semantics (surfacing as DbErr::RecordNotInserted), and adds a post-write verification to ensure sign() actually results in a signed state.

Changes:

  • Treat DbErr::RecordNotInserted from insert(...).on_conflict(...).do_nothing() as an expected no-op instead of a hard failure.
  • After sign(), re-read the row and return an error if the CLA status is still unsigned.

Comment on lines +113 to +115
return Err(MegaError::Other(
"CLA status still unsigned after sign operation".to_string(),
));
Comment on lines +48 to +59
match cla_sign_status::Entity::insert(model)
.on_conflict(
OnConflict::column(cla_sign_status::Column::Username)
.do_nothing()
.to_owned(),
)
.exec(self.get_connection())
.await?;
.await
{
Ok(_) | Err(DbErr::RecordNotInserted) => {}
Err(e) => return Err(e.into()),
}
Comment on lines +85 to +96
match cla_sign_status::Entity::insert(active_model)
.on_conflict(
OnConflict::column(cla_sign_status::Column::Username)
.do_nothing()
.to_owned(),
)
.exec(self.get_connection())
.await?;
.await
{
Ok(_) | Err(DbErr::RecordNotInserted) => {}
Err(e) => return Err(e.into()),
}
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 🚀

ℹ️ 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".

…n cla_storage.

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

code review

Signed-off-by: Ruizhi Huang <231220075@smail.nju.edu.cn>
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