Skip to content

Decode Action Cable broadcasts - #3

Merged
cardmagic merged 2 commits into
mainfrom
agent/fix-action-cable-decoding
Aug 7, 2026
Merged

Decode Action Cable broadcasts#3
cardmagic merged 2 commits into
mainfrom
agent/fix-action-cable-decoding

Conversation

@cardmagic

Copy link
Copy Markdown
Owner

Summary

  • decode Action Cable payloads before Solid Objects parses observable invalidations
  • restore raw Turbo Stream delivery for scalar observables and component refreshes
  • add a regression across the broadcast encoder and custom channel callback boundary
  • prepare version 0.4.2

Root cause

ActionCable.server.broadcast JSON-encodes messages by default. Rails only applies its default JSON decoder when stream_from uses the built-in retransmitter; a custom callback defaults to coder: nil.

SolidObjects::ActorChannel needs a custom callback for observable filtering and component invalidation, so it now follows Rails' documented callback pattern with coder: ActiveSupport::JSON.

Validation

  • encoded-payload regression: 1 test, 4 assertions
  • complete channel suite: 13 tests, 42 assertions
  • bundle exec rake: 211 tests, 823 assertions
  • Standard Ruby and Solid Queue RuboCop passed
  • generated RBS validation and Steep passed
  • Brakeman reported zero warnings
  • packaged gem reports version 0.4.2

No database migration is required.

Use Action Cable's documented JSON decoder for the custom stream callback so observable invalidations receive raw Turbo Stream HTML instead of encoded strings.
Package the Action Cable decoding fix as version 0.4.2 after validating the full suite and built gem.
@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

The PR fixes Action Cable delivery by decoding JSON-encoded broadcasts before observable invalidation processing and bumps the gem to version 0.4.2.

  • Configures ActorChannel streams with ActiveSupport::JSON.
  • Adds an integration regression covering the broadcast encoder and custom callback boundary.
  • Updates the changelog, version constant, and lockfile metadata.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The channel now decodes the JSON representation produced by Action Cable before applying existing invalidation parsing, and the regression covers both scalar updates and component refreshes across that boundary.

Important Files Changed

Filename Overview
lib/solid_objects/actor_channel.rb Adds the JSON coder required to decode Action Cable broadcasts before the custom callback processes them.
test/integration/actor_channel_test.rb Adds a focused regression that captures the stream coder and verifies scalar and component transmissions remain raw Turbo Stream HTML.
lib/solid_objects/version.rb Bumps the gem version from 0.4.1 to 0.4.2.
CHANGELOG.md Documents the Action Cable payload-decoding fix in the 0.4.2 release.
Gemfile.lock Synchronizes the locked local gem version with 0.4.2.

Sequence Diagram

sequenceDiagram
  participant Adapter as Broadcast Adapter
  participant AC as Action Cable
  participant Channel as ActorChannel
  participant Client as Subscriber
  Adapter->>AC: broadcast Turbo Stream HTML
  AC->>AC: JSON-encode payload
  AC->>Channel: deliver encoded payload
  Channel->>Channel: ActiveSupport::JSON.decode
  Channel->>Channel: parse invalidation metadata
  Channel->>Client: transmit raw Turbo Stream HTML
Loading

Reviews (1): Last reviewed commit: "chore: prepare 0.4.2 release" | Re-trigger Greptile

@cardmagic
cardmagic marked this pull request as ready for review August 7, 2026 16:10
@cardmagic
cardmagic merged commit 925e351 into main Aug 7, 2026
11 checks passed
@cardmagic
cardmagic deleted the agent/fix-action-cable-decoding branch August 10, 2026 13:52
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