Skip to content

Support storing extension-based views (ExtensionView / PlotlyFigure) #4

Open

Description

@dimitri-yatsenko

As of #2, the codec stores figure data only (the data.zarr/ subtree) and validate() rejects ExtensionView at insert time, because an extension view's JavaScript lives outside data.zarr and data-only storage would silently drop it and serve a broken figure. Fail-closed is the right v1 policy.

This tracks lifting that restriction: support storing extension-based views so their JS/assets travel with the figure.

Notably affected

  • figpack.views.PlotlyFigure subclasses ExtensionView, so Plotly figures cannot currently be stored. A canary test (test_validate_rejects_plotly_figure_extension_view) documents this and will flag if figpack ever rebases PlotlyFigure onto a core view.

Sketch of the work

  • Persist the extension manifest + extension JS alongside data.zarr (instead of the empty {"extensions": []} manifest serve_under writes today), decide the on-store layout, and update serve_under to lay the extension files into the served bundle.
  • Relax validate() to accept ExtensionView once storage round-trips the extension payload.
  • Decide whether extension JS is stored per-figure or deduped (extensions are often shared across figures).

Refs #2.

Activity

  1. MilagrosMarin commented on Sep 17, 2026

    @MilagrosMarin
    Contributor

    The design half of this is implemented in #8.

    validate() no longer rejects ExtensionView, and the extension's JavaScript now travels with the figure because the stored object is the whole bundle rather than data.zarr alone — which is what gives it somewhere to live. That closes the reason for the fail-closed policy: an extension is installed on the machine that populates the table and would never exist in the serving container, so storing the bundle is what makes such a view portable at all.

    Covered by a round-trip test that plants a sentinel in an extension's JS and asserts both that extension_manifest.json names the extension and that the sentinel is present in a .js file under the stored object.

    One gap worth recording: the test builds a FigpackExtension by hand rather than using PlotlyFigure, because plotly is not installed in the dev environment. So the ExtensionView class is exercised, but PlotlyFigure specifically is not. The canary test that asserted its rejection (test_validate_rejects_plotly_figure_extension_view) was removed with the policy it guarded. If PlotlyFigure support matters, it wants plotly in the test extra and a case of its own.

    What remains in this issue is only the dedup question — the third bullet in the sketch above, whether extension JS is stored per-figure or shared. #7 answers the framing rather than the question: the object is the folder, and dedup is an optimization layer on top, never a change to what the object is, with a separate issue to be opened only if a pipeline shows the small-figure, high-count profile.

    So once #8 merges this is either closeable, or worth narrowing to the dedup question alone. #8 deliberately does not auto-close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions