Skip to content

Live co-editing: what changed between two versions of a design, and what each change touched (#5184) - #7683

Draft
CamWight wants to merge 12 commits into
tangency-labs:mainfrom
CamWight:coedit-x1-5184
Draft

CamWight wants to merge 12 commits into
tangency-labs:mainfrom
CamWight:coedit-x1-5184

Conversation

@CamWight

@CamWight CamWight commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Live co-editing: what changed between two versions of a design, and what each change touched (#5184)
Nothing changes for the person using SolidCraft yet: nothing calls it. Live co-editing needs to tell people when their changes and someone else's touch the same thing. This compares two versions of a design and says what changed, feature by feature, and which other parts each change reached, for the merge and overlap warnings to come.

A live co-editing slice (#5184, claim #7547). It is pure: nothing calls it yet. The merge and overlap warnings in later slices read it.

#7682 (the testkit crate) has landed, so this PR holds only its own two commits:

  1. Features: one definition of inputs, derived and bookkeeping fields (CE8). Feature::field_role and Feature::definition in doc say which of a feature's saved fields are:

    • who it is;
    • names kept for its inputs and picks;
    • heavy payloads;
    • fields evaluation writes back (pinned body names, a linked design's face names);
    • what a person sets.

    timeline.inspect and timeline.edit's unknown-field message read them, instead of the engine's private NOT_EDITABLE and heavy_fields. No behaviour change: a test pins timeline.inspect's definition, its omitted fields and its inputs.

  2. The design compare (X1-1).

Changes a default: no

What it does

doc::design_diff::diff(base, head) lists the features, parameters, components and joints that were added, removed, changed, moved, renamed or (un)suppressed. Each changed input comes with its expression and value before and after. The design's other fields that differ are listed by name.

  • Pairing: items pair by id with the base's, and the base must be the changeset's parent. Document::next_item_id now counts every id in use, so a new item never takes one.
  • Parameters: one whose expression is the same but whose value follows another is Recomputed. What uses a changed parameter is listed with it.
  • Not a person's change (Resolved): what evaluation writes back.
    • pinned body names (from CE8's roles);
    • a sketch solved again for something it uses;
    • a placement its joints moved.
      A sketch whose points moved with nothing it uses changed is a drag, so it counts as an edit.
  • View state (marker, hidden bodies, named views, browser order and folders) is ignored.
  • Cost: heavy fields are compared in place, and each design's parameters are evaluated at most once.

Touched is its one projection. It holds the components, features, joints and parameters of the base that a person edited, or that something was added inside. overlaps intersects two of them through the component tree:

  • Edits: the same target, or one holding the other, overlap. An addition inside never overlaps.
  • The design's own fields (materials, render, name, ...) are targets of their own. Each overlaps only an edit of the same field.
  • Units: a units change overlaps everything the other side touched, additions included, since every length is read in them.

Tests

  • Every kind of change on its own, with values before and after.
  • What evaluation writes back, as Resolved.
  • Ids and pairing, including a feature of another type under the same id.
  • Overlaps:
    • through nested components and a feature's bodies;
    • additions, which never overlap;
    • a design field against the same field (caught) and against a part's edit (no warning);
    • units against edits, joints, parameters and an added box.
  • Damaged designs: a component tree with a loop, repeated ids, a counter at zero.
  • Fuzz (changesets_from_anyone_never_panic): 3,097 testkit mutations of a rich design's JSON (sketch, parameter, nested components, placement, joint, materials, comments, metadata). Each one is read and compared both ways, then put through Touched and overlaps.
    • No panic; the slowest case took 0.35 ms.
    • The fuzz must keep reaching the compare: 129 mutations change what is touched (at least 50 asserted), and 28 change the design's own fields (at least 10 asserted).
    • On every mutation, units overlap exactly what the other side touched.
  • A sketch that projects nothing, dragged after an earlier feature changed, is still a change: only a sketch that projects something can be moved by what comes before it.
  • Planted faults: 25, each caught, among them 4 on the field and units rule and 2 more on units against additions.

Checks

Latest, on this head 4f00d5d9f over main 38598a786, local, Windows, --profile ci, on each of its two commits:

What this rebase changed: main's #12729 added pub mod csv; on the line where X1-1 adds pub mod design_diff;. Both are kept, in sorted order.

Before, on dc93723f3 over main 1e6b1ec20, local, Windows, --profile ci, on each of its two commits:

  • fmt, lists and layers pass.
  • clippy -D warnings on doc and engine, all targets, passes. It ran with unused_variables allowed, because main fails it on Windows on its own (crash_tests.rs:209, a variable only used on Unix: Windows: clippy -D warnings fails on an unused variable in crash_tests.rs #13160).
  • doc's library tests: 672 passed, 2 failed (651 passed, 2 failed with CE8 alone).
  • The engine's edit tests: 55 passed, 1 failed.
  • All three failures fail on main too, and are listed in tests/KNOWN_FAILING_TESTS.
  • It merges cleanly with main as it is now (8706d623f), and doc and engine build with all targets after that merge.

No full gate on this head.

What this rebase changed:

Merging with others: most open PRs on the same files merge cleanly, or only need two neighbouring lines kept. Two need more:

Before, on ddd816291 over main 8312bf0cb, local, Windows, --profile ci: fmt passes; the workspace builds with all targets; clippy -D warnings on doc and engine, all targets, passes; doc's library tests: 627 passed, 2 failed, both listed in tests/KNOWN_FAILING_TESTS; the engine's edit tests: 53 passed, 1 failed, inserting_variable_fillet_control_preserves_parameters_at_existing_positions, also listed there (solidcore#430). No full gate on this head.

What this rebase changed:

Before, on 50c09da67 over main 6cee7a91b, local, Windows, --profile ci: fmt passes; clippy -D warnings on doc and engine, all targets, passes; doc's library tests: 563 passed, 0 failed, 1 ignored; the engine's edit and timeline tests: 206 passed, 0 failed. No full gate on this head.

What this rebase changed:

  • edit_tests.rs: main added assistant_toggle_is_refused_headlessly_without_changing_the_document where CE8's timeline.inspect test goes, and both stay.
  • params.rs: main's Parameters: one meaning for value in every reply; round reported numbers (#10747) #10812 gave each row value in base units and display_value in the shown unit, both rounded as reported. The compare's param_rows_in keeps both. A parameter is still Recomputed when its value changes, now judged in base units.

Before, on 5f7dada8c over main 446590dca: fmt and lists pass; clippy on testkit, doc, io and engine, all targets, passes; the library tests of those four crates, the engine's included for the first time: 3,866 passed, 0 failed, 12 ignored. That run was on af2771978; this head only formats one test's list. No full gate since this rebase.

What this rebase changed: Component.history_hidden (#10393) is a saved field, so a comparison lists it and the component test changes it. timeline.inspect keeps main's type and type_name beside CE8's definition. Tests added beside others on main in doc/src/tests.rs and edit_tests.rs are all kept.

The notes below are from earlier rebases:

Latest, on this head c703df2f7 over main 7366fe0ec: fmt passes; clippy on testkit, doc, io and engine, all targets, -D warnings, passes; the tests of testkit, doc and io: 736 passed, 0 failed, 4 ignored. No full gate has run since this rebase, and the engine's tests didn't run in this pass; one gate runs before it leaves draft.

What changed in this rebase:

The checks below are from before this rebase.

Local gate (Windows) over the whole co-editing stack (#7682, #7683, #7684 and #7685 together) on main 66bd64c:

  • every commit builds on its own;
  • fmt, clippy, assets, icons, licences, lists, layers, ui-containers, wasm and web offline pass;
  • every crate's tests (the stack changes Cargo.lock, so all of them run): 10,104 passed in 86 test binaries, 71 ignored, none failed.

Then each PR's branch was rebased onto main ab67126. The only conflict was two new tests side by side in doc/src/tests.rs; both are kept. The new crates' Cargo.lock lines are at the workspace's 0.27.1. On that main, each branch builds with its lock as committed (cargo check --locked --tests), and each slice's own tests pass again:

  • design compare: solidcraft-doc library, 517 passed;
  • roles: the engine's collaboration tests, 33 passed;
  • wire: solidcraft-collab-wire, 16 passed, and the engine's size checks on real bodies.

@github-actions github-actions Bot added area:doc timeline, components, parameters, naming area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs) labels Oct 27, 2026
@CamWight CamWight changed the title Design compare: what changed between two designs, and what it touched (#5184) Co-Editing: Design compare / what changed between two designs, and what it touched (#5184) Oct 29, 2026
@CamWight CamWight changed the title Co-Editing: Design compare / what changed between two designs, and what it touched (#5184) Live Co-Editing: Design compare / what changed between two designs, and what it touched (#5184) Oct 29, 2026
@CamWight
CamWight force-pushed the coedit-x1-5184 branch 3 times, most recently from 186410d to 5645b10 Compare October 30, 2026 12:47
@CamWight
CamWight force-pushed the coedit-x1-5184 branch 2 times, most recently from c703df2 to 5f7dada Compare November 1, 2026 22:19
@CamWight CamWight changed the title Live Co-Editing: Design compare / what changed between two designs, and what it touched (#5184) Live co-editing: what changed between two versions of a design, and what each change touched (#5184) Nov 2, 2026
@CamWight
CamWight force-pushed the coedit-x1-5184 branch 2 times, most recently from 50c09da to ddd8162 Compare November 5, 2026 16:35
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CamWight and others added 2 commits November 9, 2026 03:07
…angency-labs#5184, CE8)

`Feature::field_role` and `Feature::definition` in doc say which of a feature's saved fields
are who it is, names kept for its inputs and picks, heavy payloads, fields evaluation writes
back (pinned body names, a linked design's face names), and what a person sets.
timeline.inspect and timeline.edit's unknown-field message read them instead of the engine's
private NOT_EDITABLE and heavy_fields; the design compare will too. No behaviour change: a test
pins timeline.inspect's definition, omitted fields and inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tangency-labs#5184, X1-1)

`doc::design_diff::diff(base, head)` lists the features, parameters, components and joints that
were added, removed, changed, moved, renamed or (un)suppressed, with each changed input's
expression and value before and after, and the design's other fields that differ. Items pair by
id with the base's, which must be the changeset's parent; `Document::next_item_id` now counts
every id in use, so a new item never takes one. A parameter whose expression is the same but
whose value follows another is `Recomputed`, and what uses a changed parameter is listed with it.
What evaluation writes back is not a person's change: pinned body names (`Feature::field_role`,
CE8), a sketch solved again for something it uses, and a placement its joints moved are
`Resolved`; a sketch whose points moved with nothing it uses changed is a drag. View state is
ignored. Heavy fields are compared where they are, and each design's parameters are evaluated at
most once.

`Touched` is its one projection: the components, features, joints and parameters of the base a
person edited, or that something was added inside, and `overlaps` intersects two of them through
the component tree (an addition inside never overlaps). Each of the design's own fields (materials,
render, name...) is a target of its own and overlaps only an edit of the same field; a units
change overlaps everything the other side touched, additions included, since every length is
read in them. Pure, no model evaluation; nothing calls
it yet. A mutation fuzz runs changesets of a damaged or hostile design through both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight and others added 4 commits November 11, 2026 19:54
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CamWight and others added 6 commits November 21, 2026 06:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming area:io import/export and file formats (STEP, IGES, 3MF, glTF, designs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant