Skip to content

Fix/representative sync and errors#480

Open
JavaPythonAIForBAT wants to merge 6 commits into
reviewfrom
fix/representative-sync-and-errors
Open

Fix/representative sync and errors#480
JavaPythonAIForBAT wants to merge 6 commits into
reviewfrom
fix/representative-sync-and-errors

Conversation

@JavaPythonAIForBAT

Copy link
Copy Markdown
Contributor

描述

旧 CLA 数据没有 updated_at 字段 → Go 读取为 0 → time.Unix(0) = 1970-01-01。修复后当 UpdatedAt <= 0 时用当前时间兜底。

Issue

resolve https://github.com/opensourceways/backlog/pull/909

@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @JavaPythonAIForBAT , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: infratructure ,
and any of the maintainers: @GeorgeCao-hw, @TangJia025, @pkking, @zhongjun2 ,
and any of the committers: @JavaPythonAIForBAT, @Zherphy, @tfhddd, @zhongjun2 .

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@JavaPythonAIForBAT , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a fallback mechanism for formatting the CLA update time when the original update timestamp is missing or invalid. The reviewer noted a logical issue where using the current time as a fallback would cause the displayed date to shift in subsequent reminder emails, and suggested using the initial notification time as a consistent fallback instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread signing/watch/notify_corp_admin.go Outdated
Comment on lines +408 to +411
latestUpdateAt := latestCLA.UpdatedAt
if latestUpdateAt <= 0 {
latestUpdateAt = time.Now().Unix()
}

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.

high

在这里使用 time.Now().Unix() 作为 latestUpdateAt 的兜底方案存在一个逻辑缺陷:

由于 latestCLA.UpdatedAt 在数据库中依然是 0(旧数据),每次执行定时任务发送提醒邮件时,latestUpdateAt 都会被重新计算为发送邮件时的当前时间

这会导致用户在收到第一封提醒邮件时,邮件显示更新时间为 Day 1;而在收到第二封提醒邮件(如 7 天后)时,邮件显示的更新时间会变成 Day 8。这种“不断移动的更新时间”会给用户带来困惑,让他们误以为 CLA 又被更新了。

建议的解决方案

如果 latestCLA.UpdatedAt <= 0,我们可以优先使用 is.ClaNotifyTime(即首次发送通知的时间)作为兜底。如果 is.ClaNotifyTime 也为 0(说明是第一次发送),再使用 time.Now().Unix()。这样可以确保在后续的提醒邮件中,显示的更新时间保持一致。

Suggested change
latestUpdateAt := latestCLA.UpdatedAt
if latestUpdateAt <= 0 {
latestUpdateAt = time.Now().Unix()
}
latestUpdateAt := latestCLA.UpdatedAt
if latestUpdateAt <= 0 {
if is.ClaNotifyTime > 0 {
latestUpdateAt = is.ClaNotifyTime
} else {
latestUpdateAt = time.Now().Unix()
}
}

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@tfhddd

tfhddd commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@opensourceways-bot

Copy link
Copy Markdown

Review Code Feedback

  • The label lgtm-tfhddd was added to this pull request. It means that tfhddd reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄

@opensourceways-bot

Copy link
Copy Markdown

Review Code Feedback

  • The label approved was added to this pull request. It means that tfhddd reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

1 similar comment
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

handleNotifyJob/handleIndividualNotifyJob: 记录任务开始/结束、链接数量、扫描人数
handleCorpSigning/handleIndividualSigning: 记录跳过原因(版本相同/无匹配CLA/冷却期内)
handleIndividualSigning: 记录发送成功日志
所有关键决策点均有日志输出,搜索notify即可定位
进入发送流程时记录 signed_cla/latest_cla/cla_notify/count/time
发送时记录 UpdatedAt 原始值和格式化后的日期,便于复现 1970-01-01
原 int 类型无法区分配了 0 和没配(默认 0),导致 YAML 中设 0 时
SetDefault() 用 <=0 判断又覆盖回 90。
改为 *int 后用 nil 判断:nil → 用默认 90,非 nil → 用配置值(0 也生效)
- TriggerNotify(t) 只触发对应CLA类型的扫描器,不再同时触发两边
- Update中 SetPendingCLAForLink 仅企业CLA更新时标记
- AgreeNewCLA 从签署记录获取语言,不再信任前端传入的CLAId
- 新增 getEffectiveGracePeriodDays/getLatestCorpClaId/getLatestIndividualClaId 测试辅助方法
- 修复 test 默认值 1200→86400
@JavaPythonAIForBAT
JavaPythonAIForBAT force-pushed the fix/representative-sync-and-errors branch from a17e61a to 85a56aa Compare July 16, 2026 08:14
@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

JavaPythonAIForBAT, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown
检查项 状态
敏感信息扫描
漏洞扫描
Check代码检查
开源license合规扫描
开发阶段设计文档检查
流水线链接 点击跳转查看日志

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants