feat(runtime): provision verified dependencies for managed workspaces - #2307
feat(runtime): provision verified dependencies for managed workspaces#2307zhiiw wants to merge 9 commits into
Conversation
|
Addressed the actionable authority gaps in Changes made
Findings that did not require the proposed architecture expansion
The producer is never given the source or managed-worktree path. Manifest and lockfile bytes are read from the admitted Git baseline object and copied only into this Maka-owned staging project. The new regression test locks this boundary through the public owner path. The lease counter is process-local by design, but GC is not exposed to multiple legitimate writer processes: Artifact reuse and workspace binding are already separate: the content-addressed dependency artifact can be shared, while I did not add a generic OS sandbox abstraction to this PR. The exact capability is an admission contract, not a claim that a TypeScript type creates an OS sandbox. Production still has one consumer: the fully verified bundled npm runtime, with lifecycle scripts disabled, hermetic config, no secrets, and registry-only lockfile admission. Shell/Build or another producer would require a separate platform-I/O invariant and review. Verification
中文说明
已完成修改
不需要按原建议扩张架构的部分
producer 从未拿到 source 或 managed-worktree path。manifest/lockfile 从已准入 Git baseline object 读取,只复制进 Maka-owned staging project。新增测试已经锁定该边界。 lease counter 虽然是进程内状态,但 GC 不会暴露给两个合法 writer: artifact 与 workspace binding 也已分离:content-addressed artifact 可以共享; 本 PR 没有引入泛化的 OS sandbox 抽象。精确 capability 是 admission contract,不会把 TypeScript 类型冒充操作系统 sandbox。当前生产消费者仍只有经过完整验证的 bundled npm runtime,且禁用 lifecycle scripts、使用 hermetic config、不注入 secret,并只准入官方 registry lockfile。未来 Shell/Build 或新 producer 必须作为新的 platform-I/O 不变量单独审查。 验证
|
|
Thanks for the detailed follow-up and for all the care that has gone into this. I also really appreciate the thoughtful reviews you’ve contributed elsewhere in the repo. I took another careful pass across the storage authority, npm producer, Runtime Host lifecycle, tests, and release path. A few parts look solid: the environment identity now binds the baseline inputs, runtime, policy, Node ABI, and platform; the receipt is kept outside the producer-owned artifact; and the publish/receipt process-crash convergence is well considered. I also agree with two clarifications from the earlier discussion: the producer staging directory is not the managed Git worktree, and the storage-root OS writer lock means a separate cross-process lease protocol is not required for the current single-writer model. I don’t think the current head is ready to merge yet, though. These are the concrete findings I could verify: Findings
Suggested directionFrom the final-state perspective, I think the necessary invariant is much smaller than the current implementation:
The smallest correct implementation I can see would avoid a persistent shared cache initially:
This removes the receipt database, shared inflight state, LRU GC, cross-task cache reconciliation, and per-operation hashing until product evidence shows that cross-task reuse is necessary. If persistent reuse is already a firm requirement, I think the cleaner long-term design is to make the dependency environment a first-class immutable Storage artifact with one authoritative These are alternatives rather than a request to implement both. Given the current size and the amount of evolution on Thanks again for pushing this forward. I’d be happy to take another look at the revision. 中文版本感谢你详细回应前一轮反馈,也感谢你在这个 PR 上投入了这么多精力。你一直以来也为仓库里的其他 PR 提供了很多细致的审查,我非常感激。 我重新仔细检查了 storage authority、npm producer、Runtime Host 生命周期、测试和发行路径。目前有一些部分已经比较扎实:environment identity 现在绑定了 baseline 输入、runtime、policy、Node ABI 和平台;receipt 位于 producer 所有的 artifact 之外;artifact publish 与 receipt commit 之间的进程崩溃收敛也考虑得比较完整。 我也认同前一轮讨论中的两点澄清:producer staging directory 不是 managed Git worktree;在当前单 writer 模型下,storage-root 已经有操作系统级的独占 writer lock,因此暂时不需要额外的跨进程 lease 协议。 不过,我认为当前 head 还不适合合并。以下是我能够验证的具体问题: Findings
建议方向从最终状态出发,我认为真正需要满足的不变量比当前实现更小:
我能看到的最小正确实现,是初期先不做持久化共享 cache:
这样可以先删除 receipt database、共享 inflight state、LRU GC、跨任务 cache reconciliation 和每个工具操作重复哈希等复杂度,等真实产品数据证明跨任务复用确实必要时再增加。 如果跨任务持久化复用已经是明确需求,我认为更干净的长期方案是:把 dependency environment 建模为 Storage 管理的一等不可变 artifact,并由一个明确的 这两个方案是不同选择,并不是建议同时实现。考虑到当前 PR 的规模以及 再次感谢你持续推动这项工作。我也很愿意在 revision 更新后继续审查。 |
Astro-Han
left a comment
There was a problem hiding this comment.
Last comment was reviewing at current head.
|
感谢在这个大分支里把 managed dependency 的 identity、producer policy、crash convergence、release supply chain 和 consumer boundary 都系统地探索了一遍。这里积累的设计与 review 结论很有价值。 后续实现已经按 review 建议收敛成 current-main 上的增量 stack,而不是继续维护这个 40-file monolith:#2485 已合入 durable dependency artifact authority;#2620、#2621、#2622、#2623 分别承接 constrained npm producer、bundled runtime attestation、cancellable admission 和 production managed inspection / crash replay。#2620 的描述也明确它是 #2485 合入后的 first incremental slice。 继续保留本 PR 会让同一能力同时存在 monolithic 与 incremental 两套实现 authority,也会让已经迁移的 review 结论重复失效。因此关闭这个已被拆分 stack 取代的 umbrella implementation;后续工作和 review 继续在 #2620–#2623 上进行。 Thank you for the extensive design and implementation work in this branch. The work has since been re-sliced on current main: #2485 is merged, and #2620–#2623 carry the constrained producer, runtime attestation, cancellable admission, and production consumer/recovery path. I am closing this monolithic implementation so the repository has one incremental implementation authority. The useful work and review conclusions continue in that focused stack. |
Summary
This PR adds a verified dependency-environment boundary for managed workspaces.
Its primary invariant is:
The implementation never copies or reuses ignored
node_modulescontent from the source checkout.What changed
node_modules/**as a read-only logical projection forRead,Glob, andGrep.tar7.5.22 in place of npm 12.0.2's bundled 7.5.19, and records patch provenance plus final-tree hashes in the manifest.Safety and behavior boundaries
node_modulesis never admitted.Validation
npm cion Node 26.6.0.git diff --check: passed.The repository-wide typecheck still reports pre-existing UI
conversationKeytyping failures outside this PR's paths; this PR does not modify that UI seam.Release impact
The raw Windows resource payload adds approximately 14.64 MB before installer compression (bundled npm runtime plus manifest). Final installer deltas remain platform/release-pipeline dependent and should be measured by release CI.
中文说明
概要
这个 PR 为 managed workspace 增加一条经过验证的依赖环境边界。
它证明的主要不变量是:
实现不会复制或复用 source checkout 中被忽略的
node_modules。主要改动
Read、Glob、Grep访问node_modules/**。能力边界
node_modules永不准入。验证
npm ci。git diff --check均通过。仓库全量 typecheck 仍有本 PR 路径之外、既有的 UI
conversationKey类型错误;本 PR 没有修改该 UI seam。包体影响
Windows 原始资源在 installer 压缩前约增加 14.64 MB(bundled npm runtime 与 manifest)。最终安装包增量仍需由各平台 release CI 实测。