components.interactive_graph: build the frontend reproducibly and update its toolchain #55

Open
opened 2026-10-06 13:53:59 +00:00 by ffrauenberger · 1 comment
Owner

Severity: improvement (low)

Where

  • app/components/interactiveGraph/frontend/build/**
  • app/components/interactiveGraph/frontend/package.json
  • package.nix
  • .gitignore:17-18

Problem

  • The compiled bundle (build/static/js/main.ee95aed2.js + map, graphviz.umd.js, bootstrap.min.css) is checked in, and Nix packaging uses it as is. Nothing checks that build/ matches src/, so the bundle can silently differ from the reviewed source, and a source-only change has no effect.
  • The toolchain is Create React App (react-scripts 5, deprecated) with React 16 and TypeScript 4.2, and gets no security updates.
  • graphviz.umd.js and bootstrap.min.css are vendored twice (public/ and build/). index.html loads Bootstrap, but the component uses no Bootstrap classes.
  • The component uses a global CSS selector (graphviz(".graph")), so only one interactive graph can exist per page.

Fix

  • Build the frontend in CI / Nix (buildNpmPackage) from package-lock.json and stop committing build/ (or at least verify in CI that it matches the source)
  • Migrate to Vite and a current React version
  • Remove unused/duplicated vendored files
  • Scope the d3 selection to the component's ref

from issues/ARCH-010-committed-frontend-build-and-outdated-toolchain.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** improvement (low) ## Where - `app/components/interactiveGraph/frontend/build/**` - `app/components/interactiveGraph/frontend/package.json` - `package.nix` - `.gitignore:17-18` ## Problem - The compiled bundle (`build/static/js/main.ee95aed2.js` + map, `graphviz.umd.js`, `bootstrap.min.css`) is checked in, and Nix packaging uses it as is. Nothing checks that `build/` matches `src/`, so the bundle can silently differ from the reviewed source, and a source-only change has no effect. - The toolchain is Create React App (`react-scripts` 5, deprecated) with React 16 and TypeScript 4.2, and gets no security updates. - `graphviz.umd.js` and `bootstrap.min.css` are vendored twice (`public/` and `build/`). `index.html` loads Bootstrap, but the component uses no Bootstrap classes. - The component uses a global CSS selector (`graphviz(".graph")`), so only one interactive graph can exist per page. ## Fix - Build the frontend in CI / Nix (`buildNpmPackage`) from `package-lock.json` and stop committing `build/` (or at least verify in CI that it matches the source) - Migrate to Vite and a current React version - Remove unused/duplicated vendored files - Scope the d3 selection to the component's `ref` --- from `issues/ARCH-010-committed-frontend-build-and-outdated-toolchain.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

Reviewed by Codex (GPT-6) against origin/main 6bcc646eb464.

Review: partially correct.

The build/packaging and aging toolchain concerns are supported. The .graph selector does not establish that only one interactive graph can exist on a Streamlit page: this uses streamlit.components.v1.declare_component, whose instances run in separate iframes. It would conflict with multiple React graph instances within one iframe/document; separate Streamlit component instances are isolated. See Streamlit's v1 component documentation.

Also, deprecated CRA does not by itself prove that the whole dependency tree “gets no security updates”; React describes CRA as continuing in maintenance mode. Pin that assertion to an actual dependency/advisory if needed. The shipped source map's InteractiveGraph.tsx currently matches src/InteractiveGraph.tsx; the missing CI guarantee remains a valid finding.

Code references: app/components/interactiveGraph/init.py:20, app/components/interactiveGraph/frontend/src/InteractiveGraph.tsx:87.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** The build/packaging and aging toolchain concerns are supported. The `.graph` selector does **not** establish that only one interactive graph can exist on a Streamlit page: this uses `streamlit.components.v1.declare_component`, whose instances run in separate iframes. It would conflict with multiple React graph instances within one iframe/document; separate Streamlit component instances are isolated. See [Streamlit's v1 component documentation](https://docs.streamlit.io/develop/concepts/custom-components/components-v1/intro). Also, deprecated CRA does not by itself prove that the whole dependency tree “gets no security updates”; React describes CRA as continuing in [maintenance mode](https://react.dev/blog/2025/02/14/sunsetting-create-react-app). Pin that assertion to an actual dependency/advisory if needed. The shipped source map's `InteractiveGraph.tsx` currently matches `src/InteractiveGraph.tsx`; the missing CI guarantee remains a valid finding. Code references: [app/components/interactiveGraph/__init__.py:20](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/components/interactiveGraph/__init__.py#L20), [app/components/interactiveGraph/frontend/src/InteractiveGraph.tsx:87](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/components/interactiveGraph/frontend/src/InteractiveGraph.tsx#L87).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#55
No description provided.