Skip to content

CND 0.5.0 core: rich text, block containers, traversal, validation, hashing - #8

Merged
Maxanox merged 11 commits into
format-0-5-0from
cnd-17-implement-the-cnd-0-5-0-core
Oct 13, 2026
Merged

Maxanox merged 11 commits into
format-0-5-0from
cnd-17-implement-the-cnd-0-5-0-core

Conversation

@Maxanox

@Maxanox Maxanox commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Moves the SDK core to format 0.5.0, following proposal 0013. This is the first of the three plans that land on the format-0-5-0 integration branch.

What changes

  • Rich text (cnd.core.text): RichText, Mark and Numbering. The four edge families now live on RichText instead of the node base.
  • Node model:
    • prose is RichText;
    • every container holds nodes in children: list items, term definitions, cells, quotes, admonitions, footnotes;
    • new admonition and layout nodes;
    • ListItem.checked, figure.description, code.title and numbering;
    • table.kind (data / content / null);
    • doc.status, doc.version and doc.extra.
    • tight, content_kind, table.raw and the block flags are removed.
  • Traversal enters every container. Each visited node carries slot, slot_index and a full path. Cnd.iter_all() also walks footnote content.
  • Validation adds:
    • the mark rules (bounds, canonical order, same-kind merge, atomic code/math);
    • text span bounds;
    • the doc.extra key rule;
    • global id uniqueness.
      Every check now reaches footnote content and the formatted bibliography entries.
  • Hashing:
    • default-valued fields are dropped, and the schema now states every default;
    • nested nodes are excluded from a node's hash;
    • the document hash pairs every node with its path.
    • Vectors are regenerated, and a twin fixture with every default written out proves that omission does not change a hash.
  • Fixtures are migrated to 0.5, and elements.cnd covers every new element.
  • Spec and ADRs: the spec is rewritten for 0.5.0. New ADRs 0025 (edges belong to rich text), 0026 (open vocabularies), 0027 (no compatibility guarantee before 1.0) and 0028 (hashing; supersedes 0016).

Not in this pull request

Ten test modules are parked in tests/conftest.py (collect_ignore): builder, CLI, converters, declaration, full coverage, Markdown structure, display visitor, reconciliation, render and visitor. The next two plans port renderers and converters, then the declaration, builder, reconciliation, CLI and visitors. format-0-5-0 merges into main only once that list is empty.

The suite is green: 199 passed. Every task was reviewed, and the whole branch had a final review, with its findings fixed.

Part of CND-17

🤖 Generated with Claude Code

https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS

Maxanox and others added 11 commits October 13, 2026 10:25
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
Move the forward edge classes and RawSource into cnd.core.text, add
Edge, Mark, RichText and Numbering, and regenerate the schema for the
reworded NodeRef description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…onition, layout (proposal 0013)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
… the schema

Migrate the six top-level fixtures to 0.5.0 (heading refs into text, grid
table to layout, nested list item to nested list node), add
fixtures/elements.cnd, regenerate schema/cnd.schema.json, and port
test_cnd.py and test_schema.py out of collect_ignore. Two tests added:
elements fixture coverage and incoming() reading edges from texts.

No tests deleted; no assertion needed loosening.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…h in the context

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…t (proposal 0013)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…ths in the document hash

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…ts twin fixture

Field(default_factory=list|dict) left no default in the generated schema,
so the section 10 rule could not be followed from the schema alone. Use
literal defaults, regenerate the schema and vectors, add
elements_explicit.cnd (every default written out) which must hash like
elements.cnd, list the defaults in spec section 6, walk iter_all() in
Cnd.paginated, clarify iter_nodes path docs, rewrap the NodeRef docstring.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…pty marks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…ries; test paginated on footnote-only CNDs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
@Maxanox
Maxanox merged commit 43f9643 into format-0-5-0 Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant