Repository navigation
Plugin panels: typed editable table tier (S07, api v29) - #3576
Merged
HakanSeven12 merged 3 commits intoNov 24, 2026
Merged
Conversation
…ll/row patches (S07 part 1, api v29) Stage 7 begins: TYPED TABLES with stable row keys, typed scalar cells, and atomic cell/row patches. Same ownership split as the scene/widget tiers; the wire carries only this serializable vocabulary (ungated module beside scene/widget so the pure store stays wasm-clean). - CellValue: Text (bounded) / Number (finite-enforced) / Bool — typed scalar cells initially; non-scalar presentation types wait for a concrete example (finding-scope exclusion). - TableSurface: ordered stable-key columns (cell positions are DERIVED from column order, never stored per cell), rows keyed by stable id, display order. Finding F4: SetCell updates ONE cell without touching the rest; InsertRow batches are the visible-range paging primitive (a page = a positioned row batch); RemoveRow by stable key. - TablePatch: revision-checked, atomic (clone-stage-validate-swap), MAX_TABLE_OPS/MAX_TABLE_ROWS budgets, arity and finiteness enforced, whole-table re-validation on success. - 4 tests: the single-cell-update proof (one cell, one revision bump, nothing else moves), atomic no-partial-mutation on a failing multi-op patch, positioned page batches, stale-base/arity/finiteness refusals. Verification: cargo test -p ocs_plugin_api --all-features 223 passed / 0 failed / 1 ignored (219 + 4 table tests). Deliberately absent (S07 part 2+): the PanelSurface::Tables wire tail, table page/patch request flows, the host-side store + native editable renderer, and the editing session (host-local) wiring.
…07 part 2, api v29)
The table tier crosses the wire: a plugin publishes a typed table
surface beside (not instead of) its scene/widget surfaces, and updates
it with bounded atomic cell/row patches - the single-cell-edit and
paging primitives.
- PanelSurface::Tables(TableSurface) - the append-only envelope grows
its third kind (tag 2, pinned next to Scene=0/Widgets=1).
- PluginRequest::PanelSurfaceTablePatch { panel_id, patch } (variant
66, after page 65) + PanelTablePublished (response 53) +
PanelTablePatchResult (response 54): the table tier's independent
revision space, type-safely carried by the tier's own TableReject
(finding F1).
- HostApi: panel_table_publish / panel_surface_table_patch (+ _for_plugin)
with the transport-era Unattached defaults; server dispatch matches
the surface kind; client methods mirror the tier split.
- Host store: a table map beside scenes/widgets with publish_table /
patch_table / ownership-checked table reads; remove/retain_owners
clear all THREE tiers (the lifecycle lesson, applied proactively).
Host session: resolve_surface_panel reused behind the two new
overrides.
Verification: cargo test -p ocs_plugin_api --all-features 223 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; fmt/clippy informational
jobs) inherited and untouched. Part 3 (next): the native table renderer
with the host-local editing session and CellEdited event wiring.
…ssion (S07 part 3, api v29) Completes the table tier end to end: a published table surface RENDERS as a native editable grid, and its editing session is HOST-LOCAL transient state — the plugin stays the data authority. - ui/window/plugin_tables.rs: TableUiState (draft cell texts keyed by (row, column), host-local selection) and table_view: a scrollable native grid - header row + one text-input editor per cell bound to the draft (or the stored cell when no draft). Edits are keystroke Messages (host-local drafts only); submission runs the TYPED-COMMIT RULE - the edited value takes the existing cell's type (Number/Bool parse, Text free); a failed parse keeps the user's draft and commits nothing. - A successful commit notifies SurfaceEvent::CellEdited (sequence- identified, owner-targeted, best-effort - the S04 delivery law) via the desktop-gated dispatch path; the plugin remains the data authority and canonicalizes by pushing its own table patch through the normal wire path (the store's revision rules apply - the host never mutates plugin data directly). - dock seam precedence: table view -> widget view -> scene canvas -> exact legacy tree. Web runtime: editing drafts work host-locally but delivery dies at the dispatch no-op (no plugin host on web). Verification: cargo test -p ocs_plugin_api --all-features 223 passed / 0 failed / 1 ignored; cargo test --lib -p OpenCADStudio -- panel_tables green (draft shadowing, typed commit, failed-parse draft survival); host lib clean; wasm32 check green for OpenCADStudio + ocs_web_worker (recorded). Pre-existing upstream baseline failures (windows D3D12; fmt/clippy informational jobs) inherited and untouched.
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.
Staged train (this PR is stage 7)
Stages 1–6 are merged (scenes #3460, patches #3510, events #3530, widget tier #3540, buttons #3545). The remaining delta — this PR is the last content stage:
4deecd147...3adbc6462— opens as its own PR when this one mergesProblem and minimal scope
Stage 7 of the atomic panel-surface train (#3460 scenes, #3510 patches, #3530 events, #3540 widget tier, and the button stage stacked before this): typed tables. A plugin that needs a grid today has to fake it out of widget rows (no types, no editing) or repaint scenes (no editing at all). This stage adds a native, EDITABLE table tier: typed scalar cells (Text/Number/Bool), stable row/column keys, atomic cell/row patches (
SetCellsingle-cell proof /InsertRowpositioned page batches /RemoveRow), a 3-tier host lifecycle, and a host-local editing session — drafts live in the host UI until a typed commit, then the plugin (still the data authority) canonicalizes by pushing its own table patch. No shared-table reference machinery and no non-scalar presentation cells (explicit non-goals).Public API / wire changes and current API-major basis
Based on upstream
mainat the train merge (v29 throughout). No new API major — the tier appends to v29's tails:tables.rs(new, ungated): typedCellValue(Text/Number/Bool), stable row/column keys, atomicTablePatch(SetCell/InsertRow/RemoveRow) with budgets and validation (4 model tests incl. the single-cell-update proof).scene.rs:PanelSurface::Tables(TableSurface)appended as tier tag 2 (after Scene = 0, Widgets = 1).ipc/protocol.rs:PluginRequest::PanelSurfaceTablePatch { panel_id, patch }— request variant 66 (after the widget page 65);PluginResponse::PanelTablePublished= 53 andPanelTablePatchResult= 54 (after the widget tier's 51/52). Appends only.HostApipair:panel_table_publish/panel_table_publish_for_plugin(+ the patch path), tier-typedTableReject/TableRejectCode(From for the shared codes).scene.rsSurfaceEventappend:CellEdited { row, column, value }— rides the EXISTING tag-16PanelSurfaceEventenvelope (no new notification tags).Semantics (editing is host-local until typed commit)
ui/window/plugin_tables.rs) draws an editable grid; each cell edit creates a host-local DRAFT keyed(row, col)— the stored table is untouched until commit.SurfaceEvent::CellEditedto the OWNING plugin (best-effort, sequence-identified, tag 16); the plugin canonicalizes by pushing its ownPanelSurfaceTablePatch, which the store applies atomically (all-or-nothing, revision-checked) exactly like scene patches.table > widget > scene > legacytree.Legacy compatibility
All wire changes are appends (tier 2, request 66, responses 53/54, one
SurfaceEventvariant inside tag 16); scenes, widgets, patches, drag, and buttons are untouched; panels without table surfaces render exactly as before; pre-29 peers never see the variants (unknown-tag passthrough). The store'sremove/retain_ownerslifecycle now covers all three tiers symmetrically.Verification (exact commands, exit 0, at head
4deecd147, rebased on upstream3e738a244)cargo test -p ocs_plugin_api --all-features→ 223 passed, 0 failed, 1 ignored (S06's 219 + 4 table-model tests).cargo test --lib -p OpenCADStudio -- panel_events panel_surfaces plugin_scene panel_widgets plugin_tables→ 25 passed, 0 failed; renderer subset-- plugin_tables→ 3 passed, 0 failed (draft shadowing, typed commit, failed-parse survival).cargo check --lib -p OpenCADStudio→ clean.cargo check --locked -p OpenCADStudio -p ocs_web_worker --target wasm32-unknown-unknown→ clean.rustfmt --checkon the two owned files (tables.rs,plugin_tables.rs) → 0 diffs.(Exact recorded artifacts at push time.)
Live-test evidence
Not run — honestly. The model/store/renderer/editing-session paths are proven by the unit suites above; a live plugin receiving
CellEditedand canonicalizing with a real patch awaits the Windows host mirror (pending note unchanged across the train).Upstream-baseline failures (not regressions)
Unchanged from #3540: windows D3D12/windows-rs trait errors (inherited, documented with clean-checkout evidence on #3460/#3530); fmt/clippy informational jobs fail on pristine main. This PR adds zero new diagnostics.