Skip to content

Batman V support - #345

Open
grische wants to merge 5 commits into
freifunk:mainfrom
freifunkMUC:batman-v-support
Open

grische wants to merge 5 commits into
freifunk:mainfrom
freifunkMUC:batman-v-support

Conversation

@grische

@grische grische commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Motivation and Context

How Has This Been Tested?

Locally. Using https://gw04.ext.ffmuc.net/meshviewer.json

Screenshots/links:

It is live here: https://map.ffmuc.net/

image - image

Checklist:

  • My code follows the code style of this project. (CI will test it anyway and also needs approval)
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

@grische
grische marked this pull request as draft April 17, 2026 20:26
@grische

grische commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator Author

Marking as draft until upstream PRs are more stabilised.

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Preview deployed: https://freifunk.github.io/meshviewer/pr-preview/pr-345/

Updated for commit 2ba2088.

github-actions Bot pushed a commit that referenced this pull request Jun 18, 2026
@grische
grische marked this pull request as ready for review June 19, 2026 13:02
grische and others added 5 commits June 25, 2026 20:06
Batman IV neighbours expose tq, Batman V neighbours expose throughput.
Each Link can now carry either pair; UI sites pick whichever metric is
present and fall back to the other when missing.

- Link interface gains optional source_tp / target_tp (kbps) alongside
  source_tq / target_tq (now also optional; typically only one pair is
  populated per link). The field names match the yanic graph.json wire
  format.
- helper.ts: showThroughput formats kbps with SI-prefixed bit/s units;
  linkMetric returns a 0..1 normalised quality (Batman IV: tq directly;
  Batman V: log scale over 1 Mbps .. 1.2 Gbps); showLinkMetric returns
  a human-readable string for one direction; showBiDiLinkMetric joins
  both directions and drops the " - " separator when one side reports
  no metric.
- linklist, infobox/link, infobox/node, labellayer: render links with
  showBiDiLinkMetric; sort comparators wrap tq/throughput through
  linkMetric to tolerate missing values.
- forcegraph: link colour gradient and force-simulation strength use
  linkMetric so Batman V links don't destabilise the d3 simulation
  with NaN.
- forcegraph/draw and map/labellayer: gate the >= 0.99 "other" link
  recolouring branch on linkMetric so Batman V "other" links are also
  recoloured once their throughput saturates the metric range.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Batman V links carry throughput instead of TQ. Use "Transmit quality"
only when neither side reports throughput; otherwise show "Throughput".
Add the new "throughput" translation key to all shipped locales.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously sorted by source direction only; average both directions
so the neighbour table orders rows the same way as the link list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Accommodate wider display strings such as "120 Mbit/s" that replaced
the previous "95%" TQ percentages on Batman V links.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add a self-contained six-node Batman V cluster whose links exercise the
throughput code paths:

- both-direction wifi5 throughput, healthy and symmetric
- strong asymmetry with single-digit Mbit/s decimal formatting
- sub-Mbit/s "kbit/s" units plus the linkMetric floor clamp
- one-sided source_tp / target_tp (VPN uplinks; separator dropped)
- mixed Batman IV tq and Batman V throughput on one link
- a max-rate "other" backbone link (>= 0.99 metric -> recolour)

The hub node has four neighbours of varying quality to exercise the
bidirectional-metric neighbour-table sort. Throughput magnitudes follow
real Batman V graph data: RF links from sub-Mbit/s to ~870 Mbit/s, VPN
and backbone near 1 Gbit/s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@grische
grische force-pushed the batman-v-support branch from fdacca3 to 2ba2088 Compare June 25, 2026 20:07
@grische

grische commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Added a dev fixture for most of the new Batman V cases

github-actions Bot pushed a commit that referenced this pull request Jun 25, 2026

@rotanid rotanid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with two items worth addressing.

🔸 Concerns

  1. No unit tests for the new numeric helpers. showThroughput, linkMetric, showLinkMetric, and showBiDiLinkMetric carry non-trivial logic — log-scale normalisation, the 0/1 clamp, the tq-beats-tp precedence rule, and the separator-drop when one side lacks a metric. PR #477 establishes a test-suite precedent in this repo (filters/*.test.ts), so the boundary contracts here deserve parity: sub-1 Mbps floor, saturation at 1.2 Gbps, mixed source_tq+target_tp precedence, and the empty-string collapse. Lifting the magic constants 1e3 / 1.2e6 out of linkMetric into named/configurable bounds would make that contract legible and testable, and would let communities with 10 Gbps backbones retune the saturation ceiling.
  2. Mixed-protocol link mislabels the row. In lib/infobox/link.ts the label is selected by (link.source_tp ?? 0) > 0 || (link.target_tp ?? 0) > 0 ? "node.throughput" : "node.tq", so any link with throughput on either side is labelled "Throughput" — but the value still embeds a TQ percentage when the other side carries source_tq. The dev fixture's mixed vpn link renders 98% - 1 Gbit/s underneath a "Throughput" heading. Consider labelling per-side, or qualifying the header (e.g., "Link quality") when the value is heterogeneous.

Merge ordering

This PR overlaps with #477 — both touch helper.ts, labellayer, and the Link interface. Recommend merging this PR first — #477's decomposition of helper.ts and conversion of labellayer.js.ts will rebase cleanly over the additions here, whereas landing #477 first forces a painful manual re-split of the new helpers into the decomposed modules.

Review assisted by GLM 5.2 (opencode).

@rotanid
rotanid requested a review from maurerle September 7, 2026 02:22
@maurerle

maurerle commented Sep 7, 2026

Copy link
Copy Markdown
Member

I consider this blocked until its merged in gluon :)

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.

3 participants