Share core-owned immutable elements and validation facts

This commit is contained in:
2026-11-10 16:07:02 +08:00
parent c8e5f6ac49
commit a6092e61cd
7 changed files with 128 additions and 35 deletions
+17
View File
@@ -855,3 +855,20 @@ step. The existing recursive codec still checks nested mutability and depth, so
mutable values and external Maps are re-read. This is an encoding cache, not a
second state table; recovery JSON order, formats and journal checks remain the
same. Replacing a table gets a new entry view and leaves prior images unchanged.
Static element validation proofs apply only to records detached and deeply frozen
by the core's element-data factory. Document construction, element replacement
and staged creations share this private provenance. A separate WeakSet records a
successful intrinsic shape check. Registry support, tombstones, owner membership and connection topology remain
live checks. Custom schemas are always called with their original receiver.
Only framework-owned data-only validators can reuse a successful result for the
same detached record and current validator function; their private proof keeps
one validator identity per record.
External or shallow-frozen records never gain a proof. Field updates without
factory provenance use the complete path. Document equality rejects different
table sizes before allocating entry arrays; equal-sized tables keep the existing
ordered comparison and no-op rules.
Synchronous document validation loops directly over the same per-record checks
used by the cooperative iterator. The iterator retains its original yield points;
the atomic publication path does not pay a generator handoff per unchanged record.