Skip to content

fix(ground): safe non-negative int parse for DTC drone counts#165

Closed
Bartok9 wants to merge 2 commits into
JacopoPan:mainfrom
Bartok9:fix/dtc-count-env
Closed

fix(ground): safe non-negative int parse for DTC drone counts#165
Bartok9 wants to merge 2 commits into
JacopoPan:mainfrom
Bartok9:fix/dtc-count-env

Conversation

@Bartok9

@Bartok9 Bartok9 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Parse `num_quads`/`NUM_QUADS` (and vtol/tail) via a pure non-negative int helper with offline tests; preserve lowercase-first precedence.

Motivation

Bare `int(os.environ.get(...))` raises on empty/garbage env and accepts negatives. Fail closed with defaults only for missing keys.

Verification

  • `cd ground/ground_ws/src/drone_traffic_controller && PYTHONPATH=. python3 -m unittest drone_traffic_controller.test_count_env -v` → 4 passed

  • Did NOT change: sim_run/sim_build/deploy_* env validation (maintainer check_env_vars), geofence/arm paths

Notes

  • One logical change; minimal additive diff
  • Human-authored and reviewed; AI-assisted drafting only where noted in campaign process
  • DCO signed-off

Agent-Owner: sera · Platform: hermes · Claim-TTL: 24h

Daniel Pike and others added 2 commits July 23, 2026 02:26
Reject empty/signed/decimal env values for NUM_QUADS/VTOLS/TAILS
before building expected drone id lists; add offline unit tests.

Signed-off-by: Daniel Pike <daniel@team-of-light.org>
ruff F401 on dtc_controller_node after moving NUM_* reads to
parse_nonneg_int_env.

Signed-off-by: Daniel Pike <daniel@team-of-light.org>
Signed-off-by: Bartok9 <danielrpike9@gmail.com>
@JacopoPan JacopoPan closed this Jul 23, 2026
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.

2 participants