Skip to content

Fix failing doctests and env suites - #208

Merged
fr3shw3b merged 6 commits into
mainfrom
fix/failing-doctests-and-env-suites
Aug 27, 2026
Merged

fr3shw3b merged 6 commits into
mainfrom
fix/failing-doctests-and-env-suites

Conversation

@fr3shw3b

@fr3shw3b fr3shw3b commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Improvements

    • WebSocket batch delivery now processes separate connections concurrently while preserving message order within each connection.
    • Redis consumers now retry batches when dead-letter delivery fails, preventing messages from being skipped.
    • Failure reporting is more consistent and maintains the original message order.
  • Breaking Changes

    • Removed the optional context field from event results.
  • Documentation

    • Updated SDK, workflow, signing, time, and JSONPath examples to match current usage.

fr3shw3b and others added 6 commits August 27, 2026 11:05
Seven doc examples across three crates did not compile, so nothing had ever
checked them and they had drifted from what they document. A workspace test
run stops at the first crate that fails, which is why only two of them were
ever visible.

The signature examples named values that were never bound and a type that was
never imported. One of them then asserted that a signature header starts with
the key id, when it starts with the key id under a name, so it failed once it
could run at all.

The helpers examples called a method without the trait that provides it in
scope, and referred to the function and type they document without importing
either. The jsonpath one also asserted that injecting a value returned false
while asserting the value had been injected, which contradicts itself and the
sentence above it.

The workflow examples named a crate that does not exist, called asynchronous
methods without awaiting them and used a service nothing had bound. Its
payload had drifted furthest, missing a field and giving three others types
they have never had, since nothing was compiling it as the struct changed
underneath.

Every example is now a compiled one, with the setup a reader does not need
hidden and the assertions saying what the code actually does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ects

The test collected messages until it had counted three hundred iterations,
with nothing bounding how long that took. A queue nothing had created, an
endpoint nothing was listening on, or a consumer that had stopped all
presented the same way, as a run that never returned and never said why.

Counting iterations rather than messages made the other outcome no better. A
closed channel spun through the remaining count and asserted on an empty
collection, saying only that zero is not three hundred.

It now counts what it collected, stops on a deadline or on the channel
closing, and reports how many of the three hundred arrived along with the two
things worth checking first. The deadline is generous, since the sender spaces
its messages out and a loaded machine is not a failure.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every event result set a context to none and nothing ever read one, so the
field was a line on each of the eight places that built a result and an
optional value in the shape every SDK binding compiles against.

Removed rather than filled in, since what it was for is not recorded anywhere
and the two call modes both answer callers without it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…corded

The offset moved before the result was examined and before any failure
reached the dead letter queue. A process that stopped in between left the
batch behind the offset with nothing anywhere recording it, and since this
consumer reads by offset rather than through a consumer group, behind the
offset is gone.

It now moves last. Straight away where every message was processed, after the
failures are written where a failure was reported, and not at all where that
write did not succeed, so the batch is read again rather than passed over.

Reading it again redelivers what did succeed, which is the cost of one
watermark covering a whole batch and cheaper than losing the rest.

There is no test for this. What it guards against is a process stopping
between two calls to Redis, which the suite has no way to stage without
injecting a fault into the connection, so the existing tests show the paths
either side are intact and nothing more.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Naming a package built a command cargo refuses, since the exclude it carries
alongside is only allowed with a workspace selection. Getting past that, the
features are the workspace's own and a single package does not have them, so
the flag has never run anything.

A named package now narrows which tests run rather than which packages are
built, which resolves exactly the features a full run does and leaves the two
passes comparable. The cluster pass is skipped where the named package has no
Redis-backed tests, rather than running the same seven suites whatever was
asked for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The runtime took a batch and sent it in one line, awaiting each message before
starting the next. For a message asking its client to acknowledge it, that
answer is a round trip to the client rather than a write to a socket, so every
message behind it waited out the one before, and a client that never answered
held up all of them until the runtime gave up on its message.

That made a batch worth no more than the sends it replaced, which is most of
the reason for carrying several messages in one frame.

Messages are now grouped by the connection they are for and the groups are
sent alongside each other, so one client being slow to answer costs only the
messages meant for it. Within a connection they are still sent in the order
the handler listed them, which is the one ordering a handler can reasonably
expect and costs nothing to keep.

Failures are put back into the order the handler gave before they are
reported. The connections are served in no order at all, and the position a
message had in the batch is the only thing the handler has to match a failure
against, since the runtime generates the id where one was not supplied.

The registry the tests stand up can hold a connection open, so one test shows
a later message reaching a different client while the first is still waiting
and another shows two messages for one client keeping their order.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fr3shw3b
fr3shw3b merged commit e29dde4 into main Aug 27, 2026
11 of 12 checks passed
@fr3shw3b
fr3shw3b deleted the fix/failing-doctests-and-env-suites branch August 27, 2026 12:51
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 61e71839-47b2-40d4-86b0-1bbb90d8d95a

📥 Commits

Reviewing files that changed from the base of the PR and between bffa315 and eb994b8.

📒 Files selected for processing (14)
  • libs/runtime/consumers/consumer-redis/src/message_consumer.rs
  • libs/runtime/consumers/consumer-sqs/tests/integration_test.rs
  • libs/runtime/core/src/consumer_handler.rs
  • libs/runtime/core/src/ipc_frames.rs
  • libs/runtime/core/src/ipc_stream.rs
  • libs/runtime/core/src/types.rs
  • libs/runtime/core/tests/integration_consumer_test.rs
  • libs/runtime/helpers/src/jsonpath.rs
  • libs/runtime/helpers/src/time.rs
  • libs/runtime/scripts/package-test-tools.py
  • libs/runtime/sdk/node/src/consumer.rs
  • libs/runtime/sdk/python/src/consumer.rs
  • libs/runtime/signature/src/sigv1.rs
  • libs/runtime/workflow/src/workflow_executions.rs

📝 Walkthrough

Walkthrough

The changes update Redis failure acknowledgement, WebSocket batch delivery, the EventResult shape, package test execution, SQS integration collection, and several API documentation examples.

Changes

Message delivery behavior

Layer / File(s) Summary
Redis failure acknowledgement
libs/runtime/consumers/consumer-redis/src/message_consumer.rs
Failed messages move to the DLQ before the Redis offset advances. A failed DLQ write leaves the offset unchanged.
Per-connection WebSocket delivery
libs/runtime/core/src/ipc_stream.rs
Messages for different WebSocket connections are processed concurrently. Messages for each connection remain ordered. Failures return in original batch order. Tests add connection blocking and verify concurrency and ordering.

EventResult contract cleanup

Layer / File(s) Summary
EventResult shape and construction
libs/runtime/core/src/types.rs, libs/runtime/core/src/ipc_frames.rs, libs/runtime/core/src/consumer_handler.rs, libs/runtime/core/tests/integration_consumer_test.rs, libs/runtime/sdk/node/src/consumer.rs, libs/runtime/sdk/python/src/consumer.rs
The optional context field was removed from EventResult and from its handler, frame, and SDK construction paths.

Test execution updates

Layer / File(s) Summary
Package-scoped test execution
libs/runtime/scripts/package-test-tools.py
Named packages use nextest filter expressions. Redis cluster tests are skipped for packages without Redis-backed tests.
SQS integration message collection
libs/runtime/consumers/consumer-sqs/tests/integration_test.rs
The test collects messages until all expected messages arrive, the receiver closes, or the 60-second deadline expires.

Documentation examples

Layer / File(s) Summary
API documentation examples
libs/runtime/helpers/src/jsonpath.rs, libs/runtime/helpers/src/time.rs, libs/runtime/signature/src/sigv1.rs, libs/runtime/workflow/src/workflow_executions.rs
Examples now use current imports, assertions, signature setup, asynchronous workflow calls, payload fields, and status values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Batch as WebSocket batch delivery
  participant Registry as WebSocket registry
  participant ConnectionA as Connection A
  participant ConnectionB as Connection B
  Batch->>Registry: Group messages by connection
  Batch->>ConnectionA: Send messages in order
  Batch->>ConnectionB: Send messages concurrently
  ConnectionA-->>Batch: Return send result
  ConnectionB-->>Batch: Return send result
  Batch-->>Registry: Restore failures by batch index
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/failing-doctests-and-env-suites

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

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant