Skip to content

Support multiple independent XYG visualizations with one lifecycle contract #81

Closed

Description

@DecisionNerd

Problem

There is no general visualization lifecycle manager today. ResultGraphPanel, ArtifactVisualizationPanel, and FigurePanel each expose a static singleton current. A second graph replaces the first graph; a second chart/map/timeline replaces the current artifact view. Selection linking and session data also follow one current graph/result.

Existing renderer code has useful fragments—destroy/fit/relayout/highlight handles, render generations, worker cancellation, draft/committed state—but they are not one instance-keyed contract.

Objective

Replace singleton visualization state with a multi-instance XYG controller and lifecycle protocol that safely coordinates data, layouts, interactions, temporal/spatial filters, state, diagnostics, and disposal.

Concrete Lifecycle Contract

Each instance is keyed by a stable instanceId—normally project root plus visualization path, with a generated ID for an unsaved view—and owns:

  • source result and graph generation identity;
  • typed data/XYG figure handle and viewport;
  • presentation state and dirty/committed state where applicable;
  • monotonic renderGeneration;
  • native/worker layout and playback cancellation;
  • row/node/edge/mark selection mapping;
  • diagnostics and disposal registrations.

The bounded controller surface should cover:

  • mount
  • updateData
  • updatePresentation
  • fit
  • relayout
  • highlight
  • resize
  • extractSerializableState
  • dispose

Requirements

  • Replace static singleton panel state with a registry keyed by instance identity.
  • Allow multiple graphs, charts, timelines, and maps to remain open independently.
  • Correlate every host/webview/native/worker message with instanceId and renderGeneration.
  • Reject stale updates, events, layout positions, playback frames, and selections.
  • Cancel superseded render/layout/playback work and dispose timers, workers, native handles, listeners, and buffers.
  • Link table/graph/chart/map/timeline selection and temporal/spatial filters only through explicit coordination groups.
  • Preserve each instance's source result rather than routing through one session lastResult.
  • Maintain visible dirty/commit behavior only for the active contract; no legacy visualization compatibility is required.
  • Define lifecycle diagnostics as prepare/layout/paint/ready/failed/disposed with safe counts, durations, and stable codes.
  • Do not log result properties, rows, coordinates, timestamps, vectors, or artifact contents.
  • Honor VS Code webview serialization/revival and remote extension-host constraints.

Acceptance Criteria

  • Two or more saved graphs and mixed visualization kinds remain open, update, select, and dispose independently.
  • Late worker/native replies cannot mutate a newer revision or another instance.
  • Closing/replacing a view terminates all owned work and releases resources deterministically.
  • Explicitly linked views synchronize selection/time/space; unlinked views remain isolated.
  • Lifecycle events identify the correct instance, revision, phase, counts, duration, and stable failure code.
  • Extension reload/revival restores the active XYG-native state or fails clearly.
  • Leak/resource tests cover repeated open/update/close and multi-view stress.

BDD Completion Scenarios

Scenario: Multiple views remain independent

Given two graphs, a timeline, and a map opened from distinct GraphForge results
When one view relayouts, changes time range, selects an entity, or closes
Then only explicitly linked views receive the intended coordination event
And every other view retains its own data, viewport, and work.

Scenario: Superseded work cannot land

Given an XYG instance starts a new render while an older layout is still running
When the older job replies
Then its revision is rejected and its resources are disposed
And the active scene remains unchanged.

Implementation Notes

Likely surfaces include all three panel classes, panel grouping, GraphForgeSession, result table linking, project commands, webview protocols, renderer handles, worker scheduling, document state, and extension serialization.

Observability

Safe instance ID hash, visualization kind, render revision, phase, entity/row counts, duration, cancellation/disposal outcome, and stable code.

Security And Privacy

Do not place project paths or result values in cross-view diagnostics. Validate all instance/revision messages and preserve strict CSP/local assets.

Testing

Unit registry/state transitions, stale-message races, worker/native cancellation, multi-panel extension integration, selection/filter coordination, webview revival, repeated lifecycle leak tests, accessibility, and remote-host E2E.

Documentation

Update architecture, lifecycle protocol, requirements, testing, commands/agent responses, troubleshooting, and multi-visualization examples.

Non-Goals

Cross-library adapters, legacy artifact readers, automatic cross-view linking, or visualization computation in GraphForge Core.

Related Issues

Activity

  1. added
    documentationImprovements or additions to documentation
    enhancementNew feature or request
    javascriptPull requests that update javascript code
    on Aug 18, 2026
  2. coderabbitai commented on Aug 18, 2026

    @coderabbitai
    🔗 Related PRs

    #64 - Figure panel: Plotly figure JSON + agent/deterministic commands [merged]
    #68 - Make AntV the explicit visualization default [merged]
    #71 - Ship visualization loading status and Get Started artifacts (0.1.2) [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

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

    documentationImprovements or additions to documentationenhancementNew feature or requestjavascriptPull requests that update javascript code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions