Files
deepseek-harness/.agents/notes/proposed/process/2026-07-26-pnpm-action-setup-for-symmetric-ci-caching.zh.md
T
Tianyi Cui 3a88912a22 docs: adopt dependencies-over-hand-rolling policy from NIH audit
A repo-wide Not Invented Here audit (ten parallel domain surveys covering
every package group, scripts/, native/, vendor/ edges, python/, test
infrastructure, and CI) asked of each hand-rolled surface whether a
maintained external package or Node builtin deletes it with a net win.

Policy: new implemented process note records that a dependency which
genuinely deletes owned code is a preferred simplification (bar: net
deletion, health, boundary fit, settled seams stay); root AGENTS.md
carries the one-line rule and dsh-find-simplifications now surveys for
hand-rolled-where-a-dependency-exists candidates.

Findings, all bilingual from birth:
- proposed/simplification: eventsource-parser for llm-deepseek SSE,
  node:timers/promises for three hand-rolled sleeps, turndown (or
  minimal 'entities') for tool-web HTML->markdown, gate-script
  consolidation onto mdast/parseArgs/globSync
- proposed/testing: execa + parseArgs + loadEnvFile + vi.waitFor for
  hand-rolled test subprocess plumbing
- proposed/process: pnpm/action-setup for symmetric CI caching
- proposed/feature: evaluate landstrip before building a Windows
  sandbox launcher
- rejected/simplification: ~30 swap verdicts recorded (vscode-jsonrpc,
  p-retry, Ajv, write-file-atomic, msw, hono, better-sqlite3, wireit,
  landstrip-for-linux, YAML consolidation, ...) so the survey is not
  re-litigated from scratch

Also drops the stale prompt/ entry from the AGENTS.md layout map
(workspace instructions live in packages/context/workspace-context).
2026-07-26 15:54:36 +08:00

2.1 KiB
Raw Blame History

Agent Note: 用 pnpm/action-setup 实现对称的 CI pnpm 缓存

Status: proposed

English | 中文

问题

五个工作流重复着同一套手写(hand-rolled)的三步 pnpm 设置——corepack enable、pnpm store path --silent >> $GITHUB_OUTPUT、再加以 pnpm-lock.yaml 为缓存键的 actions/cache@v4:e2e.yml、docs-pages.yml、pi-ai-provider-e2e.yml、build-exe-for-python-sdk.yml,以及 ci.yml 的 node-compat、serial-linux 与 benchmark 作业(合计约 40–60 行 YAML)。与之等价、由官方维护的做法——pnpm/action-setup@v4(从 package.json 读取 packageManager)加带 cache: pnpm 的 actions/setup-node——已在仓库内的 landlock-run.yml 中得到验证,同时还能隔绝 corepack 被从较新 Node 发行版中移除的影响。

提案

将各对称缓存工作流改为 pnpm/action-setup@v4 + setup-node cache: pnpm。以下明确不做转换:

  • ci.yml 中运行在企业 runner 上的三个 PR(Pull Request)作业——它们刻意只用 actions/cache/restore,把缓存压缩/上传挡在付费且延迟敏感的关键路径之外,这种不对称是 setup-node 的缓存无法表达的;
  • Windows 作业,它刻意跳过 store 缓存。

曾考虑的替代方案

  • 保留手写步骤。 它们能用,但那是五份会各自漂移的设置样板副本,而且对 corepack 的依赖是已知的未来失效点。
  • 连企业作业在内全部转换。 否决:只恢复不上传(restore-only)的不对称是 ci.yml 注释中有记录的延迟决策;为统一工具而抹掉它,属于颠倒优先级。

验收标准

  • 五个对称工作流经由上述 action 完成 pnpm 设置;每条泳道各跑一次冷运行以重建新的缓存键格式,此后缓存命中率与旧步骤持平。
  • 企业 runner 上的 PR 作业与 Windows 作业保持原样不动。

风险

  • 缓存键格式变更一次(每条泳道各一次冷运行)。
  • 更多工作流引入一个第三方 action;它已在仓库内获得信任(landlock-run.yml),且是 pnpm 团队的官方 action。