Skip to content

fix(sim): make radio comparisons reproducible - #75

Draft
Komzpa wants to merge 32 commits into
meshtastic:masterfrom
Komzpa:codex/split-sim-determinism-cleanup
Draft

Komzpa wants to merge 32 commits into
meshtastic:masterfrom
Komzpa:codex/split-sim-determinism-cleanup

Conversation

@Komzpa

@Komzpa Komzpa commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • seed rebroadcast jitter from the simulation seed and node id so static/DCR/DTP comparisons do not drift with system entropy
  • route interactive receiver calculations through the shared link-budget helper so terrain, clutter, antenna gains, and fitted calibration stay consistent
  • switch the interactive node-config load to yaml.safe_load and remove small import/string cleanups
  • print PHY-loss and capture-collision reason counters in direct loraMesh.py runs when those models are enabled
  • add regression tests for deterministic rebroadcast jitter and near-field path-loss floor behavior

Stack

Validation

  • .venv/bin/python -u loraMesh.py 2 --no-gui --simtime-seconds 2 --period-seconds 1 --phy-loss-model --capture-collision-model
  • .venv/bin/python -m unittest tests.test_lora_mesh_cli tests.test_node tests.test_phy tests.test_radio_policy_compare
  • /home/kom/.local/bin/ruff check batchSim.py lib/interactive.py lib/node.py loraMesh.py tests/test_node.py tests/test_phy.py
  • .venv/bin/python -m compileall -q .
  • .venv/bin/python tools/radio_policy_compare.py --simtime-seconds 5 --period-seconds 2 --policies static,dcr,dcr_dtp -- --no-clutter
  • .venv/bin/python -m unittest (134 tests)
  • git diff --check
  • private-marker scan for deployment/source terms

@Komzpa
Komzpa force-pushed the codex/split-sim-determinism-cleanup branch 6 times, most recently from 0983516 to 9cba694 Compare May 5, 2026 20:17
@Komzpa
Komzpa force-pushed the codex/split-sim-determinism-cleanup branch from 9cba694 to 06ad4ea Compare May 6, 2026 07:06
@Komzpa
Komzpa force-pushed the codex/split-sim-determinism-cleanup branch 3 times, most recently from cf99213 to f72b56b 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: f72b56b3dc

ℹ️ 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/map_input.py
@Komzpa
Komzpa marked this pull request as draft May 17, 2026 17:41
Komzpa added 9 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/split-sim-determinism-cleanup branch from 2f49dd7 to 6f7d86f Compare August 21, 2026 00:30
@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: 75bff72c-78ba-4ac0-89b5-759cbe33ae85

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/split-sim-determinism-cleanup branch from 6f7d86f to 80264ad 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