Skip to content

fix(cli): apply the documented 600s read timeout, and report a timeout as one (#42) - #56

Merged
jrosskopf merged 3 commits into
mainfrom
fix/42-read-timeout
Sep 1, 2026
Merged

fix(cli): apply the documented 600s read timeout, and report a timeout as one (#42)#56
jrosskopf merged 3 commits into
mainfrom
fix/42-read-timeout

Conversation

@jrosskopf

@jrosskopf jrosskopf commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closes #42.

Two defaults, and the lower one won

AdtSessionOptions::read_timeout defaulted to 120s while AppConfig::timeout_seconds documented 600. Both CLI entry points assign read_timeout only under if (HasFlag(args, "timeout")), so unless --timeout was passed the session kept its own 120s — for the CLI, the legacy deploy path and the MCP server alike.

Anything slower failed at 121s. The ABAP behind it keeps running server-side and normally completes, so the caller was told the work failed when it had succeeded, and had to go query the result to find out which.

There is now one constant, kDefaultReadTimeoutSeconds, behind both.

A timeout that says so

before:  Error: Post
           HTTP request failed: Failed to read connection
           Unexpected? Please report it: https://github.com/DataZooDE/erpl-adt/issues

after:   Error: Post
           request timed out after 5s (connecting to http://localhost:50000)
           Hint: Raise it with --timeout <seconds>. Work already started on the server
                 may still be running and may complete — check before repeating it.

The five places that shaped a transport failure by hand now share one MakeTransportError. Only the timeout family gets the new wording; every other transport error is byte-for-byte what it was. PrintError drops the issue-tracker line for ErrorCategory::Timeout — that invitation is for surprises, not for a limit the caller configured and can raise.

--timeout's help now states the default and that it is a per-request read timeout, in all three places that describe it, plus docs/spec2.md, which still said 120.

Verified live

Against a4h, with exactly the class from the issue (WAIT UP TO 170 SECONDS):

$ erpl-adt ... object run ZCL_ERPL_WAIT          # no --timeout
WAITED 170
rc=0 after 170s                                   # previously: failed at 121s

$ erpl-adt ... --timeout 5 object run ZCL_ERPL_WAIT
Error: Post
  request timed out after 5s (connecting to http://localhost:50000)
  Hint: Raise it with --timeout <seconds>. ...
rc=10 after 5s

1355 unit tests pass, 5 of them new: the two defaults agreeing, a real socket timing out through the LocalServer harness, a connection refusal not being dressed up as a timeout, and the issue-hint carve-out in both plain and color mode. Integration smoke suite passes.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…t as one

Closes #42.

AdtSessionOptions defaulted to 120s while AppConfig::timeout_seconds
documented 600, and since both CLI entry points assign read_timeout only
when --timeout is passed, 120s was what every call actually got — the
MCP server included. Anything slower failed at 121s while the ABAP ran
on server-side and completed, so the caller saw a failure for work that
had in fact succeeded and had to go query the result to find out.

There is now one constant, kDefaultReadTimeoutSeconds, behind both.

The failure said "HTTP request failed: Failed to read connection",
which named neither the timeout nor the flag that raises it, and the CLI
then invited a bug report for a limit the caller had simply hit. The
five sites that shaped a transport failure by hand now share
MakeTransportError, which for the timeout family says how long it
waited, hints at --timeout, and warns that the server-side work may
still complete. PrintError drops the issue-tracker line for that
category — nothing unexpected happened.

Verified against a4h with the class from the issue: `object run
ZCL_ERPL_WAIT` (WAIT UP TO 170 SECONDS) now prints WAITED 170 and exits
0 after 170s, where it used to fail at 121s. With --timeout 5 it exits
10 with "request timed out after 5s" and the hint.
Windows caught it: connecting to a closed port there is not refused, it
is dropped until the connect timeout runs out, and the message then said
'request timed out after 600s' and pointed at --timeout — neither of
which is the number that expired nor the flag that would help. A
connection timeout now says so and suggests checking reachability.
…tput

Left over from the silent-success fix: test_20 still asserted exit 0 with
'does not exist' as console output, which is exactly the reading that fix
removed, while test_24 asserts the opposite. The contract stays in
test_24; test_20 now pins that the message still names the cause.
@jrosskopf
jrosskopf merged commit a5cb66f into main Sep 1, 2026
5 checks passed
@jrosskopf
jrosskopf deleted the fix/42-read-timeout branch September 1, 2026 03:05
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.

Default HTTP read timeout is 120s, not the documented 600s — long classruns fail with an opaque error

1 participant