Skip to content

Tests: the ticket reply test's server reads the whole request, so the test passes on a busy machine - #20082

Merged
bherbruck merged 2 commits into
tangency-labs:mainfrom
ancientastronauttheorist:fix-20077
Nov 20, 2026
Merged

bherbruck merged 2 commits into
tangency-labs:mainfrom
ancientastronauttheorist:fix-20077

Conversation

@ancientastronauttheorist

@ancientastronauttheorist ancientastronauttheorist commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Change

Fixes #20077. tickets_http_tests::a_ticket_reply_without_a_length_ends_without_waiting_for_the_timeout failed now and then on a busy machine. The fault was in the test's own server, so only the test changes.

The cause. The test's server stopped reading at the end of the request's headers, wrote its reply and closed. The request also has a two-byte body. When that body arrived after the server's read, the connection was closed with data unread, which resets it, and the client got an error instead of the reply: io: Invalid argument (os error 22) on macOS.

The fix. The server now reads the body the request's Content-Length announces before it replies. tickets_call is not touched.

What I measured on an Apple M6, running the one test in its test binary:

Server How Failed
as on main 500 runs, one at a time 0
as on main 3000 runs, 24 at once, twice 42 and 151
made to leave the body unread (one byte at a time, 20 ms before the reply) 40 runs, one at a time 39, all with os error 22
reads the whole request (this PR) 500 runs, one at a time 0
reads the whole request (this PR) 3000 runs, 24 at once, twice 0 and 0

A correction to the issue. I wrote there that the same race might hit real problem reports. With the cause known that is unlikely: it needs a server that closes with part of the request unread.

PR #19457 notes this test failing under load on Windows with os error 10053. I expect the same cause there but have not run it on Windows.

Changes a default: no

Validation

On macOS (Apple M6), on main 6162640:

Screenshots of the behavior (when observable)

None: a test's own server changes, nothing a user can see.

Integration status

Based on main 6162640; one commit, 10 lines added and 1 removed inside this one test. Main has moved by two commits since, and the branch still merges without conflicts.

PR #16458 and PR #19594 also edit apps/solidcraft/src/main.rs, in other places (neither touches this test).

Summary by CodeRabbit

  • Tests
    • Ticket HTTP test requests with a declared body length are now read completely before the server responds, improving handling of requests that include a body.

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ticket HTTP test server now reads through the request headers and any body declared by Content-Length before sending its reply.

Changes: Ticket HTTP test server

Layer / File(s) Summary
Read the complete ticket request
apps/solidcraft/src/main.rs
The test server detects the header terminator, parses Content-Length case-insensitively, and continues reading until the declared body arrives before replying.

Estimated code review effort: 2 (Simple) | ~8 minutes

Severity of issue fixed: Low

Merge Risk: Minimal · up to 1c379

This change makes a flaky ticket-reply test more reliable by having the test server read the full request before replying. It does not affect production behavior, and merge risk is minimal.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the test whose server now reads the whole request, which is the main change. It is specific but long (99 characters) and uses a 'Tests:' prefix. It describes the actual change in the c…
Description check Passed The description follows the template well. It explains the change, the cause, and the fix, and includes the required 'Changes a default: no' line. It gives detailed validation with measured results. T…
Linked Issues check Passed Directly linked issue #20077 asks for a fix to the intermittent failure of tickets_http_tests::a_ticket_reply_without_a_length_ends_without_waiting_for_the_timeout. The whole-PR AI summary for `apps…
Out of Scope Changes check Passed The PR changes only one test server in apps/solidcraft/src/main.rs, inside the test named in #20077. The summary states that tickets_call is not touched and that no other declarations change. Ever…
Existing Defaults Unchanged Passed The check fails only if the PR changes a UX default: a default setting or preference, the usual behaviour of a command or tool, the default UI layout or behaviour, or shortcuts. The PR changes one fil…
Full details: Title check

Explanation

The title names the test whose server now reads the whole request, which is the main change. It is specific but long (99 characters) and uses a 'Tests:' prefix. It describes the actual change in the changeset: the test server reads the request body before replying.

Full details: Description check

Explanation

The description follows the template well. It explains the change, the cause, and the fix, and includes the required 'Changes a default: no' line. It gives detailed validation with measured results. The Screenshots section states why none apply. It also covers integration status with the base commit and the merge state. The description does not include a 'Test change:' line. That line is required only for kernel changes under solidcore/ or crates/smlib/, and this PR touches apps/solidcraft/ only, so the omission is acceptable. The description does not say that the change is for a non-kernel test; this is a minor gap. The 'Change' section begins with a fix reference and does not plainly explain what the app is for, but the change only affects a test server, so the framing is reasonable.

Full details: Linked Issues check

Explanation

Directly linked issue #20077 asks for a fix to the intermittent failure of tickets_http_tests::a_ticket_reply_without_a_length_ends_without_waiting_for_the_timeout. The whole-PR AI summary for apps/solidcraft/src/main.rs (+10/-1, one test) states that the test server now reads the request headers and the body bytes announced by Content-Length before it sends its reply. That addresses the cause the issue describes: the server closed with request bytes unread, which reset the connection. The author reports 0 failures in 3000 concurrent runs after the change, against 42 and 151 failures before. The issue's possible real-world tickets_call concern is unconfirmed and is not a coding requirement of this PR. Limit: the file diff could not be read (changed blobs missing from the checkout), so the code evidence rests on the summary and the author's measurements, not on a direct read of the changed lines.

Full details: Out of Scope Changes check

Explanation

The PR changes only one test server in apps/solidcraft/src/main.rs, inside the test named in #20077. The summary states that tickets_call is not touched and that no other declarations change. Every changed line therefore falls within the scope of issue #20077. Limit: the file diff could not be read, so this rests on the summary and the PR description rather than a direct line-by-line check.

Full details: Existing Defaults Unchanged

Explanation

The check fails only if the PR changes a UX default: a default setting or preference, the usual behaviour of a command or tool, the default UI layout or behaviour, or shortcuts. The PR changes one file, apps/solidcraft/src/main.rs, with +10/-1 lines. The diff is confined to the test server inside tickets_http_tests::a_ticket_reply_without_a_length_ends_without_waiting_for_the_timeout. The server now reads the request body announced by Content-Length before it replies. No setting, preference, command, shortcut, layout, or runtime behaviour changes. tickets_call is not touched. The PR description says Changes a default: no, and the code agrees. The fail-on-mismatch rule does not apply.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6162640 and 1c37928.

Files selected for processing: 1

  • apps/solidcraft/src/main.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

a_ticket_reply_without_a_length_ends_without_waiting_for_the_timeout failed
now and then on a busy machine. Its server stopped reading at the end of the
request's headers and closed right after its reply. When the request's body
arrived after that read, the connection was closed with data unread, which
resets it, and the client got an error instead of the reply (os error 22 on
macOS).

The server now reads the body the request's Content-Length announces before
it replies. tickets_call is not touched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gr84VuQWHKtTwJ7cC3CP3W
@ancientastronauttheorist

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Reviewed: run the full PR CI (build, tests, goldens, Clippy) ready to merge reviewed, every ask addressed; merge once CI is green

Projects

None yet

2 participants