Compare commits

...

1 Commits

Author SHA1 Message Date
8f94296ad2 Pin Perspective at 5.2.0 exact; drop non-functional viewer-d3fc
docs/perspective.md claimed the 4.5.1-core + 4.4.1-d3fc pair was "deliberate
and necessary — the only combination that keeps both" inline WASM bundling and
d3fc charts, and said do NOT fix it to 4.4.1. That was wrong: it does not keep
charts.

Loading viewer-d3fc@4.4.1 against a 4.5.x viewer throws
`get_static_config is not a function`, once per chart plugin — the newer viewer
calls a registration method the older plugins don't implement. Confirmed in the
running deployment: no chart type except Datagrid works. So the choice was never
"both"; it is inline bundling XOR charts, and dataflow was carrying mixed-version
complexity to buy charts it did not have.

- pin client/viewer/viewer-datagrid/server exact at 5.2.0 (was ^4.5.1 carets).
  The explicit `server` pin is required: client declares it as "" (an empty
  range) which npm resolves to latest, and a mismatched server WASM fails to
  link with `psp_opfs_load ... requires a callable`. That took pf_app down on
  2026-08-10. Five packages to pin, not four.
- drop the viewer-d3fc import. Restoring charts would require a coherent 4.4.1
  suite, which has no /inline export — trading bundled WASM for runtime fetching,
  to regain a feature no code path selects by name.

Verified: build succeeds; the entry chunk and the Pivot chunk it lazy-imports
contain zero CDN URLs and zero runtime `new URL(...perspective-server...)`
constructions; the app loads with every non-localhost request aborted, with no
console errors. dataflow's exact API surface — plugin.save/restore/draw,
view.set_depth, viewer.restore with plugin_config — behaves identically on
4.5.2 and 5.2.0.

NOT verified: the pivot rendering end-to-end, which is behind authentication.
Worth a manual click-through before merging.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SBt3EtKaP9D2mmWJ6Q4bov
2026-08-17 21:37:44 -04:00
5 changed files with 77 additions and 930 deletions

5
.gitignore vendored
View File

@ -2,8 +2,9 @@
.env
# Dependencies
# Lockfiles ARE tracked — they pin the Perspective 4.5.1/4.4.1 pairing that the
# caret ranges in ui/package.json would otherwise let drift. See docs/perspective.md.
# Lockfiles ARE tracked. Perspective is now pinned exact (5.2.0, all four packages
# including @perspective-dev/server) in ui/package.json, but keep the lockfile committed
# so transitive resolution can't drift either. See docs/perspective.md.
node_modules/
ui/node_modules/

View File

@ -25,34 +25,48 @@ pattern, upgrade smoke test). This file records what's specific to dataflow.
unless view sizes grow well past 100k.
- **Deploy:** `manage.py` + `dataflow.service` (systemd) + nginx. ✅ Reference pattern
for the org; pf_app should copy it.
- **Charts:** `viewer-d3fc` is imported, so the chart plugins are available in the UI.
Default plugin config is datagrid-only (`{ edit_mode: 'SELECT_REGION' }`).
- **Charts:** **none — `viewer-d3fc` was removed on 2026-08-17.** It had been imported,
but the chart plugins did *not* work: confirmed in the running deployment, where every
plugin other than Datagrid failed. Default plugin config is datagrid-only
(`{ edit_mode: 'SELECT_REGION' }`) and no chart is ever selected by name in the source.
- **Layout safety:** `cleanLayout()` filters saved configs against valid columns before
restore — the reference implementation; keep it.
## The version pair is correct — do NOT "fix" it to 4.4.1
## Version policy — pinned to 5.2.0 exact (corrected 2026-08-17)
`ui/package.json` pins **viewer/client/datagrid at `^4.5.1`** and **`viewer-d3fc` at
`^4.4.1`**. This looks like a skew but is **deliberate and necessary** — it's the only
combination that keeps both of dataflow's hard requirements:
`ui/package.json` pins **client / viewer / viewer-datagrid / server** all at exactly
**`5.2.0`**, and `viewer-d3fc` is gone.
- **Inline WASM bundling.** `Pivot.jsx` imports `@perspective-dev/client/inline`,
`@perspective-dev/viewer/inline`, and `@perspective-dev/viewer/themes`. Those export
paths **exist only in 4.5.x** — they are absent from 4.4.1's `exports` map.
- **d3fc chart plugins.** `viewer-d3fc` is published only up to **4.4.1**.
> ### ⚠️ This section previously said the 4.5.1 / 4.4.1 pair was "deliberate and
> necessary — do NOT fix it to 4.4.1". **That was wrong.**
>
> The pair was justified as the only combination keeping *both* inline WASM bundling and
> d3fc charts. It does not keep charts. Loading `viewer-d3fc@4.4.1` against a 4.5.x
> viewer throws `get_static_config is not a function` — once per chart plugin — because
> the newer viewer calls a registration method the older plugins don't implement. The
> app owner confirmed independently that no chart type except Datagrid works.
>
> So the choice was never "both": it is **inline bundling XOR charts**. dataflow was
> carrying mixed-version complexity to buy charts it did not have.
Verified the hard way: pinning all four to 4.4.1 and rebuilding fails with
`"./inline" is not exported … from @perspective-dev/client`. So the 4.5.1/4.4.1 pair
stays. Don't touch it.
**What changed and why 5.2.0:**
**What to actually do:**
- Keep the versions as-is; **commit `package-lock.json`** so the resolved set can't drift
on `npm install`. (Optionally tighten the carets to exact `4.5.1`/`4.4.1` to make that
explicit.)
- Treat any Perspective bump as gated by the canonical smoke test (§7): a d3fc **chart**
renders, dark/light re-themes, and save→reload→drop-column layout restore.
- Revisit only when `viewer-d3fc` ships a 4.5.x — then a fully-coherent inline-capable
4.5.x suite becomes possible and the pair can collapse to one version.
- **`@perspective-dev/server` must be pinned explicitly.** `client` declares it as
`"@perspective-dev/server": ""` — an *empty* range, which npm resolves to `latest`.
Left implicit, a fresh `npm install` pulls a mismatched server and the WASM fails to
link with `Import #8 "env" "psp_opfs_load": function import requires a callable`.
That exact failure took pf_app down on 2026-08-10. Five packages to pin, not four.
- **Exact versions, no carets.** Carets are what let the pinning drift in the first
place; the lockfile alone is not the whole guard.
- **d3fc dropped rather than downgraded.** Restoring charts would mean a coherent 4.4.1
suite, which has no `/inline` export — i.e. giving up bundled WASM and going back to
runtime fetching. Not worth it for a feature nothing in the source selects.
**Before choosing differently:** nobody has verified that d3fc charts render in *any*
configuration here, including a coherent 4.4.1 suite. Establish that first — don't
assume 4.4.1 works just because it's coherent.
Revisit when `viewer-d3fc` ships a 5.x; only then does "both" come back on the table.
---

933
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"@perspective-dev/client": "^4.5.1",
"@perspective-dev/viewer": "^4.5.1",
"@perspective-dev/viewer-d3fc": "^4.4.1",
"@perspective-dev/viewer-datagrid": "^4.5.1",
"@perspective-dev/client": "5.2.0",
"@perspective-dev/server": "5.2.0",
"@perspective-dev/viewer": "5.2.0",
"@perspective-dev/viewer-datagrid": "5.2.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-router-dom": "^7.17.0",

View File

@ -1,10 +1,13 @@
import { useEffect, useRef, useState, useCallback } from 'react'
import { api } from '../api'
import useTheme from '../theme.jsx'
// Perspective, bundled (no runtime CDN fetch). All four packages are pinned exact in
// package.json and the lockfile is tracked — see docs/perspective.md.
// viewer-d3fc is deliberately absent: it publishes no 5.x, and loading 4.4.1 against a
// 5.x viewer only throws `get_static_config is not a function` per chart plugin.
import perspective from '@perspective-dev/client/inline'
import '@perspective-dev/viewer/inline'
import '@perspective-dev/viewer-datagrid'
import '@perspective-dev/viewer-d3fc'
import '@perspective-dev/viewer/themes'
async function fetchAllRows(source) {