Skip to content

feat: expose Rust-owned mdast provenance - #78

Merged
Iktahana merged 9 commits into
mainfrom
agent/rust-mdast-provenance
Aug 14, 2026
Merged

feat: expose Rust-owned mdast provenance#78
Iktahana merged 9 commits into
mainfrom
agent/rust-mdast-provenance

Conversation

@Iktahana

@Iktahana Iktahana commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #77.

Summary

Implements a versioned Rust-owned mdast provenance contract for deterministic editor bridges. Rust attaches mdiProvenance@1.0 only on the dedicated Rust-to-mdast parse boundary. @illusions-lab/mdi-remark transports it to node.data.mdiProvenance without parsing or inferring identity/ranges. Standard MDI/Python/FFI IR remains unchanged.

Contract

MdiMdastProvenance provides version, Rust IR construct path/type, original UTF-8 span, zero or more canonical projection targets (block index, blockText/annotation channel, grapheme range and annotation index), plus container | textBearing and sourceBacked | synthetic | unmapped. It is transient mdast data and does not affect canonical MDI, Markdown, HTML, clipboard, or persisted semantics.

Downstream use

Record node.data.mdiProvenance directly while creating the editor document. Join later resolveMdiSourceSpans(source, spans) results through recorded Rust-owned targets; do not use DOM/ProseMirror traversal, text equality, substring search, or source order.

Validation

  • cargo test --lib (69 passed)
  • pnpm typecheck
  • pnpm test
  • MDI_BROWSER_ENGINES=Chromium pnpm test:browser (packed consumer and Node/browser provenance parity)

No package versions are changed or published by this PR.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.53265% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
nodejs/packages/mdi/src/internal/mdast.ts 0.00% 10 Missing ⚠️
mdi-core/src/text_projection.rs 98.25% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

…enance-merge

# Conflicts:
#	mdi-core/src/lib.rs
#	nodejs/browser-test/src.ts
#	nodejs/packages/mdi/src/index.ts
#	nodejs/scripts/test-browser-wasm.mjs
@Iktahana
Iktahana marked this pull request as ready for review August 14, 2026 05:03
@Iktahana

Copy link
Copy Markdown
Contributor Author

Provenance hardening is ready in stacked draft PR #79, based on this branch. Full CI is green (Rust platforms, Node/browser, Python, Swift, Android instrumented tests, performance, publication contracts, and Codecov). After review, cherry-pick commit ebdff8f; I did not update or rewrite the PR #78 branch.

@Iktahana
Iktahana merged commit 08fea73 into main Aug 14, 2026
22 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.

Expose Rust-owned mdast provenance for deterministic editor bridges

1 participant