Skip to content

refactor(sim): reuse PR33 link-budget helpers - #77

Draft
Komzpa wants to merge 37 commits into
meshtastic:masterfrom
Komzpa:codex/pr33-remaining-optimizations
Draft

refactor(sim): reuse PR33 link-budget helpers#77
Komzpa wants to merge 37 commits into
meshtastic:masterfrom
Komzpa:codex/pr33-remaining-optimizations

Conversation

@Komzpa

@Komzpa Komzpa commented May 5, 2026

Copy link
Copy Markdown
Contributor

Summary

This is the small reusable optimization slice from the stale #33 after the work was split along the discussion in #39 and #50.

The new review surface on top of #72 is intentionally narrow:

  • estimate_path_loss() can take an explicit path-loss model= without mutating Config.MODEL, so scenario or analysis code can compare models without leaking global config state
  • MeshPacket records the receiver IDs it already classified as CAD-detected or sensitivity-sensed while refreshing link budgets
  • MeshNode.transmit() reuses those receiver-ID lists instead of scanning every node again for flags that were just computed

Stack context

GitHub shows the full stacked diff against master until the lower PRs merge. The dependency stack below this PR is #68, #69, #70, #73, #74, #75, #71, and #72. Those carry the map/terrain/clutter/RF/DCR/DTP pieces; this PR only adds the PR33 helper cleanup needed on top of that stack.

Why this shape

The useful part from #33 here was not the whole old branch. Maintainer feedback on #33 asked to separate optimizations from Burning Man-specific code, and #39/#50 asked for smaller reviewable PRs.

What is deliberately left out:

Validation

  • MPLBACKEND=Agg .venv/bin/python -m unittest tests.test_phy tests.test_lora_mesh_cli tests.test_node tests.test_dtp tests.test_packet -v -> 58 tests OK
  • git diff --check origin/pr/72..origin/pr/77
  • GitHub unittest check is green

@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch from a36b7bc to db3debf Compare May 5, 2026 19:32
@Komzpa Komzpa changed the title perf(sim): split safe PR33 optimizations refactor(sim): split reusable PR33 radio helpers May 5, 2026
@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch 2 times, most recently from b495d48 to 3f9a5af Compare May 5, 2026 20:17
@Komzpa Komzpa changed the title refactor(sim): split reusable PR33 radio helpers refactor(sim): reuse PR33 link-budget helpers May 5, 2026
@Komzpa
Komzpa marked this pull request as ready for review May 5, 2026 20:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3f9a5afe9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread loraMesh.py Outdated
@Komzpa
Komzpa marked this pull request as draft May 6, 2026 06:15
@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch from 3f9a5af to 6fed8ee Compare May 6, 2026 07:06
@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch 3 times, most recently from 0ce6eaf to 0a25ca3 Compare May 15, 2026 21:01
@Komzpa
Komzpa marked this pull request as ready for review May 17, 2026 17:24

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a25ca3d8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/packet.py
@Komzpa
Komzpa marked this pull request as draft May 17, 2026 17:42
Komzpa added 11 commits August 17, 2026 14:16
Signed-off-by: Darafei Praliaskouski <me@komzpa.net>
- treat unparsable map altitude values as absent instead of failing the
  whole import with an uncaught TypeError/ValueError
- import CLIENT_BASE nodes on the router side: current firmware
  rebroadcasts them like ROUTER_LATE
- compare the trig-derived origin longitude with a tolerance in tests
A present origin block that is not a map or lacks a usable lat/lon pair
now raises instead of silently dropping the origin and projecting
terrain against a different origin than the author intended. Accept the
latitude/longitude key spellings alongside lat/lon.
Concurrent runs sharing one cache directory wrote the same fixed temp
filename and could atomically publish an interleaved, corrupt tile that
then stayed cached. Download and unpack through process-unique temp
names and clean up archives after unpacking.
Cache keys carried id(TERRAIN_GRID), so a reused object address after a
Config-reusing parse could serve losses computed against an earlier
grid. Key the cache on a monotonically increasing per-grid token
instead. Also pick the nearest interpolation samples with
heapq.nsmallest instead of sorting every sample in this hot path, and
use the shared node_antenna_height helper from lib.common instead of a
diverging local copy.
Automatic SRTM tile selection evaluated the full link budget for every
node pair. Derive one conservative best-case link distance (path loss
grows monotonically with distance in every lib.phy model) and skip
pairs beyond it before the expensive per-pair work; document that the
selection scales with node pairs and recommend --map-limit for broad
imports. Also log when a wrapped --map-bbox is discarded for terrain so
the substituted extent is not silent, and import node_antenna_height
from its canonical module.
TCPInterface connects without a socket timeout, so a stale
--nodedb-host blocked the CLI indefinitely. Probe reachability with a
bounded connect first so unreachable hosts fail fast with the existing
could-not-connect error.
@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch from ec0a51e to e6c3daa Compare August 21, 2026 00:31
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6abb2338-1f21-41ab-bf02-5183c8081074

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Komzpa
Komzpa force-pushed the codex/pr33-remaining-optimizations branch from e6c3daa to 0dca93c Compare August 21, 2026 00:57
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