fix(scripts): bump PirateWeatherADV timeouts to v3, correct 10s→30s docs#3942
Conversation
…docs The bundled community script's per-request Nominatim/Pirate Weather urlopen timeouts (3s/4s/3s) were sized against a stale "10-second script timeout" assumption. The Auto-Responder and Timed Event script kill timeout is actually 30 seconds (execFileAsync timeout in meshtasticManager.ts), so a slow upstream response could exceed the old per-call socket timeouts well before the real kill signal, surfacing as "The read operation timed out". Bumps timeouts to 5s/8s/5s as named constants (community-submitted v3) and corrects the "10-second" claim to 30 seconds everywhere else it was documented. Closes #3941 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Shsuu7NEH9Z7w1va1YcpZj
|
Claude finished @Yeraze's task —— View job PR Review: fix(scripts): bump PirateWeatherADV timeouts to v3, correct 10s→30s docs
SummaryThis is a straightforward, well-scoped fix. The PR's central claim — that the actual script kill timeout is 30 seconds, not 10 — is verified correct in const SCRIPT_AUTO_RESPONDER_TIMEOUT_MS = 30_000;
// ...
const { stdout, stderr } = await execFileAsync(interpreter, [resolvedPath, ...scriptArgsList], {
timeout: SCRIPT_AUTO_RESPONDER_TIMEOUT_MS,
...
});The same 30s timeout also applies to the Timed Event (geofence/timer) code paths ( Code Review
The timeout constants and comment are correct and clear: # The Auto-Responder hard kills scripts after 30 seconds (execFileAsync timeout).
# We set individual HTTP timeouts conservatively so the total worst-case network
# time stays well under 20s, leaving a safe buffer before the 30s kill signal:
TIMEOUT_GEOCODE = 5 # forward geocode (Nominatim)
TIMEOUT_API = 8 # Pirate Weather API fetch
TIMEOUT_REVERSE = 5 # reverse geocode (Nominatim)Total worst-case: 5+8+5 = 18 seconds against a 30-second hard kill. This is a reasonable safety margin. One minor observation: in GPS weather mode, both Documentation All 5 occurrences in CHANGELOG.md Entry is accurate and well-placed under Issues FoundNone. This is a correct, focused fix with no functional changes to production code. Verdict✅ Approved for merge. The fix is accurate, the timeout arithmetic is sound (5+8+5=18s worst case vs 30s kill budget), and the grep confirms no stale "10-second" documentation references remain anywhere in the repo that relate to script execution. |
Submitter posted an improved v3 attachment on #3941 (verified by NodeZero's review) with three low-risk fixes over the version already in this PR: - _fmt_label/_fmt_part: 1-3 letter alpha tokens are now uppercased as abbreviations regardless of input case (on -> ON), not just preserved when already uppercase. - resolve_input: guard so a location that normalises to empty (e.g. just commas) falls through to the GPS-coordinate fallback instead of calling geocode_location(''). - main() exception handler: redact PIRATE_WEATHER_API_KEY from any exception text before broadcasting the error on the mesh (key-leak guard). Also applies the module-docstring improvements from the attachment and the two function-docstring corrections NodeZero flagged (_fmt_label and resolve_input), which the attachment itself had not updated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AphLfgUJWaFNAgU5UXdJ4n
|
Folded in the follow-up fixes from @Nullvoid3771's second v3 attachment (validated in @nodezero's review above) — commit
Also applied the module-docstring improvements from the attachment plus the two function-docstring corrections NodeZero flagged ( -- folded in on behalf of the reviewers; leaving the merge to @Yeraze. |
|
Claude finished @Yeraze's task —— View job PR Review: fix(scripts): bump PirateWeatherADV timeouts to v3, correct 10s→30s docs
SummaryThis PR does two things: (1) bumps Code Quality
The new abbreviation logic works correctly but has a subtle inconsistency in the inner loop at lines 295–298: if w.isupper() and len(w) <= 3:
out.append(w) # preserve already-uppercase abbreviation
else:
out.append(w[0].upper() + w[1:])In the multi-word path (e.g.
if not location_normalised:
location = ''
else:
coords = geocode_location(location_normalised)Correct — this prevents calling API key redaction (lines 514, 721–723) Both call sites correctly redact One minor stylistic note: the SecurityAPI key redaction is the key security improvement here. The guard correctly prevents the key from appearing in mesh broadcasts if an unexpected exception includes the URL (which embeds the key). No concerns. PerformanceTimeout arithmetic: Test CoverageAs noted in the PR, there are no automated tests for example scripts or docs. The manual test plan is appropriate for the scope of this change ( DocumentationAll Issues FoundNone blocking. One minor edge case in Verdict✅ Looks good. The timeout values are correct, the arithmetic is sound, the security fix (API key redaction) is implemented correctly in both exception handlers, and the documentation corrections are accurate and complete. |
Summary
Closes #3941.
examples/auto-responder-scripts/PirateWeatherADV.pysized its per-request Nominatim/Pirate Weatherurlopentimeouts (3s/4s/3s) against a stale "MeshMonitor enforces... a 10-second script timeout" comment. I verified againstsrc/server/meshtasticManager.tsthat both the Auto-Responder path and the Timed Event path actually kill scripts after 30 seconds (execFileAsync(..., { timeout: 30000 })), not 10.The read operation timed outerror reported in User Script Submission update PirateWeatherADV v3 #3941 (mostly seen via Timed Events).urlopentimeouts to 5s/8s/5s as named constants (TIMEOUT_GEOCODE/TIMEOUT_API/TIMEOUT_REVERSE) and corrects the misleading comment. I diffed the submitted v3 attachment against the currently-bundled script to confirm this was the full extent of the intended change (just timeouts + comment) before applying it verbatim.docs/features/automation.md(5 spots),docs/developers/auto-responder-scripting.md(2 spots),docs/user-scripts.md,examples/auto-responder-scripts/README.md.[Unreleased].Test plan
python3 -m py_compile examples/auto-responder-scripts/PirateWeatherADV.py— syntax OK🤖 Generated with Claude Code
https://claude.ai/code/session_01Shsuu7NEH9Z7w1va1YcpZj
Generated by Claude Code