Repository navigation
Collapsed subtopology view with bus notation and click-to-open (CLI + VS Code) - #2
Open
devin-ai-integration[bot] wants to merge 8 commits into
Open
devin-ai-integration[bot] wants to merge 8 commits into
devin-ai-integration[bot] wants to merge 8 commits into
Conversation
Topology and connection-group diagrams gain a TopologyView (flattened |
collapsed). Collapsed draws each directly imported topology as one
node:topology carrying its declared ports, the diagrammed topology's own
declared ports as node:boundary elements, and connections that reach into
an imported topology as implicit edges ending on the collapsed node's
boundary (no rendered port is invented). Flattened remains the default.
Exposed as fpp-diagram --view {flattened,collapsed}, the fpp/diagram LSP
request's optional topologyView, and the FPP: Toggle Collapsed
Subtopologies command in the VS Code diagram panel.
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Author
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
Original prompt from michael.d.starch
|
…mbiguate shared instances Edges now come from connection_map (imported connections included), dropping only those wholly inside one collapsed node. An instance owned by two unrelated imports, or declared by the diagrammed topology itself, stays a node of its own; an instance inside nested imports is owned by the innermost. An imported connection group keeps the collapsed node it lives in. Fix the CSS selector so implicit edges render dashed inside the edge's <g>. Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
…ses outside the node A declared port of an imported topology that names an instance drawn on its own (shared by unrelated imports, or declared by the parent) or owned by another collapsed node gets an alias edge to it, mirroring the boundary-port edges. Group views bring in those alias targets for the collapsed nodes they draw. Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
'elk.layered.layerConstraint' is not an ELK option; boundary ports were laid out as ordinary nodes next to what they connect to. Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
A collapsed node brought in by an alias edge contributes its own alias edges in turn, so a group reaching a re-exported port shows the whole chain. Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
ELK packs connected components separately by default, so first/last layer constraints only lined boundary ports up per component. Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
…logies Diagram::bundle_edges folds edges joining the same two rendered elements (component, collapsed topology, or boundary port) into one edge with a wire count, listing the wires in its hover detail. The sprotty model carries the count and a '/N' edge label; the webview draws buses as a fat wire with a slash. Bundling is opt-in: --bundle-edges on the CLI, bundleEdges on fpp/diagram, and on by default in VS Code with a toggle command. node:topology now carries qualifiedName and is openable: double-clicking sends OpenAction, which the extension host turns into displayDiagram for that topology. lower_to_smodel_view (added on this branch) is replaced by lower_to_smodel_with(SmodelOptions). Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Topology (and connection-group) diagrams gain an opt-in collapsed view. Today
lower_topologyflattens every import: each imported topology's component instances become nodes and every connection is resolved to underlying component ports, so the subtopology structure and its declared ports vanish. The collapsed view keeps them:node:topologycarrying its declared ports (port x = inst.p), with its internal connections hidden;node:boundarychevrons (ELK pins inputs to a first column and outputs to a last column), each joined to the port it aliases;wasmSeq.getTlmChan -> CdhCore.tlmSend.TlmGet, not via a declared port) becomes an implicit edge whose endpoint is the collapsed node itself — no boundary port is invented — drawn dashed, with the underlyinginst.port -> inst.portpairs as hover text. Implicit edges between the same two elements are merged into one.Flattened stays the default everywhere; all existing tests are untouched.
Lowering (
CollapsedScopeinfpp_diagram/src/lower.rs): analysis stores connection endpoints already resolved to component ports, but each resolvedEndpointkeeps the alias it came through intopology_port. The scope walks that chain back out (as_written) and resolves the outermost identifier: a port on a directly imported topology → rendered port on the collapsed node; a component owned by an imported topology → the collapsed node's boundary (implicit); anything else → the component port as before. Details settled during review:connection_map(imported connections that cross a collapsed boundary are drawn; those wholly inside one collapsed node are hidden);alias.<Topology>.<port>.<i>edge to it (implicit when the target is another collapsed node);Surfaces:
fpp-diagram --kind topology --name Ref.Ref --format sprotty --view collapsed(defaultflattened).fpp/diagramparams gain optionaltopologyView: "flattened" | "collapsed".FPP: Toggle Collapsed Subtopologiescommand/editor-title button on the diagram panel; webview registersnode:topology(dashed box) andnode:boundary(chevron pointing in the flow direction); implicit edges are dashed. Graphs with boundary chevrons are laid out as one piece (elk.separateConnectedComponents=false) so the first/last-layer constraints hold globally.On F Prime
Ref.Ref: flattened = 49 component nodes / 372 edges; collapsed = 21 component nodes + 4 subtopology nodes / 198 edges (123 implicit).CdhCore.Subtopologycollapsed: 8 components, 16 boundary chevrons (9 in / 7 out), 17 edges.Tests: new
fpp_diagram/tests/collapsed.rs(13 tests: IR, pruning, connection groups, sprotty JSON, legacy-API equivalence, CLI switch, imported/shared/nested/chained aliases).Bus notation and click-to-open (second iteration)
Buses.
Diagram::bundle_edgesfolds edges that join the same two rendered elements in the same direction — element = component node, collapsednode:topology, or boundary chevron — into one edge between the elements themselves:Sprotty: the edge carries
countand, for a bus, alabel:edgechild"/N"(ELK places it at the edge centre). The webview draws a bus as a 3 px stroke (.edge-bus; implicit buses stay dashed,8 5) with a 60° slash at the path midpoint; the<title>lists the wires. Bundling is opt-in below the extension:fpp-diagram --bundle-edges, LSPbundleEdges: bool(default false); VS Code turns it on by default withFPP: Toggle Bus Wireson the panel toolbar.hide_unused_portsruns after bundling, so ports used only by a bus are dropped.Ref.Refcollapsed: 198 edges → 98 edges, 44 of them buses (largest/27), same 305 wires. Flattened + bundled: 372 → 309 edges (56 buses).Note: in collapsed view, implicit reach-ins with an identical source port were already merged into one edge; they now report their
count, so a few/Nlabels remain with bus wires toggled off.Click-to-open.
node:topologycarriesqualifiedNameand is registered with Sprotty'sopenFeature: a double-click dispatchesOpenAction(elementId), whichFppWebviewPanelManager.addOpenHandlerturns into the existingdisplayDiagram(DiagramType.topology, qualifiedName)— the same panel now shows that subtopology (its declared ports as boundary chevrons).Tests: new
fpp_diagram/tests/bundle.rs(8 tests: opt-in/count round-trip, bundling by element incl. direction and mixed groups, bundle-then-prune, implicit merge counts, all-implicit bus, sprottycount/label:edge,qualifiedName, CLI--bundle-edges).Video (VS Code,
Ref.Refcollapsed → double-clickCdhCore.Subtopology)Ref.Refcollapsed, buses on/N, hover lists the wiresCdhCore.SubtopologyScreenshots of the collapsed view (first iteration) (VS Code extension-development host, local
fpp_lsp_server)Ref.Refflattened (default, unchanged) vs collapsed — the four grey dashed boxes areCdhCore.Subtopology,ComCcsds.Subtopology,ComFprime.Subtopology,FileHandling.Subtopology:Zoom on
CdhCore.Subtopologyinside collapsedRef.Ref: solid edges land on declared ports (healthRun,eventsRun,seqCmdBuff[0]…); dashed implicit edges cross the boundary with no port, and hover shows the underlying pair:CdhCore.Subtopologydiagrammed on its own, collapsed view — its declared ports as boundary chevrons (inputs left, outputs right):Toolbar toggle:
Known limitations / follow-ups
displayDiagramis unchanged here, so it appears preexisting — not verified againstmaster./Nlabels are small at fit-to-screen zoom onRef.Ref; the count is also in the hover text.AI Used (y/n)
y
AI Usage
Implemented, tested and iterated by Devin (Cognition) under direction of Michael Starch; design decisions (collapsed view as an opt-in switch, implicit reach-in edges crossing the boundary with no rendered port, bus notation as one fat wire with a slash and count, double-click to open a subtopology) are the requester's. Reviewed by Devin Review with each finding fixed and replied to on its thread.
Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/41ec9ea5fc0a4076b6ca8e2280206d69
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/41ec9ea5fc0a4076b6ca8e2280206d69?variant=devin