Documentation

Docs / Reference

ADR 0046 - Flow tab graph libraries and the elkjs licence exception

Status: Accepted (delegated review, 2026-11-04)

Context

The Flow tab (T016f2, the T016f task record (internal)) draws the stored neighbourhood of an endpoint from GET /api/v0/api/flow (ADR 0045). The developer decided the graph stack in the T016 task record (internal) ("Graph views"): React Flow (@xyflow/react) for the canvas and ELK (elkjs) for the layout, ELK loaded lazily in a web worker only when a graph opens.

ADR 0041 (decision 4) allows only permissive licences for runtime packages (MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0, 0BSD) and fails any SPDX expression, so a copyleft or dual-licensed package needs a recorded decision. elkjs is Eclipse Public License 2.0 (weak, file-level copyleft); from 0.12.0 on it is published as EPL-2.0 OR GPL-3.0-or-later. The developer answered UQ2 on 2026-11-03: B, elkjs pinned at exactly 0.12.0, taken under EPL-2.0, with the safeguards below. ADR 0041's CSP (script-src 'self', no worker-src) blocks blob: workers and allows a classic same-origin worker (T016f F6). This ADR records the licence policy change and the dependency, chunk and size decisions of T016f2 that ADR 0041 asks to be recorded (ADR 0045's section 8 points here; ADR 0045 is accepted and not edited).

Options considered

Layout library and licence (UQ2)

How ELK's code reaches the page

Chunking

Decision

  1. Runtime dependencies, exact pins: @xyflow/react 12.12.0 (2026-09-24, MIT) and elkjs 0.12.0 (2026-07-17). The lockfile was resolved with npm install --before=2026-10-20; every new entry was published at least 14 days before 2026-11-03 (latest: @types/d3-zoom 3.0.9, 2026-09-29). New entries: @xyflow/system 0.0.83, zustand 4.5.7, use-sync-external-store 1.7.0, classcat 5.0.5 (MIT); d3-color 3.1.0, d3-dispatch 3.0.1, d3-drag 3.0.0, d3-interpolate 3.0.1, d3-selection 3.0.0, d3-timer 3.0.1, d3-transition 3.0.1, d3-zoom 3.0.0 (ISC), d3-ease 3.0.1 (BSD-3-Clause); @types/d3-color 3.1.3, @types/d3-drag 3.0.7, @types/d3-interpolate 3.0.4, @types/d3-selection 3.0.12, @types/d3-transition 3.0.9, @types/d3-zoom 3.0.9 (MIT; runtime dependencies of @xyflow/system). None of the d3 patch releases of 2026-11-03 is in the lockfile.
  2. Licence check (web/scripts/check-licences.mjs): an EXCEPTIONS list with exactly one entry, {name: "elkjs", version: "0.12.0", licence: "EPL-2.0 OR GPL-3.0-or-later"}, recorded as taken under EPL-2.0. Any other version or licence string of elkjs fails ("review the new version"), and so does the exception without the package. Every other runtime package stays on ADR 0041's permissive allow-list; SPDX expressions still fail for every other package.
  3. Graphvein takes elkjs under EPL-2.0 and distributes it unmodified in object code form, as the separate worker file above.
  4. The served licence page (/third-party-licenses.txt, generated by web/scripts/third-party-licenses.mjs) carries elkjs's LICENSE.md (the EPL-2.0 text) and, before it, a statement that Graphvein takes elkjs under EPL-2.0 and ships it unmodified as a separate file, with the source: https://github.com/kieler/elkjs/tree/0.12.0, the npm tarball https://registry.npmjs.org/elkjs/-/elkjs-0.12.0.tgz, and the ELK release it is built from, https://github.com/eclipse-elk/elk/tree/v0.12.0. The statement is keyed by name and version and fails the build when the package is gone.
  5. CSP unchanged: the worker is a classic same-origin script under /assets/ (no inline, blob: or data: worker); one worker per page, created on the first layout, reused; a layout over 10 s terminates it and shows an error with Retry.
  6. Embedded size bound (internal/server/static_test.go) raised from 2 MiB to 3 MiB, as far as needed: the tree is 2,611,567 bytes (was 587,035). Measured (raw / gzip -9): ELK worker 1,595,334 / 461,891; Flow chunk 212,332 / 67,792 plus its CSS 16,737 / 2,852; entry chunk 476,575 / 142,604 (was 449,835 / 134,752: the tab strip, the flow guard and graph building, the list and sidebar rails and Vite's preload helper; no React Flow or ELK code); entry CSS 59,812 / 10,979; licence page 249,780 (was 114,209; most of the growth is vite's own LICENSE.md, now listed as a bundled tool). The binary grows by about the tree's growth (2.0 MB).

Consequences

Known gaps

Review notes (delegated review, 2026-11-04)

Report a problem with this pageSource: docs/adr/0046-flow-tab-graph-libraries-and-elkjs-licence.md