test: auth 域 6 操作契约一致性测试全响应矩阵(D3-8,T3-19)
CI / backend-test (push) Failing after 8s

- 复制 pet 模块契约框架(OpenApiContract/ContractValidator + v1.2.0
  字节级快照)入 patbond-auth,沿每模块复制纪律;快照守卫防漏同步
- AuthContractConformanceTest:沿 AuthE2eIntegrationTest 编排同 JVM 真实
  拉起 user 服务,register/login/refresh/logout 打 auth、me/trackEvents
  打 user;6 操作 19 个 (操作,状态码) 单元格全矩阵零豁免(含 409 双业务
  码、423 锁定、40102 重放、me 404 幽灵用户、events 匿名 202/无效 token 401)
- 修契约测试首轮抓到的真实漂移:EventResult.reason 在 accepted/duplicate
  条目序列化出 null,契约声明仅 rejected 时出现——reason 加
  @JsonInclude(NON_NULL),既有埋点测试零回归

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 17:11:58 +08:00
parent 10a43f876c
commit 263cd88451
5 changed files with 3109 additions and 1 deletions
@@ -1,5 +1,6 @@
package com.patbond.patbond.user.analytics;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -106,7 +107,9 @@ public class AnalyticsService {
return sanitized;
}
public record EventResult(UUID eventId, String status, String reason) {
/** reason 仅 status=rejected 时出现(契约 EventResultaccepted/duplicate 不含该字段)。 */
public record EventResult(UUID eventId, String status,
@JsonInclude(JsonInclude.Include.NON_NULL) String reason) {
public static EventResult accepted(UUID eventId) {
return new EventResult(eventId, "accepted", null);
}