Skip to content

Add the mdbase.comment contract pack - #13

Merged
callumalpass merged 1 commit into
mainfrom
feat/comment-contract
Sep 29, 2026
Merged

callumalpass merged 1 commit into
mainfrom
feat/comment-contract

Conversation

@callumalpass

Copy link
Copy Markdown
Contributor

Adds mdbase.comment 1.0.0: comments, replies and suggested edits stored as their own records rather than markup in the commented record.

  • A thread's first comment carries the anchor (target) and state (status, resolved_by, resolved_at); each reply is a separate record whose in_reply_to links to it, so concurrent replies never conflict.
  • Anchors reuse Reader's persisted selector shapes: target.quote (exact/prefix/suffix) is authoritative, and target.text_position records offsets in Unicode code points of the Markdown body after the frontmatter (profile markdown-body, sha256: basis hash). An empty exact is an insertion point.
  • motivation: editing with suggestion.replacement is a suggested edit; suggestion.outcome records accepted/rejected.
  • document, in_reply_to, created_by and resolved_by are links declared with validate_exists: false, so comments on deleted records are kept, not invalid. Withdrawing sets deleted_at and empties the body.

scripts/comment-contract.test.mjs covers the schema and that the starter type matches it. npm test builds and verifies all packs with MDBASE_VERIFY_CLI set to the mdbase 0.1.0-beta.117 CLI; the four Person-pack upgrade failures reproduce identically on main and are unrelated. Installing the pack with that CLI and validating sample records accepts a comment whose document and author no longer exist and rejects a suggestion without a target.

mdbase writer embeds the published provision for its comments.

Comments, replies and suggested edits as records of their own, anchored to
a quote of the commented record's Markdown body (Reader's target.quote and
target.text_position shapes, in Unicode code points of the body after its
frontmatter). Replies link to the thread's first comment; authors link to
mdbase.person records. Links tolerate deleted targets, and withdrawing a
comment empties it instead of deleting it.

The pack ships the contract, its schema and an editable seed comment type.
@callumalpass
callumalpass merged commit 6fee9ea into main Sep 29, 2026
1 check passed
@callumalpass
callumalpass deleted the feat/comment-contract branch September 29, 2026 13:33
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