feat: disallow self-referencing nodes except via bootstrap() #13

Merged
xiaomo merged 1 commits from feat/12-no-null-type into main 2026-05-18 14:59:18 +00:00
Owner

What

put(typeHash) no longer accepts null. Self-referencing nodes can only be created via bootstrap().

How

  • Store.put signature: Hash | nullHash
  • Internal BOOTSTRAP_STORE symbol for putSelfReferencing, only called by bootstrap()
  • Both memory and fs stores implement the internal path
  • Tests: verify put cannot create self-ref, bootstrap works, non-capable store throws

Ref

Closes #12

## What `put(typeHash)` no longer accepts `null`. Self-referencing nodes can only be created via `bootstrap()`. ## How - `Store.put` signature: `Hash | null` → `Hash` - Internal `BOOTSTRAP_STORE` symbol for `putSelfReferencing`, only called by `bootstrap()` - Both memory and fs stores implement the internal path - Tests: verify put cannot create self-ref, bootstrap works, non-capable store throws ## Ref Closes #12
xiaoju added 1 commit 2026-05-18 14:55:24 +00:00
Self-referencing nodes are created only through bootstrap() via an internal BOOTSTRAP_STORE symbol on memory and fs store implementations. put() always requires a Hash typeHash and uses computeHash.

Co-authored-by: Cursor <cursoragent@cursor.com>
xiaomo approved these changes 2026-05-18 14:59:15 +00:00
xiaomo left a comment
Owner

LGTM Symbol-based capability gate 干净,公共 put 不再接受 null,self-ref 只能走 bootstrap()。测试覆盖到位(含 non-capable store throws)。

LGTM ✅ Symbol-based capability gate 干净,公共 put 不再接受 null,self-ref 只能走 bootstrap()。测试覆盖到位(含 non-capable store throws)。
xiaomo merged commit bad62a82a9 into main 2026-05-18 14:59:18 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#13