Skip to content

test(pay): 补充应答时间戳校验回归覆盖 - #4142

Open
binarywang wants to merge 1 commit into
developfrom
test/pay-validator-timestamp-regressions
Open

binarywang wants to merge 1 commit into
developfrom
test/pay-validator-timestamp-regressions

Conversation

@binarywang

Copy link
Copy Markdown
Owner

Summary

补充已合并 #4137 的支付应答时间戳回归覆盖,避免新鲜度检查掩盖验签结果或遗漏边界条件。

 WxPayValidatorTest
+ 新鲜时间戳但验签失败时拒绝
+ 过期/超前时间戳短路验签(含 ±301 秒)
+ Long.MAX_VALUE、long 溢出字符串、空串和空白串
+ 负容差关闭新鲜度检查,但仍使用验签结果
+ 注入时钟从包含边界的 300 秒推进至 301 秒

使用计数验签器和确定性时钟,无新增 sleep;仅修改测试,生产行为保持不变,包括证书刷新与非 JSON 应答处理。

Evidence

  • Before: 现有 11 次测试执行未覆盖上述验签组合、调用次数与边界场景。
    After: 聚焦测试 24 项、支付离线套件 205 项、common 28 项全部通过,0 失败、0 错误、0 跳过;git diff --check 通过。
mvn -o -pl weixin-java-pay -am -Dmaven.test.skip=false -Dtest=WxPayValidatorTest -Dsurefire.failIfNoSpecifiedTests=false test
mvn -o -pl weixin-java-pay -am -Dmaven.test.skip=false test

CircleCI #1453 在提交 fc87e3c8886d768e8b87a051fc54053bfe234bd8 上成功。未执行全仓库测试;上述结果不代表真实 JDK 8 运行时验证。

Merge Danger

Door: two-way

可直接回退的测试变更。

Blast Radius: tests

仅影响支付模块测试覆盖,不修改生产代码或依赖。

@binarywang
binarywang marked this pull request as ready for review October 18, 2026 03:30
Copilot AI balanced review requested due to automatic review settings October 18, 2026 03:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T03:31:37.953195Z fc87e3c Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

变更仅涉及确定性测试,断言与现有校验契约一致,未发现阻止合并的问题;本次未运行测试。

No open issues 🎉

What changed in this PR

为 #4137 引入的支付 V3 应答时间戳校验补充回归测试,不修改生产代码或依赖。

Changes:

  • 使用计数验签器验证验签结果及时间戳拒绝时的短路行为。
  • 覆盖 ±301 秒、极值、溢出字符串、空白输入和负容差。
  • 使用可推进时钟验证 300 秒边界及其后的过期行为,无新增 sleep。
File Description
weixin-java-pay/​src/​test/​java/​com/​github/​binarywang/​wxpay/​v3/​auth/​WxPayValidatorTest.java 补充时间戳边界、异常输入及验签调用回归覆盖。

Review effort: Balanced

@augmentcode

augmentcode Bot commented Oct 18, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

本 PR 仅扩展 WxPayValidatorTest,补充支付应答时间戳校验的回归覆盖。
新增计数验签器,验证新鲜应答仍依赖验签结果,过期或超前应答短路验签。
补充 ±301 秒、Long.MAX_VALUE、long 溢出字符串、空串和空白串用例。
覆盖负容差关闭新鲜度检查后仍使用验签结果的行为。
通过可推进的注入时钟验证 300 秒包含边界与 301 秒拒绝,无新增 sleep。
未修改生产代码或依赖;静态审查未发现需报告的问题,本次未执行测试。

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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.

2 participants