Skip to content

fix(layout): elkjs takes no layout it would hold the host for, and the diagram says why - #272

Merged
endrix merged 5 commits into
mainfrom
feat/product-layout-rates
Dec 2, 2026
Merged

endrix merged 5 commits into
mainfrom
feat/product-layout-rates

Conversation

@endrix

@endrix endrix commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

What

What elkjs may be handed, and what the reader is told when a layout is not run. All of it was found on the live check of stage 8.5b in mlir-viewer.

elkjs takes no layout it would hold the host for. #270 refused a layout the server was asked for and did not answer, when elkjs was estimated to need more than the server timeout and more than a minute. A graph opened without Java, or with layout.engine set to elkjs, still went to elkjs whatever its size. The rule is one now. Whoever was to lay a graph out, elkjs takes it only when it is estimated to finish within a minute (ELKJS_BUDGET_MS), whatever the timeout of the server, and past that the layout is refused. The message says why the server did not lay the graph out:

  • it timed out or failed (as before),
  • it is not running, with the reason of the failed start,
  • elkjs is the engine chosen,
  • the graph asks for an algorithm the server has not.

With elkjs chosen the switch now stands before elkjs too. It starts no server.

A product prices layouts with its own rates (DiagramProfile.elkServer.rates, ElkServerOptions.rates). The rates of the platform were fitted to its own layout options. mlir-viewer lays out with a configurator of its own, and on one function of 6,172 nodes (5,960 in one block) the two are far apart:

elkjs
estimate with the middle rates of the platform 24 s
estimate with the rates mlir measured 12 min
measured still laying out after 35 min, then stopped

So a server that did not answer handed elkjs that layout where a refusal was due. A product that measured its layout names its rates beside its jar. The engine choice under auto, the refusal and the log line go by them. A product that names none is priced as before.

A server a layout timed out on is ended. The same function went to the Java server under auto and timed out at 120 s. The client closed its socket and the server stayed on the layout: five minutes later the process was still at a full core and a gigabyte of heap, with the next layouts going to it. A layout cannot be taken back from the server, so a server that had a minute or more for the layout (ELK_SERVER_STUCK_MS) is retired, as one that overflowed its stack is (#271). It answers what else it was asked, is then ended, and the next layout starts another. With a shorter timeout the server is left to finish, so that a JVM is not ended at every layout.

The status line is read without the pointer (status-line.css). A refusal is said in a StatusAction. GLSP draws that as an icon in the top left corner and shows the words only under the pointer, and in mlir-viewer the icon lies under the outline button. So the reason was on the page and not on the screen, in every product. A warning or an error is now a line at the bottom left of the canvas, a row above the crumbs, in the look of the loading pill. It keeps clear of the property panel and of an open outline panel, goes to the top left while the chat card is shown, and a fit keeps the drawing clear of it. GLSP's own progress in the same place ("Model loading in progress") is not drawn, since the loading indicator tells it, and the note of a rough layout is a warning now so that it is on the line.

A server that cannot start says what it failed on. A java that is not there was reported as a server that "did not start within 15000 ms". It is now one that could not be run, with the error of the system, and a java that exits as it starts (one before 17, an option it does not know) says so with the line that names the error.

What changes for the products

sv-ide, vhdl-ide, chisel-ide, ndf-ide and ac-ide name no rates, so their estimates stay. What changes for them is the refusal without a server: a graph elkjs is estimated to need more than a minute for is no longer laid out when Java is missing or layout.engine is elkjs, and the timeout of the server no longer raises that minute. Their setting texts say "Without a running server elkjs lays out every diagram" since today, and get a follow-up each.

Not in this pull request

A large graph of another algorithm than layered (force, stress) has no estimate, so elkjs is not refused it. There is no measurement to set a size by yet.

Checks

  • npm run typecheck, npm run check:neutrality, npm test (all packages) and npm run build pass.
  • elk-server.test.ts: the refusal with no server (with and without a reason), with elkjs chosen, for a graph of an algorithm the server has not, the engine choice and the refusal by product rates, the reason of a failed start (failure), and the factory with elkjs chosen.
  • profile-elk-server-options.test.ts: the rates of a profile go through, and none is named for a profile without them.
  • status-line-css-split.test.ts: the words are shown for a warning or an error only, the line is above the crumbs, clear of the property panel and of an open outline, at the top left with the chat card, an overlay for Fit, and its colours are the theme's.
  • In sv-ide built on this branch, with a status set by hand in the page: an info status is not drawn, a warning and an error are a line above the crumbs, and with the chat card open the line is at the top left.
  • Live, in the mlir-viewer harness built on this branch (main of Top_SW_array, 6,172 nodes, estimated at 12 min on elkjs by the rates of mlir): refused after a server timeout of 200 ms, with Java missing, and with the engine set to elkjs, each with its own reason on the status line. Under auto with the default timeout the server ran its 120 s, the layout was refused, and the server was ended.

https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY

…product prices layouts with its own rates

elkjs runs on the extension host's thread. A layout the server did not
answer was already refused when elkjs was estimated to need more than the
server's timeout and more than a minute. A graph opened without Java, or
with the engine set to elkjs, still went to elkjs whatever its size: one
function of 6,172 nodes in mlir-viewer was still laying out after 35
minutes.

- The rule is one now: whoever was to lay a graph out, elkjs takes it only
  within that estimate. Past it the layout is refused, and the message
  says why the server did not lay the graph out (it timed out or failed,
  it is not running and why, elkjs is the engine chosen, or the graph asks
  for an algorithm the server has not).
- With elkjs chosen the switch stands before elkjs too. It starts no
  server.
- A product names the rates it measured on its own layout options
  (DiagramProfile.elkServer.rates, ElkServerOptions.rates). The engine
  choice, the refusal and the log go by them. The rates of the platform
  price that function at 24 s on elkjs, the rates mlir measured at 12 min.
- A java that is not there is reported as one that could not be run, with
  the error of the system, not as a server slow to start.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
…s turned up

- The most elkjs may be estimated to take is a minute, whatever the timeout
  of the server (ELKJS_BUDGET_MS, elkjsTakeoverMs is gone). A timeout raised
  to ten minutes for large server layouts let elkjs hold the host as long,
  and with elkjs chosen the budget was a setting of a server never started.
- A server that cannot start says what it failed on. A java that ends as it
  starts (one before 17) exited with its code and its last line. It was
  reported as slow to start, and that text reaches the status line now.
  Each reason names Java 17.
- The reason "the layout engine is set to elkjs" is given for that choice
  alone.
- The rates of a profile are checked: both engines, four finite numbers
  that are not negative. Others are said in the log and left out, where one
  missing failed every layout and one that is no number switched off the
  engine choice and the refusal.
- One set of rates prices every layout of a product, and the API says so:
  a product that lays out with the presets of the platform names none. The
  sidecar profile input keeps offering none.
- The two declarations of the rates shape are held equal at compile time.
- The comments of the server process no longer promise that a missing
  server leaves every layout to elkjs.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
@endrix

endrix commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Review at medium effort: nine findings, eight changed something, in the second commit.

Finding What was done
The budget of elkjs was the timeout of the server, also with elkjs chosen The budget is a minute, always (ELKJS_BUDGET_MS). A long server timeout no longer lets elkjs hold the host as long. elkjsTakeoverMs is gone
A java that exits at once was reported as slow to start, and that text now reaches the status line The process tells three failures apart: could not be run (spawn error), exited as it started (code and last line of stderr), did not start in time
The message names no remedy Each reason of a failed start names Java 17, and "the layout engine is set to elkjs" names the setting. A first view that is refused stays not laid out, with the status line. The changelog says so
One set of rates for every preset Documented in the API and in ElkServerOptions: one set prices every layout of a product, so a product on the presets of the platform names none
Sidecar products cannot name rates Kept so on purpose, for the reason above. The sidecar input says it
Rates are not validated usableRates: both engines, four finite numbers that are not negative. Others are said in the log and left out
"set to elkjs" given for an engine that is not elkjs That reason is for that choice alone
Stale comments in the server process Reworded
The rates shape is declared twice Held equal at compile time (RATES_ARE_ONE_SHAPE)

https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY

A refused layout is said in a StatusAction. GLSP draws that as an icon in
the top left corner and shows the words only under the pointer, and in
mlir-viewer the icon lies under the outline button. So the reason a layout
was not run was on the page and not on the screen.

status-line.css makes a status with words a line at the bottom left of the
canvas, in the look of the loading pill, and draws nothing for a status
without words. The line keeps to the left of an open outline panel. A
product with a stylesheet of its own imports the sheet alone.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
A layout that runs past its time cannot be taken back from the ELK server.
The client closed its socket and the server stayed on the layout: after a
graph of 6,172 nodes timed out at 120 s, the Java process was still at a
full core and a gigabyte of heap minutes later, with the next layouts going
to the same server.

Such a server is retired, as one that overflowed its stack is: it answers
what else it was asked, is then ended, and the next layout starts another.
The timeout is an error of its own (ElkServerTimeoutError), so that only a
server still at work is ended, not one whose layout failed otherwise.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
@endrix endrix changed the title fix(layout): elkjs takes no layout it would hold the host for, and a product prices layouts with its own rates fix(layout): elkjs takes no layout it would hold the host for, and the diagram says why Dec 2, 2026
…the crumbs

The server process:
- Only a server that had a minute or more for a layout is ended when the
  layout times out (ELK_SERVER_STUCK_MS). A shorter timeout is a wish to see
  elkjs sooner, and a JVM ended at every layout never gets warm.
- An answer that arrived while the host was busy is read before the timeout
  is called.
- A layout that timed out and overflows the stack later no longer ends a
  layout another diagram still waits for (abandoned layouts are counted).
- The reason of a JVM that ends as it starts is the line naming its
  exception, not the frame under it, read after the error stream is. Java
  17 is named only where the error is a class file version.

The status line:
- A row above the crumbs, which have the bottom left too, and clear of the
  property panel as they are. At the top left while the chat card is shown.
- Only a warning or an error is drawn. GLSP says its own progress there
  ("Model loading in progress"), which the loading indicator tells.
- The note of a rough layout is a warning, so that it is on the line.
- A fit keeps the drawing clear of the line.

Rates that are all zero for an engine are left out as unusable.

Claude-Session: https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY
@endrix

endrix commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Second review at medium effort, of the whole pull request after it grew by the status line and the ended server: nine findings, handled in 4th and 5th commits.

Finding What was done
Every timeout ends the shared server, also a healthy one that is cold or given 5 s Only a server that had a minute or more for the layout is ended (ELK_SERVER_STUCK_MS). An answer that arrived while the host was busy is read before the timeout is called
The status line lies on the crumbs and on the property panel, and under the chat card A row above the crumbs, clear of the property panel as they are, and at the top left while the chat card is shown. Seen in sv-ide
Every GLSP status with words becomes a box ("Model loading in progress") Only a warning or an error is drawn. The note of a rough layout is a warning now
The reason of a Java that exits at start can be a stack frame, or miss the line The line naming the exception is taken, after the error stream is read
"it needs Java 17" for any exit at start Said only for a class file version error
Rates that are all zero pass Left out as unusable
A fit does not keep clear of the status line .sprotty-status is in CANVAS_OVERLAYS
A large graph of another algorithm than layered is never refused (before this pull request too) Not changed: such nodes have no estimate, and no measurement to set a size by. Said in the changelog, and noted as a follow-up in the stage 8 plan of mlir-viewer
A layout that timed out and overflows later ends another diagram's layout (before this pull request too) Fixed: abandoned layouts are counted, and their overflow is not charged to a layout still asked for

https://claude.ai/code/session_01EToj6NxqLABK3H5cucHNsY

@endrix
endrix merged commit d166dff into main Dec 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant