Commit 5eed9ea
Wire the canvas to the engine
Press Run and the page posts its graph to the session server and draws what
comes back. Change a parameter and run again and the numbers move because
the physics moved: set the fiber to 200 km and the received power drops by
exactly the 24 dB the extra loss costs, while the constellation collapses,
because the compensator is still set for the old span.
The canvas now draws the project document itself. The blocks, wires and
parameter values are no longer written into the page -- they are read from
the same `.maiman` document the server accepts, exported from the graph that
produced the reference numbers, and Run posts that object straight back. The
picture on the canvas, the values in the inspector and the graph the engine
executes are one description instead of three kept in step by hand. The
hand-written copy that used to live in the page had already drifted: it was
missing four of the fiber's parameters, added two commits ago.
Wire colours come from the manifest of the block a wire leaves, so one
cannot be drawn the wrong colour. Block captions come from the block's own
parameters, so editing a value changes what the canvas says, and a
measurement block shows its last reading or "--" rather than a number
someone typed once.
The inspector's fields were previously wired to nothing: typing in one
changed the pixels and no more, which is why it accepted 128 for a field
whose own label said "range 1 ... 8". They now write into the document, and
out-of-range input is marked. Validation lives in both places on purpose:
the engine's is the one that must be right, and this one exists so a typo is
answered where it was made. When they disagree the engine wins -- PRBS order
12 is inside the declared range 7...31, so only the engine knows it is not a
maximal-length polynomial, and its message arrives verbatim with the valid
orders listed.
Three states the page could not previously have, because it never called
anything: running, failed, and stale. A failure names its kind from the
status the server chose and opens the log. A graph edited since the last run
marks the dock stale rather than leaving numbers on screen that answer a
question no longer being asked -- reference, live and stale are three
different things and a plot from four days ago must not look like one from
the last click.
Served, the palette is fetched from the engine that is actually running, so
a component from a plugin appears without rebuilding this file. Opened from
disk it falls back to the bundled reference and says so instead of animating
a progress bar for something that is not going to happen.
tests/test_studio.py guards the page's claims from the file: that its
embedded data matches the export, that the schematic is a graph that runs,
that the numbers printed beside the plots are reproducible from it, and that
every block has somewhere to be drawn. This is not hypothetical -- the stale
copy bit twice today, once carrying a palette two components short and once
missing the project document entirely, and nothing noticed either time.
5 sabotages, 5 caught, each by the intended test.
Two bugs found by using it. The dispersion diagnostic is held in s/m and
read in ps/nm, a factor of 1e3 rather than one of the usual ones, and the
page printed "1 ps/nm removed" for a compensator set to 1360; the encoder
now sends both and a test pins them. And a TypeError thrown while rendering
a result that had arrived perfectly well was reported as "session server
unreachable", which sends whoever reads it to look in the wrong place.
Not an editor yet. Blocks cannot be added, deleted, moved or rewired -- that
is the React Flow work, and the empty state arrives with it rather than
before it.
625 tests.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 640ae76 commit 5eed9ea
10 files changed
Lines changed: 1419 additions & 113 deletions
File tree
- docs
- images
- examples
- src/maiman
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
40 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 51 | + | |
57 | 52 | | |
58 | 53 | | |
59 | 54 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
63 | 79 | | |
64 | 80 | | |
65 | 81 | | |
| |||
639 | 655 | | |
640 | 656 | | |
641 | 657 | | |
642 | | - | |
| 658 | + | |
643 | 659 | | |
644 | 660 | | |
645 | 661 | | |
| |||
Loading
Loading
0 commit comments