|
| 1 | +# Fix `columns_config` / `plugin_config` round-trip + docs deploy script |
| 2 | + |
| 3 | +Two commits on `deploy-docs`: |
| 4 | + |
| 5 | +1. **`595cdbc4e` Add docs deploy script** — new `docs/deploy.mjs` + `docs/package.json` `deploy` npm script. |
| 6 | +2. **`f807677d4` Fix `columns_config` and `plugin_config` bugs** — omnibus fix across the Rust renderer task graph and the WebGL viewer-charts plugin, plus regression tests. |
| 7 | + |
| 8 | +> ⚠️ `viewer.rs` ships two `tracing::error!("WIP!");` lines around the settings-panel resize callbacks ([viewer.rs:548-564](rust/perspective-viewer/src/rust/components/viewer.rs#L548-L564)). Looks like debugging leftover — should be removed before merge. |
| 9 | +
|
| 10 | +## Summary |
| 11 | + |
| 12 | +### `columns_config` round-trip fixes (Rust) |
| 13 | + |
| 14 | +- `Renderer::all_columns_configs_materialized` is now **async** ([renderer.rs:243](rust/perspective-viewer/src/rust/renderer.rs#L243)). It does a two-pass warm: pass 1 scans the schema for any `include: true` Number key missing from its entry with no cached stats, pass 2 `join_all`s `resolve_abs_max` for that set, then materializes against the warm cache. Without this, gradient defaults fell back to `0` on cold cache. |
| 15 | +- Strip-on-write now drops keys not in `schema.active_keys()` before stripping default values ([renderer.rs:406-407](rust/perspective-viewer/src/rust/renderer.rs#L406-L407), [renderer.rs:614-615](rust/perspective-viewer/src/rust/renderer.rs#L614-L615)) — prevents stale keys from a previous mode (e.g. `fg_gradient` after switching off `number_fg_mode = "bar"`) from leaking back into the persisted config. |
| 16 | +- `restore_and_render` reordered: validate + `create_view` now happens **before** applying `columns_config` / `plugin_config` updates ([restore_and_render.rs:89-101](rust/perspective-viewer/src/rust/tasks/restore_and_render.rs#L89-L101)). Previously the strip ran against a stale `view_schema`, silently dropping any `columns_config` entry keyed by a newly-introduced expression column. |
| 17 | +- `update_and_render`, `send_column_config`, `send_plugin_config` all updated to `.await` the async materialize ([update_and_render.rs:81-86](rust/perspective-viewer/src/rust/tasks/update_and_render.rs#L81-L86), [send_column_config.rs:41-43](rust/perspective-viewer/src/rust/tasks/send_column_config.rs#L41-L43), [send_plugin_config.rs:39-41](rust/perspective-viewer/src/rust/tasks/send_plugin_config.rs#L39-L41)). |
| 18 | + |
| 19 | +### `plugin_config` blank-canvas bug (TypeScript) |
| 20 | + |
| 21 | +Bug chain (all three needed to repro): |
| 22 | +1. `RendererTransport.saveZoom` was `async` but never returned its pending-reply promise → every caller got `Promise<undefined>`. |
| 23 | +2. `plugin.save()` called it without `await` and stored the bare `Promise` as `state.zoom`. `JSON.stringify` collapses any Promise to `{}`. |
| 24 | +3. A later `plugin.restore(token)` with `token.zoom === {}` reached `ZoomController.restore({})`, which assigned `undefined` to every internal field → NaN projection matrix → blank canvas. |
| 25 | + |
| 26 | +Fix: the override `save()` on `HTMLPerspectiveViewerWebGLPluginElement` is **removed** ([plugin.ts:511-532](packages/viewer-charts/src/ts/plugin/plugin.ts) deletion). New regression test in [plugin-config-toggle.spec.ts](packages/viewer-charts/test/ts/plugin-config-toggle.spec.ts) toggles `series_zoom_mode` and asserts the plot never goes blank. |
| 27 | + |
| 28 | +### Datetime-axis dynamic-zoom refit |
| 29 | + |
| 30 | +New snapshot tests in [zoom.spec.ts](packages/viewer-charts/test/ts/snapshot/zoom.spec.ts#L82-L137) covering Y Line / Y Bar wheel-zoom on a datetime `group_by` for both `dynamic` and `fixed` `series_zoom_mode` — guards the catIdx remapping path that previously made `dynamic` look identical to `fixed` on datetime axes. |
| 31 | + |
| 32 | +### Misc viewer-charts cleanup |
| 33 | + |
| 34 | +- `fieldSpec` refactored from a 170-line switch to a static `FIELD_SCHEMAS` record + per-call default lookup ([plugin.ts](packages/viewer-charts/src/ts/plugin/plugin.ts)). |
| 35 | +- `ZoomController.setBaseDomain` now handles X and Y independently and adds opt-in `pinAxis` / `unpinAxis` flags ([zoom-controller.ts:170-243](packages/viewer-charts/src/ts/interaction/zoom-controller.ts#L170-L243)) — default "follow" semantics, pinning reserved for future paused-frame review. |
| 36 | +- `ZoomRouter` class deleted; `applyWheel` / `applyPan` are the public entrypoints now ([zoom-router.ts](packages/viewer-charts/src/ts/interaction/zoom-router.ts)). |
| 37 | +- New `expandDomainInPlace` helper extracted ([expand-domain.ts](packages/viewer-charts/src/ts/charts/common/expand-domain.ts)). |
| 38 | +- `MessageHostSink` envelope shape unified with the worker-side `WorkerMsg` types so there's no intermediate translation ([host-sink-message.ts](packages/viewer-charts/src/ts/interaction/host-sink-message.ts)). |
| 39 | +- `chart-base.ts` axis formatter gated behind a `REGRESSION_BEHAVIOR = true` flag with a TODO documenting the tradeoff vs. datagrid-consistent formatting. |
| 40 | + |
| 41 | +### Datagrid tests |
| 42 | + |
| 43 | +- `Pulse styling works` + `... when settings panel is open` marked `test.skip` ([column_style.spec.js:142,175](packages/viewer-datagrid/test/js/column_style.spec.js#L142)). |
| 44 | +- New `label-bar` snapshot tests for both static and expression columns ([column_style.spec.js:229-285](packages/viewer-datagrid/test/js/column_style.spec.js#L229)). |
| 45 | + |
| 46 | +### Tooling |
| 47 | + |
| 48 | +- `tools/scripts/publish.mjs`: replace `zx` `$.sync` / `await $` with `execSync` + inherited stdio for `twine`, `npm publish`, and `cargo publish` calls — gets live output through. |
| 49 | +- `tools/test/src/js/utils.ts`: drop the width/height/min-/max- regex normalization in `compareContentsToSnapshot` (kept only `style=""`). |
| 50 | +- `viewer-charts` version bump `4.3.0` → `4.5.0`. |
| 51 | + |
| 52 | +## Test plan |
| 53 | + |
| 54 | +- [ ] `pnpm run test` (root) — full suite, especially the new `plugin-config-toggle` and datetime-zoom specs |
| 55 | +- [ ] Confirm Datagrid `columns_config` round-trip with `fg_gradient` cold-cache scenario produces a real default (not `0`) |
| 56 | +- [ ] Confirm `columns_config` entry keyed by an expression column survives `restore_and_render` |
| 57 | +- [ ] Toggle `series_zoom_mode` on a Y Line with datetime group_by — canvas stays painted |
| 58 | +- [ ] Remove the `WIP!` `tracing::error!` lines in `viewer.rs` before merge |
| 59 | +- [ ] `docs/deploy.mjs` produces a clean `dist-gh-pages` worktree on a fresh checkout |
0 commit comments