Skip to content

fix: catch ValidationError, add stream_add backoff, remove duplicate check - #90

Merged
k-rister merged 3 commits into
masterfrom
fix-validation-and-stream-retry
Jun 29, 2026
Merged

fix: catch ValidationError, add stream_add backoff, remove duplicate check#90
k-rister merged 3 commits into
masterfrom
fix-validation-and-stream-retry

Conversation

@k-rister

Copy link
Copy Markdown
Contributor

Summary

Three fixes, one per commit:

  • SchemaError → ValidationError: message_validate() and user message validation caught SchemaError (malformed schema) instead of ValidationError (data fails validation). Actual validation failures propagated as unhandled exceptions.

  • stream_add backoff on connection errors: On ConnectionError/TimeoutError, ret_val stayed at 0 so the is None backoff check didn't fire. The while loop retried immediately with no delay. Fix: set ret_val = None in exception handlers so existing backoff logic applies.

  • Duplicate recipient check: message_for_me() checked not "recipient" in message["payload"] twice in the elif chain (lines 568 and 574). The second was unreachable.

Note: The message_build_custom call on line 1965 with sender_id="personal-stream-created" is intentional — it prevents the self-sender filter in message_for_me() from dropping the personal stream creation message.

Closes #89

Test plan

  • Run test/run-test.sh — exercises barrier sync, timeout, abort, and wait-for scenarios
  • Verify invalid user message JSON produces a logged validation error instead of an unhandled exception

🤖 Generated with Claude Code

k-rister and others added 3 commits June 27, 2026 10:22
SchemaError is raised when the schema itself is malformed, not
when data fails validation against it. The correct exception for
failed validation is ValidationError. With SchemaError, actual
validation failures propagated as unhandled exceptions.

Affected two locations: message_validate() (line 552) and the
user messages validation in run() (line 1838).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On ConnectionError or TimeoutError, ret_val stayed at its initial
value of 0. The backoff check (ret_val is None) didn't match, so
the success log fired incorrectly and the while loop retried
immediately with no delay — a tight busy-loop on persistent
connection failures.

Set ret_val = None in both exception handlers so the existing
backoff logic kicks in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Line 574 checked `not "recipient" in message["payload"]`
identically to line 568. The check was already true by that
point in the elif chain, so this branch was unreachable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@k-rister k-rister self-assigned this Jun 27, 2026
@k-rister
k-rister requested a review from a team June 27, 2026 15:28
@project-crucible-tracking project-crucible-tracking Bot moved this to In Progress in Crucible Tracking Jun 27, 2026
@k-rister
k-rister merged commit 6f96df4 into master Jun 29, 2026
226 checks passed
@k-rister
k-rister deleted the fix-validation-and-stream-retry branch June 29, 2026 18:54
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Crucible Tracking Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix: catches SchemaError instead of ValidationError — validation failures unhandled

2 participants