Repository navigation
Plugin panels: semantic surface events with explicit identity + owner-targeted delivery (S04, api v29) - #3530
Merged
HakanSeven12 merged 3 commits intoNov 23, 2026
Conversation
… part 1, api v29)
The event leg of the panel-surface train: a semantic event vocabulary
with EXPLICIT event identity, and the wire notification that carries it
to the owning plugin — best-effort by contract, never acknowledged by
re-publishing values (finding F2: identical-looking activations are
DISTINCT events; equality is not identity).
scene.rs (ungated — the pure store and the wire share the vocabulary):
- SurfaceEvent: ElementClicked{element,pos} (press+release without
drag; the plugin binds its own semantics to the element id — the
host never interprets scene vocabulary), DragStarted{element,origin},
DragMoved{element,pos} (COALESCABLE — positions are absolute, so
dropped intermediates lose nothing), DragSettled{element,pos} (THE
authoritative settle: exactly one per drag, never coalesced away),
DragCancelled{element,origin} (pre-drag origin, lossless restore).
- Per-surface monotonic sequence numbers are the event identity; they
ride the notification, not the event enum.
Wire: HostNotification::PanelSurfaceEvent { panel_id, sequence, event }
(tag 16, appended after the v27 delta's 15 per the established
append-only tag story; pinned by panel_surface_event_notification_tag_is_sixteen
with the length-prefixed tag offset the legacy pins use). The runner's
notification_api_version gate returns 29 for the variant — a v28
runner can never receive a tag it cannot represent.
Deliberately absent (S04 continues): the host-side router/canvas seam
and delivery (app-owned, next commit), and any prompt/table state
machines (out of scope by mission).
Verification: cargo test -p ocs_plugin_api --all-features 199 passed /
0 failed / 1 ignored (new: tag-16 pin + sequence/payload round-trip).
Pre-existing upstream baseline failures (windows D3D12 trait errors at
this base SHA — see HakanSeven12#3460 discussion — plus fmt/clippy informational
jobs) are inherited and untouched.
…am (S04 part 2, api v29) The host-owned input half of the event stage, as pure testable logic: - app/panel_events.rs (no renderer, no wire, wasm-clean): PanelEventRouter turns pointer transitions into ordered best-effort notifications. Click contract: press begins a POTENTIAL drag (no event yet); the first move emits DragStarted (pre-drag origin) plus a coalesced DragMoved; further moves COALESCE (absolute positions — dropped intermediates lose nothing); release after moves emits exactly one DragSettled; release without moves emits ElementClicked. Cancellation restores the pre-drag origin losslessly; a cancelled potential drag emits nothing and burns no sequence numbers. One pointer, one law: a new press settles (or silently drops) the in-flight drag first — at most one settle per drag, what the preview showed is what settles. Per-surface monotonic sequences are the explicit event identity: identical-looking clicks carry distinct sequences (F2). - v4_support.rs: publish_surface_event_to_plugin — owner-targeted delivery of HostNotification::PanelSurfaceEvent (grip_endpoint + best-effort notify, the same guarded path and dead-owner law as every v4 notification). Panel surfaces are plugin-owned: no fan-out. Verification: cargo test --lib -p OpenCADStudio -- panel_events 6 passed / 0 failed (click identity, drag start/coalesce/settle, lossless cancel restore, cancelled-potential silence, cross-panel press settle); cargo test -p ocs_plugin_api --all-features 199 passed / 0 failed / 1 ignored. Part 3 (next): the canvas pointer seam (hit-test against cached prims, Program::update pushing the pointer Message), the dispatch arm routing through PanelEventRouter to publish_surface_event_to_plugin, and the host-local drag preview in the canvas paint.
…iew (S04 part 3, api v29)
The event stage's live seam: a published scene's canvas now translates
raw pointer input into semantic events, routes them through the pure
router, and delivers them to the OWNING plugin — with a host-local
drag preview that never touches the stored scene.
- Prims carry their element: ScenePrim::element (hit-testing and the
preview target); project_elements sets it.
- hit_test: the topmost prim containing the scene-space point (bounding
boxes, deliberately coarse — the plugin owns finer semantics).
- SceneCanvas::update (the vendored canvas Program::update, Option<
Action>): left press/release/cursor-move inside bounds publish
Message::PanelSurfacePointer { owner, panel, pointer, element, pos };
scene space equals canvas-local space (S01 no-transform invariant).
- dispatch: the PanelEventRouter owns the semantics (click vs drag,
move coalescing, at-most-one settle, lossless cancel); each routed
event goes out owner-targeted via
v4_support::publish_surface_event_to_plugin. Desktop-only delivery —
the web runtime has no plugin host and its routed events die there
(paired-stub convention; no surface can exist on web).
- Host-local preview: the canvas paints the dragged element shifted by
(preview pos − origin) at PAINT time; the stored scene, the retained
cache and the plugin's data are untouched until the plugin settles
with its own patch.
Verification: cargo test --lib -p OpenCADStudio -- panel_events
panel_surfaces plugin_scene 22 passed / 0 failed; cargo test
-p ocs_plugin_api --all-features 209 passed / 0 failed / 1 ignored;
cargo check --lib -p OpenCADStudio clean; wasm32 check green for
OpenCADStudio + ocs_web_worker (recorded). Pre-existing upstream
baseline failures (windows D3D12 trait errors, fmt/clippy
informational jobs) inherited and untouched.
This was referenced Nov 23, 2026
Plugin panels: semantic button rows on widget surfaces; menus reuse quad panels (S06, api v29)
#3545
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and minimal scope
Stage 4 of the atomic panel-surface train (#3460 scene publish, #3510 patches — both merged): the event leg. A panel surface's canvas now translates raw pointer input into best-effort semantic events, routes them through a pure host-owned state machine, and delivers them to the OWNING plugin only. Finding F2's contract exactly: events are never acknowledged by re-publishing values, identical-looking activations are DISTINCT events (per-surface monotonic sequences are the explicit identity), drag moves are COALESCED (absolute positions — dropped intermediates lose nothing), and
DragSettled/DragCancelledare authoritative and never dropped. Host-local drag preview: paint-time only, the stored scene and the plugin's data are untouched until the plugin settles with its own patch.Public API / wire changes and current API-major basis
Based on upstream
mainat0f00b8c2c(v29, declared by #3460; patches by #3510). No new API major — this stage rides v29's notification tail:scene.rs(ungated):SurfaceEvent—ElementClicked{element,pos},DragStarted{element,origin},DragMoved{element,pos},DragSettled{element,pos},DragCancelled{element,origin}(append-only enum).HostNotification::PanelSurfaceEvent { panel_id, sequence, event }— notification tag 16 (appended after the v27 delta's 15 per the established append-only tag story; pinned). The manual serde arms follow the file's exact per-variant framing.runner.rsnotification_api_versiongate: the variant maps to 29 — a v28 runner can never receive a tag it cannot represent.Explicit non-goals and dependency
Depends on #3460 + #3510 (both merged — rebased onto their result). Non-goals: prompt/table state machines, any per-event acknowledgement or realignment, widget-surface events beyond the shared vocabulary (S05 uses
NodeActivated-style appends if needed), text-selection or keyboard routing.Semantics (the pure router,
app/panel_events.rs— unit-tested, no renderer/wire coupling)DragStarted(pre-drag origin) + a coalescedDragMoved; release after moves emits exactly oneDragSettled; release without moves emitsElementClicked.v4_support::publish_surface_event_to_plugin— owner-targeted (grip_endpoint, no fan-out; panel surfaces are plugin-owned), best-effort (a dead owner's event drops silently, the same law as every v4 notification).SceneCanvas::updatehit-tests the retained prims (each prim carries its element's StableId) and publishes pointer messages; scene space equals canvas-local space (S01 no-transform invariant). Desktop-only delivery — the web runtime has no plugin host and its routed events die at the dispatch arm (paired-stub convention; no surface can exist on web).Legacy compatibility
Existing notification tags untouched (16 appended);
HostNotification::Unknownpassthrough and pre-29 plugin streams unchanged; panels without scenes render their exact legacy trees; the canvas seam is inert without a published surface. A v28 runner cannot decode tag 16 (gate).Verification (exact commands, exit 0)
cargo test -p ocs_plugin_api --all-features→ 209 passed, 0 failed, 1 ignored (includes: tag-16 pin with the length-prefixed offset the legacy pins use, sequence/payload round-trip, gate mapping).cargo test --lib -p OpenCADStudio -- panel_events panel_surfaces plugin_scene→ 22 passed, 0 failed (router: click identity, drag start/coalesce/settle-once, lossless cancel restore, cancelled-potential silence, cross-panel press settle, per-surface monotonic sequences; store + renderer regression suites).cargo check --lib -p OpenCADStudio→ clean;cargo check --locked --target wasm32-unknown-unknown -p OpenCADStudio -p ocs_web_worker→ clean (the router is purestd; delivery is desktop-gated with the paired-stub no-op on web).rustfmt --checkclean on touched files. Pre-existing upstream baseline failures (windows D3D12 trait errors at this era — see the Plugin panels: publish declarative scene surfaces end to end (S02, api v29) #3460 discussion; fmt/clippy informational jobs) inherited and untouched.Live-test evidence
Not run — honestly. The router/canvas/delivery paths are proven by the unit suites above; a live plugin sending real clicks awaits the Windows host mirror (recorded as pending in the train ledger, same note as #3460/#3510).
Upstream-baseline failures (not regressions)
cargo fmt --all -- --checkandcargo clippy --all-targets -- -D warningsfail on pristine upstream main already (29 fmt hunks; 11 clippy errors inentity_coverage.rs/host.rs/ipc/*/process/*; both non-blocking jobs). This PR adds zero new diagnostics (scoped per-file checks recorded).