Skip to content

docs: Rust core port plan — decompose #6 into actionable sub-issues#31

Open
LeslieOA wants to merge 1 commit into
developfrom
docs/rust-core-port-plan
Open

docs: Rust core port plan — decompose #6 into actionable sub-issues#31
LeslieOA wants to merge 1 commit into
developfrom
docs/rust-core-port-plan

Conversation

@LeslieOA

Copy link
Copy Markdown
Member

Summary

Adds docs/rust-core-port-plan.md (~250 lines). Converts #6 from a single XL block into a structured plan with six open architectural questions for you to answer, and a proposed decomposition into 14 sub-issues that get filed once those questions are answered.

This PR is not a commitment to start coding. It's a conversation starter that makes #6 reviewable, decision-able, and ready to chunk into parallel work.

Why this is the right next step

Everything we shipped in #2 (port) / #3 (renderer port) / #4 (history refactor) / #5 (Partial → variants) was Rust-port prep. The API is now FFI-friendly. But #6 itself has been "XL, undefined" — anyone picking it up has to make decisions about UniFFI vs JSI, rollout shape, build integration, and testing strategy before writing any Rust. This doc surfaces those decisions explicitly and proposes answers.

The six open questions

# Question Recommendation
1 Rollout: big-bang vs parallel-with-flag vs per-function migration? Parallel with flag, 6-month overlap
2 Native FFI tooling: UniFFI vs JSI direct vs Turbo Modules? UniFFI + JSI direct as escape valve
3 Web WASM loading: separate file vs inline base64? Separate file (matches Skia pattern)
4 Scope creep — port markdown rendering too? No (out of scope; would need comrak / pulldown-cmark or port unified/remark)
5 Timing — start soon or sit while we prove out more renderer / harness work? Your call
6 Rust expertise — internal or external? Your call

Proposed sub-issue decomposition

14 sub-issues, 2 L / 5 M / 7 S, rough dependency order. Most can run in parallel. Realistic delivery: 4-8 weeks elapsed with focused part-time work.

# Title Size
1 chore(rust): set up Cargo workspace + jsoncanvas-core crate skeleton S
2 feat(rust): port types.ts to Rust structs/enums with serde S
3 feat(rust): port parseCanvas / serializeCanvas M
4 feat(rust): port spatial-index M
5 feat(rust): port operations + canvas-state + history L
6 chore(rust): UniFFI interface + bindgen for iOS M
7 chore(rust): UniFFI bindgen for Android + macOS S
8 chore(rust): wasm-bindgen integration for web M
9 feat(rust): TS facade layer S
10 chore(rust): Expo config plugin for native builds M
11 test(rust): cross-impl conformance test runner S
12 test(rust): property-based round-trip tests S
13 feat(rust): opt-in flag for Rust impl (default off) S
14 docs: migration guide for consumers S

What's deliberately NOT in this plan

Surfaced in the doc itself (§10) but worth flagging: a bytecode cache for parsed canvases, streaming parse, persistent / mmap'd storage, multi-canvas state. All real ideas; none belong in #6. Each could be its own follow-up after Rust ships.

How to use this PR

  1. Read the doc (it's 250 lines, mostly structured tables and lists)
  2. Answer the six open questions (in PR review, on feat(core): port pure-logic core to Rust (JSI native + wasm-bindgen web) #6, or here)
  3. I file the 14 sub-issues, update feat(core): port pure-logic core to Rust (JSI native + wasm-bindgen web) #6's body to point at them as an umbrella
  4. Sub-issues get prioritised and picked up independently

Verification

Refs: #6

#6 ("port pure-logic core to Rust") has been a single XL backlog item
since the initial audit. Daunting to start in that shape — anyone
picking it up has to make a dozen architectural decisions before
writing any code.

This commit adds docs/rust-core-port-plan.md with:

- Scope (what ships in Rust, what stays in TS)
- Rollout decision options (big-bang vs parallel-with-flag vs
  per-function migration) with a recommendation
- FFI tooling decision options for native (UniFFI vs JSI direct vs
  Turbo Modules) and for web (wasm-bindgen as the de facto choice)
- Cross-impl conformance testing strategy — re-use the 168 tests
  from #16 against both impls as the safety net
- Native build integration sketch (Expo config plugin + react-native
  fallback for bare RN consumers)
- A decomposition into 14 sub-issues (2 L, 5 M, 7 S) in rough
  dependency order, with brief scope per sub-issue
- Six open architectural questions for the maintainer to decide
  before any of the sub-issues get filed
- What was deliberately NOT included (bytecode cache, streaming
  parse, persistent storage, multi-canvas state — all real ideas,
  none belonging in #6)

Once the maintainer signs off on the open questions, the 14
sub-issues land on the project board and #6 becomes an umbrella
tracker. Until then, this doc is the conversation starter — not a
commitment to start coding.

README's Development section gains a brief "Strategic direction"
subsection pointing at the plan and the umbrella issue, so anyone
landing on the README sees the trajectory without having to dig.

No code changes. Library checks (38/38 tests, typecheck clean, lint
exit 0) pass on this branch as expected.

Refs: #6

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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