Repository navigation
feat: combine diagram shows each network's share, and marks a join or drop - #256
Open
Arpit-Khandelwal wants to merge 2 commits into
Open
Arpit-Khandelwal wants to merge 2 commits into
Arpit-Khandelwal wants to merge 2 commits into
Conversation
… drop Each network's path into the combine node is drawn by its share of the total speed, snapped to four steps: thicker, brighter and faster dashes for a bigger share, still for a network carrying nothing. The dash speed used to come from the row index. With reduced motion the dashes stay put and width and opacity carry the share. A network that starts carrying bytes mid-download (held for 2.5 s, so a flapping link isn't marked) draws its path in once and pulses the combine node, and "+12 MB/s" shows beside the total speed for 2 s; one that drops out shows "-8 MB/s". The tracking runs from a store subscription and re-renders the screen only when a step changes or a network joins or drops.
This branch has not been deployed
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.
Closes #241 (part of #239).
What it does
The combine diagram on the download screen now shows what each network is actually doing:
1.1 + index * 0.2s), so the top network always moved fastest whatever it carried.How it works
utils/combineFlow.tsholds the logic as plain functions, so it can be tested on its own:flowStep(share, active, previous)maps a share to step 0–4. The step edges are at 20%, 45% and 70%, so an even split between two networks lands in the middle of a step. A 5% hysteresis stops a share sitting near an edge from flipping steps every update.trackFlow(tracker, samples, now)decides when a network has joined or dropped out. The change has to hold for 2.5 s, so a flapping link is never marked. A join only counts if another network was already carrying the download before this one started, so the download starting or resuming isn't marked. A drop only counts while another network is still carrying bytes, so the download finishing or a server stall isn't marked either. The amount shown for a drop is what the network carried before it started winding down. Per-network speeds are averaged over 3 s in the main process, so its last speed above the floor would undersell it.hooks/useCombineFlow.tssubscribes to the store outside render and feeds each download update (about every 200 ms) throughtrackFlow. It only sets state when a path's step changes or a network joins or drops. The memoized screen gets no extra per-update renders and no per-frame state (Re-render only what changed on each progress update #151). It starts over on pause and when the screen switches to another download.animation-duration(the name stays the same, so the animation doesn't restart), and with the hysteresis that's rare. The draw-in is a separate one-off path (pathLength=1) so it doesn't fight the flowing dash pattern. The pulse usestransform-box: fill-boxso it scales around the node.plexo-dashnow moves -56 rather than -60. That's four whole periods of the6 8dash pattern, so the dashes no longer hitch once a loop.data-network,data-share(percent of the current total) anddata-flow-stepfor tests. The "+…" text sits in arole="status"region with the network's name for screen readers ("b joined: +659.6 KB/s").Screenshots
All in
features/shots/:diagram-light-one-network.png,diagram-dark-one-network.png: one network alone. It sits on the top step, the thickest and fastest dashes.diagram-light-joined.png,diagram-dark-joined.png: the moment b joins. Its path is mid draw-in, the node ring is pulsing, and "+659.6 KB/s" sits next to the total.diagram-light-two-networks.png,diagram-dark-two-networks.png: a few seconds later. Both paths are on the same step (an even split), and the indicator is gone.diagram-light-closeup.png,diagram-dark-closeup.png: the diagram on its own.diagram-dark-dropped-min-window.png: b switched off, at the minimum window size. b's path is still and faint, and "−670.2 KB/s" shows beside the total.Tests
e2e/combineFlow.spec.ts(new, 8 tests): the share→step mapping and its hysteresis, plus the join/drop logic. Covered: networks starting together aren't marked, a later network joins once, a flapping link is never marked, a drop reports what the network carried before winding down, everything going quiet together isn't a drop, and a network that comes back joins again.e2e/combineDiagram.spec.ts(new, needs the LAN second network like the other two-network specs). Through the real UI:data-flow-step(checked by revertingsrc/and rerunning).bun run typecheck:node,typecheck:web,typecheck:e2e,lint,format:checkandbunx electron-vite buildall pass.PLEXO_E2E_SKIP_BUILD=1 bunx playwright test e2e/combineDiagram.spec.ts e2e/combineFlow.spec.ts e2e/liveNetworks.spec.ts e2e/ui.spec.ts e2e/format.spec.ts --workers=2: 34 passed.PLEXO_E2E_SKIP_BUILD=1 bunx playwright test e2e/combineDiagram.spec.ts e2e/selection.spec.ts e2e/downloadActions.spec.ts e2e/downloads.spec.ts e2e/scheduleQueue.spec.ts --workers=2: 70 passed. These are the other specs that open the download screen.For you to decide
<title>on each path ("b: about 50% of the speed now"), or rename the column.Part of #239. Ready to look at, but still waiting for @anmolkapil's yes on #241. Happy to change course, or close it if the idea isn't wanted.