CtText.text may be a list of runs (text marks href); CtHeading/CtQuote rich,
CtCode verbatim. New runs.sx overrides render/markdown/text methods (byte-
identical for plain strings, opt-in). 4 modes: HTML tags / markdown / nested
SX / plain asText (drift-proof). find-replace per-run marks-preserving;
search across run boundaries; CRDT block-granularity LWW; data+wire round-trip.
Runs are a Smalltalk-renderable list (not a dict — substrate can't read dict
fields under nested render dispatch). +36 tests (44 suites). Phase 6 (char-
level inline CRDT) recorded as future.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Read-side companion to doc-find-deep + reparent: ancestor-section chain
(root-first) for a block id, nil if absent (distinct from () top-level path);
block-depth is the path length. For breadcrumbs / scoping. New suite +13.
Probe this pass found no bugs: clone/remap tree-wide, all block types have
asMarkdown:.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
insert/move were top-level only; a block could never move into/out of a
section. content/move-into (relocate to a section child at index, tree-wide)
+ content/promote (lift nested block to top level, subtree intact). Pure
tree transforms like the rest of move.sx; cycle-safe (rejects moving a block
into its own descendant). +13 tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Enforcement counterpart to validate: removes blocks failing validate's own
per-block id/field checks (reused via content/-block-issues, single-sourced)
so federated/imported input can render safely. Tree-wide; distinct from
normalize (empty vs invalid); keeps valid-shell sections, drops invalid ones.
New suite +12 tests (42 suites total).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Probed the Markdown boundary; found table cells containing | don't round-trip
(asMarkdown emits raw |, md/import splits on every |). Recorded under Known
limitations with repro + two-sided fix sketch. Fix blocked: md-import.sx is
449 lines and all sx-tree edit tools error in this worktree (only
sx_write_file works) — deferred rather than risk a full manual rewrite.
Engine SATURATED at 787/787.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
validate only checked that list items / table rows-headers ARE lists; a
non-string item or non-list/non-string-cell row passed yet crashes asText/
render/find-replace/search. Added ct-all-str?/ct-all-rows? + deepened list/
table branches (guarded against double-reporting). +9 validate tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Facade read-by-id was top-level only while content/edit's update/delete are
tree-wide — could not read back a nested block content/edit just modified.
Added generic ct-find-id (doc.sx) + doc-find-deep/doc-has-deep?; content/find
+ has? now descend into sections. content/find-top/has-top? keep top-level
lookup. Audit: remaining doc-find/ct-index-of callers are positional
insert/move (top-level by design). +6 api tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
content/diff + diff-versions enumerated ids top-level only (doc-ids/
doc-find), so diffs of documents with sections missed every nested add/
remove/change. Now via doc-tree-ids + doc-deep-find; sections excluded from
:changed (no own content), still reported in :added/:removed. Flat-doc
diffs unchanged. +9 store tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
content/search-text + search-text-ids find every block whose (asText b)
contains a term — spanning all text-bearing fields by reusing the canonical
asText projection, so it can't drift from stats/find-replace. Section
wrappers excluded. +7 query tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fr-rewrite dispatches per block type so image alt, list items, and table
headers/cells are renamed alongside text/heading/code/quote/callout —
matching exactly the set asText/stats/word-count fold into prose. Prior
find-replace skipped them, so a rename stayed visible in counts/exports.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>