Skip to content

Fix subscribe:true flag for PUT operations #1767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sanity
Copy link
Collaborator

@sanity sanity commented Aug 14, 2025

Summary

  • Fixed subscription logic in PUT operations to properly subscribe the initiating peer
  • Added comprehensive unit test to verify UPDATE operations work after PUT with subscribe:true
  • Resolves River chat UPDATE failures that occurred after creating rooms

Problem

The subscribe: true flag on PUT operations was not properly subscribing the initiating peer to the contract. This caused UPDATE operations to fail with "missing contract" errors, particularly affecting River chat functionality.

Solution

  1. Fixed subscription logic: Removed the is_seeding_contract check that was preventing subscription
  2. Added contract verification: Verify the contract is queryable locally before subscribing
  3. Proper subscription request: Use try_get=true to handle cases where contract isn't fully available
  4. Local subscriber registration: Ensure the peer is registered as a local subscriber

Testing

  • Added comprehensive unit test test_put_subscribe_enables_update that verifies:
    • PUT with subscribe:true properly subscribes the initiating peer
    • Subsequent UPDATE operations succeed without requiring separate SUBSCRIBE
  • Manually tested with River chat:
    • Created room successfully
    • Sent messages (UPDATE operations) successfully
    • Messages persist and can be retrieved

Test Results

✓ Room creation successful
✓ Message sending (UPDATE) successful  
✓ Messages retrieved correctly

Fixes #1765

🤖 Generated with Claude Code

The subscribe:true flag on PUT operations was not properly subscribing
the initiating peer to the contract, causing UPDATE operations to fail
with "missing contract" errors.

Changes:
- Fixed subscription logic in PUT operation handler to properly subscribe initiator
- Added contract verification before subscription request
- Implemented proper local subscriber registration
- Added comprehensive unit test test_put_subscribe_enables_update

This fixes the River chat UPDATE failures that occurred after creating rooms.

Fixes #1765

🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>
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.

subscribe: true flag in PUT operations doesn't work correctly for initiating peers
1 participant