Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(desktop): 补齐账户稳定后统计绑定夹具依赖

nanaf8aad27c79cb
diff --git a/apps/desktop/src/main/__tests__/stableOwnerPostCommitStep.test.ts b/apps/desktop/src/main/__tests__/stableOwnerPostCommitStep.test.ts
index 98e0ad813b..29cf8021f4 100644
--- a/apps/desktop/src/main/__tests__/stableOwnerPostCommitStep.test.ts
+++ b/apps/desktop/src/main/__tests__/stableOwnerPostCommitStep.test.ts
@@ -83,6 +83,7 @@ function pipeline() {
const builtin = vi.fn(async () => 'completed' as const);
const syncMarket = vi.fn(() => market.promise);
const oauth = vi.fn(async () => true);
+ const refreshUsage = vi.fn(async () => undefined);
const warn = vi.fn();
const coordinator = new StableOwnerPostCommitCoordinator({
snapshot: () => ({ scopeKey: scope, dataOwnerId: owner, stable: true }),
@@ -100,6 +101,7 @@ function pipeline() {
getActiveAppSession: () => ({ dataOwnerId: owner }),
runStableOwnerPostCommitTask: builtin,
syncDefaultMarketPlugins: syncMarket,
+ refreshPluginUsageBindings: refreshUsage,
reconcileGhostOauthAccountsForActiveOwner: oauth,
};
const compiled = transpileModule(
@@ -121,6 +123,7 @@ function pipeline() {
syncMarket,
builtin,
oauth,
+ refreshUsage,
warn,
switchOwner: (next: string | null) => {
owner = next;
@@ -136,6 +139,7 @@ describe('production background pipeline', () => {
const result = run.coordinator.ensure('startup');
await vi.advanceTimersByTimeAsync(180_000);
await expect(result).resolves.toBe('failed');
+ expect(run.refreshUsage).toHaveBeenCalledTimes(1);
expect(run.oauth).toHaveBeenCalledTimes(1);
run.syncPluginMarketForActiveOwner();
await vi.advanceTimersByTimeAsync(1_000);
@@ -181,7 +185,10 @@ describe('production background pipeline', () => {
builtin.resolve('completed');
await vi.advanceTimersByTimeAsync(0);
run.switchOwner(null);
+ const usageRefreshesBeforeSignOut = run.refreshUsage.mock.calls.length;
await expect(run.coordinator.ensure('signed-out')).resolves.toBe('completed');
+ expect(usageRefreshesBeforeSignOut).toBeGreaterThan(0);
+ expect(run.refreshUsage).toHaveBeenCalledTimes(usageRefreshesBeforeSignOut);
expect(run.syncMarket).toHaveBeenCalledTimes(1);
expect(run.oauth).toHaveBeenCalledTimes(1);
});
diff --git a/docs/acceptance/plugin-statistics-pr/README.md b/docs/acceptance/plugin-statistics-pr/README.md
index cbd2335448..24c5a827ee 100644
--- a/docs/acceptance/plugin-statistics-pr/README.md
+++ b/docs/acceptance/plugin-statistics-pr/README.md
@@ -45,3 +45,10 @@ c4aae2ad9 的 CI 中,两平台四分片共用的 6 项失败已在本地复现
验证:Desktop 60 文件 1163 项通过,另 15 项实际迁移回放通过;协议 11 文件 166 项与类型构建通过;迁移静态冻结/连续/journal/schema/CJS 校验覆盖 0000..0128;Desktop 类型检查、本轮四个冲突或夹具 TS/TSX 文件 ESLint、公开 tracked-file 文档检查 10/10 通过。首轮定向运行发现统计服务夹具引用旧迁移导致 ENOENT,修正后该服务 21 项及 DbClient 真实 Worker/回退调用通过,不将首次失败隐去。
本轮未恢复已停止的沙盒,没有新 UI 截图或冷启动验收;上述历史截图及 c4 冷启动保留原版本边界。未发布的旧统计迁移身份已被替换,曾运行旧分支迁移的测试 profile 不能直接当成新版兼容验收数据;不修改或迁移该 profile。新提交的 CI、评分及指定 Approve 需独立核对,旧 2d8468b9 的 CI/5 分/Approve 不冒称覆盖新提交。本地全量门禁未执行,等待 PR CI。
+
+
+## 整合后 CI 夹具修复(2026-10-16)
+
+c7cd1107 的 Linux/Windows 分片均在 stableOwnerPostCommitStep 的同一组 3 个断言失败。本地以同一夹具提取 c7 主进程代码复现 3 项失败;提取其已合入主干 a1fbbb8e 的代码则 7/7 通过。原因是 new Function 测试依赖未注入本 PR 新增的 refreshPluginUsageBindings,协调器捕获 ReferenceError 后未进入后续步骤;不代表生产导入缺失。
+
+仅补齐夹具中的统计绑定 spy,保留原市场超时、重试、切号与退出断言,并验证登录时绑定、签出后不新增绑定。相关 4 文件 23 项测试、本文件 ESLint 和 Desktop 类型检查通过。生产代码、迁移、协议与 UI 不变,不重启沙盒、不补拍;c7 的失败保留为历史结果,新提交仍需完整 CI。
diff --git a/docs/acceptance/plugin-statistics-pr/checks.json b/docs/acceptance/plugin-statistics-pr/checks.json
index 429fc818d8..f7940b1484 100644
--- a/docs/acceptance/plugin-statistics-pr/checks.json
+++ b/docs/acceptance/plugin-statistics-pr/checks.json
@@ -96,5 +96,32 @@
"firstRunFailure": "Service fixture referenced removed unmerged migration; updated two fixture paths, service 21 tests and DbClient integration then passed",
"runtimeAcceptance": "Not rerun; stopped sandbox remains stopped",
"localFullSuite": "Not run; full PR CI required"
+ },
+ "postCommitFixtureRepair20261016": {
+ "failedHead": "c7cd1107f3f28218592aac553bc56f1f4d55effd",
+ "baseBootstrap": "a1fbbb8ec7d1476813b5ae57ef56e86dc3d21260",
+ "sameFixtureAgainstBase": {
+ "passed": 7,
+ "failed": 0
+ },
+ "beforeRepair": {
+ "passed": 4,
+ "failed": 3
+ },
+ "afterRepair": {
+ "files": 4,
+ "passed": 23,
+ "exitCode": 0
+ },
+ "desktopTypecheck": {
+ "exitCode": 0
+ },
+ "fixtureESLint": {
+ "files": 1,
+ "exitCode": 0
+ },
+ "productionChanges": false,
+ "runtimeAcceptance": "Not rerun; stopped sandbox remains stopped",
+ "scopeGuard": "Absolute size STOP from existing full feature/snapshot; this repair only adds fixture dependency/assertions and acceptance notes, within authorized single PR"
}
}