Skip to content

feat(storage): import immutable dependency snapshots - #72

Draft
zhiiw wants to merge 4 commits into
codex/m5-managed-coding-v2-crash-gatefrom
codex/m5-dependency-snapshot-authority
Draft

feat(storage): import immutable dependency snapshots#72
zhiiw wants to merge 4 commits into
codex/m5-managed-coding-v2-crash-gatefrom
codex/m5-dependency-snapshot-authority

Conversation

@zhiiw

@zhiiw zhiiw commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • import an explicitly selected, already-provisioned npm node_modules tree into fresh Maka-owned inodes
  • bind the logical package/lock/Node identity to the exact dependency content digest and a durable receipt
  • expose only the narrow snapshot authority and opaque read-only lease; keep generic producers and receipt writers private
  • converge after process exit both after artifact publication and after receipt durability

Primary invariant

An existing dependency tree may receive a managed read-only lease only when the bounded source observation, the Maka-owned copy, and the durable receipt all identify the exact same bytes. This slice never starts npm, accesses the network, reads PATH, or publishes source-owned inodes.

Owner and atomic boundary

ManagedDependencySnapshotAuthority owns source observation and source-to-staging copy. The existing storage-root authority exclusively owns artifact publication, receipt commit, lease lifetime, cross-process exclusion, and GC.

The filesystem and SQLite are not presented as one transaction: an artifact without a receipt is removed and rebuilt; a durable matching receipt is reopened and revalidated; any artifact/receipt/content mismatch fails closed.

Verification

  • storage build: passed
  • focused dependency suites: 30 tests, 28 passed, 2 platform-conditional POSIX skips, 0 failed
  • real child-process crash/reopen after artifact publication: passed
  • real child-process crash/reopen after receipt durability: passed
  • Biome and git diff --check: passed

This remains a stacked Draft. Its base is the packaged managed-coding-v2 crash gate; the next slice binds this opaque lease into T1 before a sandbox may consume it.

中文说明

摘要

  • 将用户明确选择、已经存在的 npm node_modules 导入到全新的 Maka-owned inode;
  • 把 package/lock/Node 逻辑身份与依赖树的 exact content digest、durable receipt 绑定;
  • 只导出窄化的 snapshot authority 和 opaque read-only lease,generic producer 与 receipt writer 保持私有;
  • 覆盖 artifact 发布后、receipt 持久化后两处真实进程退出并重启收敛。

主要不变量

只有当有界 source observation、Maka-owned copy 和 durable receipt 都指向完全相同的依赖字节时,现有依赖树才能获得 managed read-only lease。本切片不会启动 npm、访问网络、读取 PATH,也不会直接发布 source inode。

Owner 与原子边界

ManagedDependencySnapshotAuthority 只拥有 source observation 与 source-to-staging copy。底层 storage-root authority 唯一拥有 artifact publication、receipt commit、lease lifecycle、跨进程互斥和 GC。

文件系统与 SQLite 不伪装成单事务:有 artifact 无 receipt 时删除并重建;receipt 已持久化且匹配时重开并重验;artifact、receipt 或内容任一不一致都 fail closed。

当前仍为 stacked Draft。下一切片会先在 T1 中绑定 opaque dependency lease,再允许 sandbox 消费,缺失时不回退 checkout node_modules

@zhiiw
zhiiw force-pushed the codex/m5-dependency-snapshot-authority branch from c443ffa to edce746 Compare August 31, 2026 00:09
@zhiiw
zhiiw force-pushed the codex/m5-dependency-snapshot-authority branch 3 times, most recently from 0e9fd03 to cf3d66f Compare August 31, 2026 02:05
@zhiiw
zhiiw force-pushed the codex/m5-managed-coding-v2-crash-gate branch 10 times, most recently from 6dda20a to b4060f0 Compare August 31, 2026 03:33
@zhiiw
zhiiw force-pushed the codex/m5-dependency-snapshot-authority branch from cf3d66f to a53544a Compare August 31, 2026 03:36
@zhiiw
zhiiw force-pushed the codex/m5-dependency-snapshot-authority branch from a53544a to 81a3117 Compare August 31, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant