Skip to content

test: exit and init failure paths, graceful shutdown options, status message faults, events reconnect - #37

Merged
metalwarrior665 merged 1 commit into
masterfrom
test/exit-and-shutdown
Nov 14, 2026
Merged

metalwarrior665 merged 1 commit into
masterfrom
test/exit-and-shutdown

Conversation

@metalwarrior665

Copy link
Copy Markdown
Member

Tests only, covering two gaps from the test-gap review (g08 and g10). The only non-test change is a fault mode in FakeApi's run updates.

Exit and init failure paths (tests/actor.rs)

  • An init failure exits with 92 before the user function runs. Two cases: an unreachable events websocket, and malformed __ACTOR_CHILD_RUNS.
  • An Exit listener that never ends is given up on after ExitOptions::timeout, and with exit: false, exit then returns.
    • With exit: true, the watchdog thread always ends the process first, because both deadlines are the same timeout. Same exit code either way, so I tested the teardown's own deadline through exit: false.
  • A runtime blocked by a listener still exits on time: the watchdog runs on a thread of its own.
  • exit: false tears the Actor down and returns, and a later exit ends the run.

Graceful shutdown, status messages, events reconnect

  • graceful_shutdown: false: an aborted run goes on and its user function finishes.
  • graceful_shutdown_delay: the exit comes after the delay, counted from the abort.
  • A status message update that is slow (over 1 s) or refused is logged and skipped, and the run goes on. FakeApi gets fault_run_updates(&[Slow, Refused]) for this.
  • events.rs:
    • the backoff sequence (a random delay under 5 s, then 3.1 s growing ×1.618 up to 90 s);
    • a reopen that fails at first is retried until the platform is back.

All the new tests were mutation-checked against the code they cover. Each of these makes them fail:

  • ignoring graceful_shutdown or its delay;
  • dropping the watchdog thread or the teardown deadline;
  • a longer status message timeout;
  • giving up on the first failed reopen.

Generated by Claude Code

…message faults, events reconnect

- Init failures exit with 92 before the user function: an unreachable
  events websocket, malformed tracked child runs.
- Exit: a listener that never ends is given up on after the timeout
  (exit: false returns then); a runtime blocked by a listener still
  exits on time, from the watchdog thread; exit: false returns and a
  later exit ends the run.
- graceful_shutdown: false lets an aborted run go on; the shutdown
  delay puts the exit off after the abort.
- A slow (beyond 1 s) or refused status message update is logged and
  skipped. FakeApi can now fault run updates.
- The reconnection backoff sequence, and a reopen retried until the
  platform is back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0148RYR4BTGyCYHENSRZjC3S
@metalwarrior665
metalwarrior665 merged commit 6777496 into master Nov 14, 2026
6 checks passed
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.

2 participants