Commit Graph

13 Commits

Author SHA1 Message Date
Dash
34e6253d8d fix(test): drop agent-shell variables that change unit test results
Suites run inside an agent session failed on variables the agent's shell
carried (NODE_ENV, NODE_DEBUG, CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL, and a
remotely controlled Cindy task's CINDY_INPUT_HANDOFF_ROUTE) although the
code under test was unchanged. The workspace runner now removes them
before any test child starts and says which it removed. CI never sets
them, so CI results are unaffected.

Assisted-by: Cindy (https://cindy.app)
Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-11-03 18:30:11 +13:00
MagicLizi
9c7220ff53 fix(test): execute behavior regressions and preserve Windows runner arguments
Signed-off-by: MagicLizi <jiali@magiclizi.com>
2026-10-16 17:39:28 +08:00
MagicLizi
e2f05349d4 perf(ci): speed up unit test gate and add hygiene checks
Signed-off-by: MagicLizi <jiali@magiclizi.com>
2026-10-16 13:03:56 +08:00
Dash
a9a1ebc1a2 fix(dev): 新 worktree 装完依赖即可用,开发版启动失败能看到原因 (#5815)
* fix(dev): 新 worktree 装完依赖即可用,开发版启动失败能看到原因

- postinstall 末尾复核 Electron dist,缺失时补装:pnpm side-effects cache
  记下「electron 已构建但无产物」后,同机新 worktree 都会跳过 Electron
  自己的 postinstall
- workspace 测试开跑前只读检查依赖与 Electron,未就绪直接给出处置命令
- macOS 无 TTY 启动时用 script(1) 把 dev 终端输出写入
  apps/desktop/logs/dev-terminal.log,失败时打印日志末尾并在 verdict 带 log=
- USERDATA_IN_USE 给出改用本 worktree 沙箱的 next
- 进程归属按最深 worktree 判定,主 checkout restart 不再误杀
  .cindy-worktrees 下的实例
- 同步环境准备、Desktop 启动与 worktree 会话文档

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* fix(dev): 收紧依赖预检范围,终端日志限长并覆盖所有失败结论

- 依赖预检只在选中 Desktop 时检查 Electron,并把缺失的
  node_modules/electron 判为安装不完整
- 终端日志经命名管道只保留前 8MB,长期运行的 dev 不再让文件无限增长;
  环境变量前缀紧贴 script,cd 失败时整组命令不执行
- ready 后进程退出导致的 WHOAMI_MISMATCH 也打印日志末尾并带 log=
- ensure-deps 测试去掉 CI 继承的 ELECTRON_OVERRIDE_DIST_PATH

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

* test(dev): 终端日志命令断言按平台路径拼接

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>

---------

Signed-off-by: Dash <125997726+dashhuang@users.noreply.github.com>
2026-10-12 06:00:50 +08:00
Chris Zhang
80c3020bb1 fix(test): 本地测试默认独立运行,收窄选测与执行要求 (#5042)
* fix(test): make local test serialization opt-in

Signed-off-by: zqchris <chrisz83@gmail.com>

* fix(test): retain checked text inputs and portable Git fixtures

Signed-off-by: zqchris <chrisz83@gmail.com>

---------

Signed-off-by: zqchris <chrisz83@gmail.com>
2026-09-24 22:58:31 +08:00
Junshan
fd03cf14a4 fix(test-runner): skip git-ignored tmp/ and tolerate unreadable dirs (#3373)
readAllFiles() recursively scans from the repo root using only a hardcoded
directory blacklist; it never consults .gitignore. tmp/ is git-ignored
(.gitignore:188, session tool scratch) but was not in the blacklist, so
the scan recursed into it. When tmp/ holds a directory the current
process cannot scandir (sandbox / tool leftovers on Windows throw EPERM),
fs.readdirSync escaped uncaught and crashed the root test gate during
file discovery, before any source-contract assertion ran.

Two changes:
- Add 'tmp' to IGNORED_PARTS so git-ignored scratch trees are skipped,
  matching .gitignore and keeping isIgnoredFile path-segment exact
  (legitimate 'tmp-adapter' package names stay scannable).
- Wrap readAllFiles' readdirSync in EPERM/EACCES/ENOENT tolerance and
  skip that subtree, so any future unreadable residual directory cannot
  take down the gate; tracked and non-ignored sources never live there.

Fixes #3353

Signed-off-by: yuaiccc <yuaiccc@aliaun.com>
Co-authored-by: yuaiccc <yuaiccc@aliaun.com>
2026-08-25 18:43:08 +08:00
Lizi
a94d019579 feat(test): 本地提交默认只跑和改动相关的单测
本地门禁改为 pnpm test:unit:related:按相对 main 的全部改动选测。
改到测试调度或依赖清单时退回全量。CI 仍跑完整 pnpm test:unit。

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Lizi <jiali@magiclizi.com>
2026-08-14 01:24:44 +08:00
DavidShenXD
917d49e677 ci: 并行拆分 Windows 单测门禁 (#1354)
* ci: 并行拆分 Windows 单测门禁

Signed-off-by: david <david@xd.com>

* fix(ci): 收窄空分片兼容范围

Signed-off-by: david <david@xd.com>

---------

Signed-off-by: david <david@xd.com>
2026-08-02 15:43:24 +08:00
Kafeifei
ba8258beb2 fix(scripts): pnpm 原生二进制发行版下开发脚本不再把 pnpm 交给 node 执行 (#804)
* fix(scripts): pnpm 原生二进制发行版下 test-workspaces 不再把 pnpm 交给 node 执行

resolvePnpmInvocation 原先假定 npm_execpath 一定指向 pnpm 的 JS 入口(pnpm.cjs),
构造 `node ${npm_execpath}` 调用。pnpm 以原生二进制发行版安装时(macOS 上
~/Library/pnpm/.tools/@pnpm+macos-arm64/<ver>/.../pnpm 是 Mach-O 可执行文件),
node 会把二进制当脚本解析并抛 SyntaxError: Invalid or unexpected token,
于是 `pnpm test:unit` 下每个 workspace 都被误判成 TEST_ASSERTION_FAILED 秒挂;
直接 `node scripts/test-workspaces.mjs` 不经 pnpm run 包裹反而正常。

改为按扩展名判定:只有 .js/.cjs/.mjs 才交给 node;否则直接把 npm_execpath
当可执行文件调用。Windows 上仅 .exe/.com 直接调用,.cmd/.bat 退回 PATH 解析
(shell:true 无法安全传递带空格的路径),与无 npm_execpath 时的兜底同路。

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): pnpm 原生二进制发行版下 Desktop dev 启动与依赖修复不再交给 node 执行

上一个 commit 只修了 test-workspaces;同样的假设还在启动链路上,于是
`pnpm restart:desktop:remote` 一直以 DEV_PROCESS_EXITED 失败——包装脚本新开的
Terminal 里带着 npm_execpath,desktop-dev-runner 便执行 `node <原生 pnpm 二进制>`,
SyntaxError 后 exit 1,主窗口永远等不到 ready。ensure-deps 自动修复依赖那一步
(resolvePnpmInstallInvocation)有同样的缺陷,只在需要重装时才暴露。

把「该怎么调用 pnpm」收敛到 scripts/shared/pnpm-invocation.mjs:
- resolvePnpmInvocation 按扩展名分派,只有 .js/.cjs/.mjs 交给 node,原生二进制
  直接执行,Windows 的 .cmd/.bat 退回 PATH 解析并 shell:true;
- usablePnpmExecPath 保留原有守卫(basename 匹配 pnpm + 文件存在),处理
  Windows restart 管线新开 cmd.exe 时 npm_execpath 缺失或残留的情况。

test-workspaces、desktop-worker-benchmark、desktop-dev-runner、ensure-deps 四处
统一走该模块;ensure-deps 的 spawnSync 补上 invocation.shell(此前 Windows 走
PATH 兜底时缺 shell,spawnSync 解析不到 pnpm)。

macOS 已实测:restart:desktop:remote 报 Desktop dev is ready,desktop:whoami 确认
实例来自本 worktree。Windows 分支按 spawn 语义推导,未实机验证。

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): respect explicit pnpm execpath fallback

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): preserve Windows pnpm cmd arguments

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): disable cmd delayed expansion for pnpm

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* docs(scripts): clarify Windows pnpm wrapper invocation

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): preserve explicit pnpm cmd wrapper paths

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): quote Windows pnpm cmd command lines

Signed-off-by: Kafeifei <kafeifei@gmail.com>

* fix(scripts): shield pnpm cmd args from expansion

Signed-off-by: Kafeifei <kafeifei@gmail.com>

---------

Signed-off-by: Kafeifei <kafeifei@gmail.com>
2026-08-01 10:38:34 +08:00
DavidShen
31a56a435a 新增跨工作树测试门禁锁
X-XDT-Session: 410a8cb0-dfe5-44ca-9222-887c5a3b7795
X-XDT-Kind: after-edit
X-XDT-Anchor: 72f6e3f9-346d-4f0d-a611-4e82ebdc0e7c
X-XDT-Branch: xdt/auto-5k5cvj
Signed-off-by: DavidShen <david@xd.com>
2026-07-29 14:10:20 +08:00
DavidShenXD
cd1aee1f10 perf(test): 优化单测并行与 Desktop worker 配置 (#543)
* perf(test): bound workspace unit concurrency

Signed-off-by: david <david@xd.com>

* perf(test): benchmark desktop worker scaling

Signed-off-by: david <david@xd.com>

* perf(test): use eight desktop workers

Signed-off-by: david <david@xd.com>

* fix(test): address runner review feedback

Signed-off-by: david <david@xd.com>

* fix(test): harden runner output handling

Signed-off-by: david <david@xd.com>

---------

Signed-off-by: david <david@xd.com>
2026-07-27 09:28:33 +08:00
DavidShenXD
09c6b564c0 test: 提升跨平台单测基础设施稳定性 (#449) 2026-07-26 02:16:59 +08:00
Lizi
bb3f71d084 chore: Cindy 首次开源提交 / initial open-source release
Cindy 是心动网络 (X.D. Network Inc.) 的跨端 AI Agent 客户端。
本次提交包含 Desktop(Electron)、Mobile(Expo)及全部共享 packages
的完整源码,以 Apache-2.0 协议开源。

This is the first public release of Cindy, X.D. Network's cross-platform
AI agent client: the Electron desktop app, the Expo mobile app, and all
shared workspace packages, licensed under Apache-2.0.

- 许可与合规:根 LICENSE(Apache-2.0)+ NOTICE;第三方组件归属声明与
  SPDX SBOM 收口在 docs/legal/notices/,由 pnpm licenses:generate 生成。
- 社区文件:README / CONTRIBUTING / CODE_OF_CONDUCT / SECURITY / SUPPORT
  中英双语;issue / PR 模板与 CI workflow 在 .github/。
- 协议层以公开 submodule 引入:github.com/makecindy/cindy-protocol。
- 提交前已通过仓库门禁:全量 pnpm test:unit 与涉及 package 的 typecheck。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-24 08:30:44 +08:00