test: accept stable profile refresh semantics
Independent Staging Quality Gate / validate (push) Has been cancelled
Independent Staging Quality Gate / publish (push) Has been cancelled

This commit is contained in:
Jesse_Chen
2026-08-15 23:45:34 +08:00
parent 1084dce770
commit b6df2d9e82
2 changed files with 7 additions and 4 deletions
+3 -3
View File
@@ -3381,7 +3381,7 @@
## BUG-201 | 咨询完成后的账户刷新重复请求每日星语接口
- 状态:resolvedstaging 修复候选,待部署验收)
- 状态:resolvedstaging 质量门禁修复候选,待部署验收)
- 首次发现:2026-08-15
- 最近更新:2026-08-15
- 影响面:首页每日星语卡片、咨询完成后的账户与积分刷新、`POST /api/daily-starlanguage`
@@ -3389,7 +3389,7 @@
- 触发条件:咨询流成功完成后调用 `refreshAccount()`;账户接口返回与当前状态值完全相同但引用不同的 Profile 对象。
- 根因:`readProfile()` 每次都会创建新的标准化对象,`refreshAccount()` 又无条件用该对象替换 Profile state;每日星语 effect 需要跟踪完整 Profile,因此依赖对象引用并在引用变化后重新执行。问题不在咨询结算,也不能通过移除账户刷新或缩减 Profile 依赖来规避。
- 修复:保留咨询完成后的账户与积分刷新;新增浅等值引用保持 helper。账户刷新得到的新 Profile 与当前 Profile 所有标准化字段等值时继续使用当前引用,只有真实字段变化时才替换 state,从而避免无意义地重跑每日星语及其他 Profile 对象 effect。
- 验证:先添加回归测试并确认因 helper 尚不存在而失败;修复后 Profile 引用行为与 `refreshAccount()` 集成测试 3/3 通过。相关 account、consultation entrypoint、starter questions 聚焦测试合计 53/53 通过;目标 ESLint 与 TypeScript `--noEmit` 通过`git diff --check` 按本次本地验收执行。
- 验证:先添加回归测试并确认因 helper 尚不存在而失败;修复后 Profile 引用行为与 `refreshAccount()` 集成测试 3/3 通过。相关 account、consultation entrypoint、starter questions 聚焦测试合计 53/53 通过;目标 ESLint 与 TypeScript `--noEmit` 通过。首次独立 staging gate Run 1856 暴露既有 Agentic 测试仍硬编码 `setProfile(nextProfile)`;该测试已改为验证等价的新函数式更新语义,同时继续禁止覆盖 `setProfileDraft`,避免把正确的引用保持修复误判为回归。`git diff --check` 按本次本地验收执行。
- 防复发:服务器资料刷新不得把“值相同”转化为无意义的状态引用变化;依赖完整 Profile 的 effect 必须在真实资料变化时执行,不能为消除重复请求而遗漏依赖字段。
- 相关记录:BUG-200
- 修复版本:待提交(本地可测
- 修复版本:本次 staging 质量门禁修复提交(精确 SHA 以远端分支与 staging health 验收结果为准
@@ -116,7 +116,10 @@ test("candidate acceptance refreshes the profile result without overwriting an o
page.indexOf("function updateSession"),
);
assert.match(refresh, /const nextProfile = readProfile\(latest\.profile\)/);
assert.match(refresh, /setProfile\(nextProfile\)/);
assert.match(
refresh,
/setProfile\(\(current\) => preserveShallowEqual\(current, nextProfile\)\)/,
);
assert.doesNotMatch(refresh, /setProfileDraft/);
});