Repository navigation
feat: a view can be of the instance, asked of the root by the path of instances - #175
Merged
Merged
Conversation
… instances A producer marks a view it offers on a node with of: 'instance'. By name, a file answers for the definition it holds under that name; for a unit made per instance (by a factory, with the instance's parameters) that is another one, and the view shown was not the node's. A view so marked is asked of the editor's root, by the path of instances that leads to the node, as a drill-down into a nested unit already falls back to. Its file is asked by name only when the root has no answer, and the same question is not asked twice. The mark stays on the view's crumb, so the trail leads back to the same view. A view without it is asked as before. Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
…en it is not From the review of #175, which traced the request end to end with a spawned sidecar. - A refresh by the host (a keystroke or a save in any source file, a run) repeats the file, the name and the trail, and named no view: the view was replaced by the unit's structure under a breadcrumb that still said the view. This predates the mark and hit every view; with it, the actor view of the file being edited was lost at the first keystroke. The storage now takes the view from the trail's last crumb when the request names none and is for that crumb's unit. - The root is asked first only for a whole trail: a crumb shown by name, with no instance, made the path skip a step, and the root's answer for the shorter path was shown. - When the root has no answer and the file answers by name, the document carries a warning with the root's reason: what is shown is the definition's. When neither answers, the error names both. - The host's own trail parser keeps a view crumb's fields. - Tests: what the sidecar is sent on the wire, a trail of two, of three, with a hole; the refresh through the storage; the mark from the document to the node's arguments. Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
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.
Found while installing the CalPy sidecar for a first live test of the actor view: in the MPEG-4 example only 10 of 42 actors opened the view on a double-click. The rest are made by factories (
make_X(...)), and for those the platform could not ask for the right thing.The problem
A view of a node's unit is asked by name: the file the node references, and the name of its definition. For a unit made per instance (a factory called with the instance's parameters) the file holds, under that name, another object: its own default one, or none. So the sidecar either answered for the wrong class or could not answer, and the CalPy sidecar therefore offered no view on such actors.
A drill-down into a nested unit already has the answer to this: when the file cannot answer by name, the toolkit asks the editor's root by the path of instances the trail records (
rootNetwork+instancePath).What changes
meta.views: [{ id, label, of: 'instance' }].openLeaf) and the context-menu item pass the mark in theopenViewaction;requestViewputs it on the view's crumb (viewOf), and the trail keeps it through serialising and parsing, so a click on the crumb asks for the same thing.SidecarModelSource.getGraph). When the request's view is the last crumb's and that crumb is marked, the root is asked first, by the instance path, with the view. Only if it has no answer is the file asked by name; the root is then not asked a second time. The resolved options go on with the document, as they do for the existing fallback, so the layout is the instance's.Checked
sidecar-toolkit/test/view-of-instance.test.ts: the order of the questions for a marked view (root first; file by name when the root has none; never three), for an unmarked one (file first, root as fallback, as today), and for a mark that does not apply (another view, no instance, an unknown word).diagram-server/test/open-view.test.ts: the view entry, the menu item's action, the crumb,viewIsOfInstance.diagram-client/test/view-of-instance-trail.test.tsandleaf-double-click-opens-source.test.ts: the action, the crumb on the request, the crumb coming back, the handler.After review
An independent review traced the request end to end with the real client and server code and a spawned sidecar: a marked view opens correctly for an actor of the root network and for one in a nested network reached by drill-down (same file, another file in its own editor, in-place products), and an unmarked view sends byte-for-byte the requests it sent before, also when the by-name load fails. Its findings, fixed in 503eacb:
withTrailView). Tested through the storage with a refresh-shaped request.view_of_definition) saying that what is shown is the definition's, with the root's reason; when neither answers, the error names both.{rootNetwork, instancePath, view}on the root's file, nonetwork), a trail of two, of three, and with a hole, and the mark from the document to the node's arguments.Stated rather than changed: the mark is said of a node's views (a view offered on the canvas is reached through no node), and it is acted on by the model source that asks a sidecar; a product whose graph comes from a CLI plan asks by name as before.
Not checked
https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv