现状证据
独立 origin/main worktree 在升级 @rspack/core 2.1.5 → 2.1.8 后完成 workflow:check、ci:verify、empbuild、CLI real tests 与远端 CI 5/5 验证。Rspack 官方 v2.1.8 发布说明明确:持久缓存 cache.storage.directory 从“精确缓存路径”调整为基础目录,最终路径默认变为 <directory>/<cache.name>;旧缓存不会自动迁移,精确路径应迁移到 storage.location。
上游说明:https://github.com/web-infra-dev/rspack/releases/tag/v2.1.8
EMP 当前实现证据:
packages/cli/src/store/rspack/common.ts:24-54 声明 CacheOptions,并在 :50-51 通过 deepAssign(defaultCache, this.store.empConfig.cache) 直接透传用户缓存对象。
packages/cli/src/types/config.ts:457 暴露 cache?: boolean | 'persistent' | CacheOptions 公共配置入口。
- 当前配置/测试未发现
storage.directory → storage.location 迁移、告警或兼容文档,也没有覆盖这两个字段的回归断言。
影响
用户若传入 cache: { type: 'persistent', storage: { type: 'filesystem', directory: '/custom/cache' } },升级后缓存落盘位置可能从精确路径变为带 cache.name 的子目录;既有缓存不会自动迁移,可能带来缓存未命中、磁盘占用变化或多实例路径冲突。该风险属于公共配置语义兼容性,不是本次依赖升级的 CI 阻断。
建议与可选方案
- 兼容迁移(建议先评估):检测旧式
storage.directory,在不显式提供 storage.location 时转换为 location,并保留可观测告警;需要确认 Rspack 2.1.8 的类型/API 行为和旧版本回滚策略。
- 文档与回归测试:明确记录新语义,补
directory/location 配置 shape 与实际落盘路径测试,由用户升级配置。
- 保持透传并接受风险:不改运行时,记录这是 Rspack 上游 breaking semantic change,并在迁移指南中标注。
验收标准
- 明确选择上述方案之一并记录兼容边界和回滚方式。
- 若实现迁移:覆盖显式
location 优先级、旧 directory、默认 cache name、多实例端口和升级/回滚行为;通过 workflow:check、ci:verify、empbuild 及 CLI real tests。
- 若只文档化:新增配置说明与可复现 shape/落盘路径回归测试,并证明无误导性旧示例。
- 不通过静默 blanket override 或忽略上游变更掩盖风险。
等待用户确认
这是公共 CacheOptions 语义变化,等待用户确认优先采用兼容迁移、文档+测试,还是接受上游语义;确认前不自动修改运行时 API。
现状证据
独立
origin/mainworktree 在升级@rspack/core 2.1.5 → 2.1.8后完成workflow:check、ci:verify、empbuild、CLI real tests 与远端 CI 5/5 验证。Rspack 官方 v2.1.8 发布说明明确:持久缓存cache.storage.directory从“精确缓存路径”调整为基础目录,最终路径默认变为<directory>/<cache.name>;旧缓存不会自动迁移,精确路径应迁移到storage.location。上游说明:https://github.com/web-infra-dev/rspack/releases/tag/v2.1.8
EMP 当前实现证据:
packages/cli/src/store/rspack/common.ts:24-54声明CacheOptions,并在:50-51通过deepAssign(defaultCache, this.store.empConfig.cache)直接透传用户缓存对象。packages/cli/src/types/config.ts:457暴露cache?: boolean | 'persistent' | CacheOptions公共配置入口。storage.directory→storage.location迁移、告警或兼容文档,也没有覆盖这两个字段的回归断言。影响
用户若传入
cache: { type: 'persistent', storage: { type: 'filesystem', directory: '/custom/cache' } },升级后缓存落盘位置可能从精确路径变为带cache.name的子目录;既有缓存不会自动迁移,可能带来缓存未命中、磁盘占用变化或多实例路径冲突。该风险属于公共配置语义兼容性,不是本次依赖升级的 CI 阻断。建议与可选方案
storage.directory,在不显式提供storage.location时转换为location,并保留可观测告警;需要确认 Rspack 2.1.8 的类型/API 行为和旧版本回滚策略。directory/location配置 shape 与实际落盘路径测试,由用户升级配置。验收标准
location优先级、旧directory、默认 cache name、多实例端口和升级/回滚行为;通过workflow:check、ci:verify、empbuild及 CLI real tests。等待用户确认
这是公共
CacheOptions语义变化,等待用户确认优先采用兼容迁移、文档+测试,还是接受上游语义;确认前不自动修改运行时 API。