Skip to content

Drawing views: a view's place parameter is the saved place itself, so the commands stop converting it (#4816) - #17620

Merged
bherbruck merged 1 commit into
tangency-labs:drawingsfrom
CamWight:place-param-reads-as-view-place-4816
Nov 16, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:drawingsfrom
CamWight:place-param-reads-as-view-place-4816

Conversation

@CamWight

@CamWight CamWight commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Change

This is an internal cleanup in SolidCraft's drawing commands. It changes nothing a user sees.

A drawing view's place is either a point on the sheet or a position along the line it shares with its parent view. The saved drawing calls this ViewPlace. The commands that move, edit, inspect and project views had their own copy of it, PlaceParam, with the same two variants. So five commands converted between the two by hand: drawing.view.projected, drawing.view.auxiliary, drawing.view.edit, drawing.view.move and drawing.view.inspect.

Now PlaceParam wraps ViewPlace, as the file's other parameter types (SideParam, StyleParam) wrap theirs. It is only there for its schema.

  • The copy's two variants and both conversions are gone.
  • The five call sites use the saved place directly.
  • A third kind of place would now be one change in the saved record, plus the schema text. A new test forces that text: its exhaustive match stops compiling until the new branch is named.

The published schema is written by hand with exactly the text the derive gave. So every command contract stays byte for byte the same.

This is the first follow-up to #16492 (moving a view on its sheet) for #4816.

Changes a default: no

Validation

On drawings ab2b556, in --profile ci:

  • cargo test -p solidcraft-engine --lib: 11 passed. These are the new test a_place_reads_and_writes_as_the_record_and_its_schema_says_so, the view command tests that read or write a place, schema::coverage_tests, registry_is_consistent and hostile_params_never_panic.

  • Byte-for-byte proof (run once, not committed): the old PlaceParam and the new one publish the same schema, and write the same reply JSON for each kind of place. 3 of 3 passed.

  • 4 planted faults, each caught by its named test:

    • a place's object takes other keys;
    • an edit drops the place;
    • a projected view ignores the place given;
    • inspect replies a wrong place.

    The clean run after them: 4 passed.

  • rustfmt --check, cargo clippy -p solidcraft-engine --all-targets -- -D warnings, and cargo check -p solidcraft-engine --target wasm32-unknown-unknown: all clean.

Not covered: the shared test helper conforms doesn't check inside oneOf. So no existing reply check looks inside a place, and the new test checks each branch itself. Teaching conforms about oneOf is its own change, because it may start failing other areas' reply checks.

Screenshots of the behavior (when observable)

None: nothing changes on screen, and the command contracts are byte for byte the same.

Integration status

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor
Pre-merge checks: Passed 1

Check name Status Explanation
Existing Defaults Unchanged Passed The PR (tangency-labs/solidcraft #17620, author CamWight) changes no UX default. I read the committed diff at HEAD (ecfcc0a, the PR commit). It touches three files: crates/engine/src/cmd/drawing_vi…
Full details: Existing Defaults Unchanged

Explanation

The PR (tangency-labs/solidcraft #17620, author CamWight) changes no UX default. I read the committed diff at HEAD (ecfcc0a, the PR commit). It touches three files: crates/engine/src/cmd/drawing_view.rs, crates/engine/src/schema/drawing_view.rs and crates/engine/src/schema/drawing_view_tests.rs. - The command-side change replaces five hand-written conversions between PlaceParam and ViewPlace with direct use of the saved place. Each fallback when no place is given is kept: staged_place in projected, and ViewPlace::At(parent centre) in auxiliary. In inspect and move_view, the reply's place is the record's place wrapped in PlaceParam. - The schema change rewrites PlaceParam's JSON Schema by hand. The PR says the published text is byte-for-byte the same. The diff shows no change to any default value, setting, preference, shortcut, or layout. Changes under the kernel or geometry (solidcore/) are not UX defaults under this check. The description's Changes a default: no agrees with the code diff. No fail condition applies.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

…, as its sibling parameters do (tangency-labs#4816)

`PlaceParam` was a copy of the record's `ViewPlace`, with a conversion at each of five commands. It is now a
transparent wrapper over `ViewPlace`, like `SideParam` and `StyleParam`, there for its schema. The conversions
go. The schema is written by hand with the text the derive gave, so every contract publishes the same bytes. A
test checks that what the record writes fits exactly one branch of that schema, and that what the reader
refuses fits none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CamWight
CamWight force-pushed the place-param-reads-as-view-place-4816 branch from 2aa55e7 to ecfcc0a Compare November 16, 2026 09:52
@CamWight

Copy link
Copy Markdown
Contributor Author

Rebased onto drawings after #13045 (auxiliary and pictorial views) and #13033 (flat pattern views). The head is now ecfcc0a.

  • drawing.view.projected now makes a projected or a pictorial view, each with its own default place. The given place still reads straight through: request.place.map_or(staged_place, |place| place.0).
  • Drawings: auxiliary and pictorial views made from a parent view (#13044) #13045's new drawing.view.auxiliary had a fifth hand conversion of the place parameter. It uses the same one-liner now, and the description says five commands.
  • Checked: the drawing view and schema tests pass, and fmt and clippy are clean. A planted fault in each of projected, auxiliary and edit is caught. The published schema is byte for byte unchanged.

@bherbruck
bherbruck merged commit a237a91 into tangency-labs:drawings Nov 16, 2026
31 of 35 checks passed
@CamWight
CamWight deleted the place-param-reads-as-view-place-4816 branch November 16, 2026 13:20
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.

2 participants