fix(control): reject non-finite CLI numbers before connecting #633
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8015c9a
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!633
Loading…
Reference in a new issue
No description provided.
Delete branch "NitnekLeBorgne/Longshot-contributions:fix/ctl-finite-input-20261115"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Linux, game-free Python fixtures (no GPU) · Needs: complete game-free suite and native Windows CLI validation
Why
A mistyped timeout such as
nan,infor1e999is accepted by the control CLI. It can reach a connection and produce non-standard JSON numbers or a non-finite reply deadline instead of a clear usage error. Stick coordinates have the same problem.This is limited to validating these CLI numbers before connecting. It does not change the raw-command escape hatch, server validation or the separate event/deadline work in PR #538.
How to reproduce
Seen on: Linux, game-free source fixtures; no game or GPU involved.
Settings and switches: no live control endpoint is required for the fixed command.
Steps: run
python -I -B scripts/longshot_ctl.py wait in_play --timeout nan. A test connection spy demonstrates that main reachesconnect; an in-memory transport demonstratesNaN/Infinityserialization and a non-finite read deadline. The fixture response is synthetic, not a game response.Expected: argparse reports invalid usage, exit 2, before any connection.
Actual: on main the non-finite argument reaches the connection path. The real transport's eventual error is not claimed or exercised here.
What changed
Reject non-finite CLI numbers before opening a connection. Finite values and the raw-command escape hatch keep their existing behavior.
scripts/longshot_ctl.py: one argparse conversion checksmath.isfinite, used for the affected timeout/arrival arguments and both stick axes.tests/test_longshot_ctl_finite.py: rejected inputs must not connect; finite values and normal command routing remain covered using memory-only mocks.Settings scope: No new flags or settings. Only non-finite values of existing numeric options are rejected earlier.
Measurements
Verdict: no new regression in the exact published-head/parent comparison; existing main failures are explicitly retained.
Hardware: Linux x86-64, 6 logical CPUs, 8074 MiB RAM reported by the live host; no GPU or GPU driver used for these game-free checks; GCC 13.3.
Scene: none; default upstream public fixtures, isolated HOME/XDG/TMP, no human saves or game execution.
Method: one complete normal default runner execution per exact commit,
python -I -B tests/run_all.py --jobs 3; compare every check status, skip reason and failure signature. Not a performance median or timing claim.How to reproduce: use the exact parent
bbe6fdf23170310117c714958248e60ec0686a62and published headcea1455ed65e0caa9001bac87929c50a4bfd0716in the same recorded isolated environment. Keep AGENTS.md off disk and supplement its optional source scan read-only in memory from the public Git blob. Expect the named existing main failures and default skips below, not a wholly green suite.bbe6fdf231cea1455ed6Both full-runner exits are 1; this is not a green CI claim. Existing main failures:
tests/test_appimage_player_build.py,tests/test_bake_portability.py,tests/test_crash_dialog.py,tests/test_env_on.py,tests/test_lift_cleanup_error.py,tests/test_make_game_cache.py,tests/test_missing_nup.py,tests/test_mods_size_table.py,tests/test_options_budget_once.py,tests/test_pipeline_tour.py,tests/test_readback_late.py,tests/test_vk_occlusion_queries.py,tests/test_vk_pgo.py,tests/test_walk_key.py.Source and modes unchanged; owned process groups empty. AGENTS.md was never materialized; two unchanged SwitchesRemoved methods passed with its public blob added only in memory on each exact commit. This declared source-only context is not literal exact-tree CI equivalence. The comparison and complete native stdout/stderr are retained.
Historical focused regression evidence
The original focused evidence below keeps its original commit labels. It is historical, not extra full-runner executions on the new parent.
Verdict: the same frozen regression test fails on main and passes with this patch. On main, 42 failing subcases belong to one of three unittest methods; the other two control methods pass. On the candidate all three methods pass. A separate actual CLI invocation returns usage exit 2 with
argument --timeout: expected a finite number.Hardware: Linux game-free fixtures; no GPU/driver used; CPU and RAM not reported in these receipts.
Scene: Synthetic regression/control inputs, not a game scene.
Method: Functional outcomes from the adopted receipts below, not timing benchmarks; no fabricated repetitions or medians.
How to reproduce: Replay the named focused tests described below on the pinned baseline and candidate with identical fixtures.
6c9edffe5d4ff1db9746Baseline: main
6c9edffe5da1f5b5383977aeab3f544c0de25d4c. Separate base/candidate witnesses, source/test hashes before and after execution, complete stdout/stderr, native exits and process completion were retained. These were new qualification runs; an initial evidence review requested stronger source-to-run binding, which was supplied without changing the patch.Two existing targeted methods also pass:
GamePaths.test_builder_and_development_layoutsandLongshotCtl.test_input_waits_as_long_as_the_bridge. The latter was invoked without its class setup to avoid starting the fake game/socket. This is not a full execution oftest_longshot_ctl.py.No performance or live-transport measurement is claimed; this is parser validation.
Flags and settings
None
Testing
Tested: Linux game-free fixtures: the three new unittest methods with identical test bytes on base and candidate; finite-routing and watch controls; the two existing targeted methods named above; actual argparse usage diagnostic/exit 2. Independent static SPEC and QUALITY reviews completed after the evidence amendment. Neither reviewer claimed a test replay. A private clean patch application reproduces both candidate files exactly.
Not tested: the complete
python -I -B tests/run_all.pysuite, native Windows, a running game, real sockets/pipes, device input, GPU behavior and exceptionally large but finite transport timeouts. Raw JSON intentionally remains raw. This PR stays WIP; focused tests are not global coverage.Must be tested:
Risks
What could break: a caller deliberately passing non-standard NaN/infinity values to these CLI arguments now receives usage exit 2. Valid finite argument routing is preserved.
Turning it off: revert the commit.
Compatibility: no save, ini, shader/pipeline cache, renderer ABI, authentication or server-side changes.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.Readiness provenance and checklist notes
Current main in the frozen public readback is
aa95d35f3d021b27328b6d68109666a46c340aee; this PR head is4ff1db97467401be53df3809e2396d3a8cfc6d69. The current-main box is unchecked: historical publication/base checks are not proof of current ancestry. Current-main updating and revalidation are needed before ready, but rebase/force-push/merge are not authorized; no such operation is promised or performed. The full runner box remains unchecked; no full-suite run or Windows/host qualification is claimed by this description edit. The normal project pr ready remains blocked and must not be forced. Manual pre-merge plans are future work, not completed evidence.Historical checklist explanations (not current-main qualification):
type(scope): description) of the status line's type, after the WIP prefix.main(the exact unchanged base is checked again before publication).python -I -B tests/run_all.pypasses (not run; focused coverage only; WIP).third_party/untouched.Current completion: earlier limited-scope, not-rebased or no-full-run wording describes the original historical phase and is superseded by the exact published-head/parent qualification above. No present prohibition on authorized own-branch rebase is claimed. Remaining manual Windows/game/hardware plans are pre-merge work where not an applicable author checklist obligation; none is claimed executed.
4ff1db9746cea1455ed6Rebased onto
main@bbe6fdf: no conflicts. No tests were run here; the test boxes stay yours.WIP: fix(control): reject non-finite CLI numbers before connectingto fix(control): reject non-finite CLI numbers before connectingView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.