Skip to content

RFC 0002: osign v0.2 (strict JSON Canvas 1.0 compatibility) - #1

Merged
j1philli merged 1 commit into
mainfrom
rfc/0002-osign-v0.2
Nov 6, 2026
Merged

j1philli merged 1 commit into
mainfrom
rfc/0002-osign-v0.2

Conversation

@j1philli

@j1philli j1philli commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

This proposes osign v0.2. It makes every osign file a valid JSON Canvas 1.0 file, which v0.1 isn't today: the bundled examples fail strict validation with 25 and 152 violations (node types such as frame/shape, text nodes without text, and fromNodeId/toNodeId edges).

What's in the RFC

  • Two layers per node.
    • The JSON Canvas fields form a real preview that any JSON Canvas tool can render.
    • Precise design data lives under one namespaced osign key.
    • type, the integer x/y/width/height and color are derived.
    • Edits made by JSON Canvas tools (Obsidian) are reconciled by normative rules, not overwritten.
  • Structure. osign.parent is the single containment relation, array order is z-order, and transforms are parent-relative with rotation.
  • Documents. A design.osign/ directory with one valid .canvas file per page and content-addressed assets/. A single .canvas file remains a valid one-page document.
  • Style. A typed paint, stroke and effect model shaped like Figma's, so import stays lossless. Node-level visible, locked, opacity and blendMode.
  • Text. A text style object. JSON Canvas text is Markdown, so content is escaped and Markdown viewers display it literally.
  • Canonical serialization, so two writers produce identical bytes and git diffs stay minimal.
  • Git integration (informative). A semantic merge driver and a textconv diff.
  • Migration from 0.1.

Validation

A reference implementation in Rust was built and tested against this design. It will come to this repo as a follow-up PR (proposed: replacing the Kotlin parser as the reference implementation).

  • Round-trip property test: 2,000 random documents all write as strict JSON Canvas, read back with no reconciliation, and re-write to identical bytes.
  • Simulated Obsidian edits: moving a group with its contents, resizing, recoloring, adding and deleting nodes, all reconciled correctly.
  • Markdown escaping: a property test checks that unescape(escape(s)) == s.
  • Migration: both bundled 0.1 examples migrate to valid JSON Canvas with geometry preserved.
  • Merges in real git repositories:
    • Git's line merge conflicted in 4 of 6 compatible scenarios; the semantic driver merged all 6 correctly.
    • The driver reported both true conflicts (the same property changed on both sides, and overlapping text edits).

Not in this PR

  • Code changes. The Kotlin parser and viewer still read 0.1.
  • Auto-layout, detailed component overrides, variables and mixed-style text runs, which are listed as future RFCs.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@j1philli
j1philli merged commit 5a56634 into main Nov 6, 2026
1 check passed
@j1philli
j1philli deleted the rfc/0002-osign-v0.2 branch November 6, 2026 02:15
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