Skip to content

Conversation

@balegas
Copy link

@balegas balegas commented Jan 6, 2026

Summary

Updates Phoenix.Sync to work with Electric 1.2.x and electric_client 0.8.0.

Changes

  • Breaking: Updated electric dependency to ~> 1.2.4 (dropping support for Electric 1.1.x)
  • Breaking: Updated electric_client dependency to ~> 0.8.0
  • Removed http_api_num_acceptors workaround (fixed upstream in Electric via #2863)
  • Updated Electric.StatusMonitor.mark_connection_pool_ready/2 calls to /3 (Electric 1.2.x API change)
  • Updated storage configuration to use keyword list format (Electric 1.2.x requirement)
  • Implemented Inspector.load_supported_features/1 callback (new in Electric 1.2.x)
  • Implemented PublicationManager.wait_for_restore/1 callback (new in Electric 1.2.x)
  • Updated storage configuration tests to handle both keyword list and map formats

Known Issues

  • Sandbox mode (mode: :sandbox) is not yet compatible with Electric 1.2.x due to internal architecture changes (Electric.Replication.Supervisor was removed). Sandbox mode will be updated in a future release.

Migration Guide

If upgrading from Phoenix.Sync 0.6.1 or earlier:

  1. Electric 1.2.x Required: This version requires Electric 1.2.4 or later. Electric 1.1.x is no longer supported.

  2. Deprecated Configuration Options:

    • experimental_live_sse has been replaced by live_sse in Electric 1.2.x
    • The ELECTRIC_EXPERIMENTAL_MAX_SHAPES environment variable has been retired; use the max_shapes configuration option instead
  3. New Configuration Options (Electric 1.2.x):

    • live_sse: Enable server-sent events for real-time updates
    • replication_idle_timeout: Automatically close database connections during idle replication streams

Test plan

  • Application tests pass (22/22)
  • Sandbox tests - skipped (requires Electric 1.2.x architecture update)
  • Integration tests with real Electric 1.2.x server

🤖 Generated with Claude Code

claude and others added 6 commits January 6, 2026 11:52
- Update `electric` dependency to `~> 1.2.4` (dropping support for 1.1.x)
- Update `electric_client` dependency to `~> 0.8.0`
- Remove `http_api_num_acceptors` workaround (fixed in Electric #2863)
- Update storage configuration tests to handle both keyword list and map formats
- Add tests for Electric 1.2.x configuration options (live_sse, max_shapes, replication_idle_timeout)
- Update README examples to reference Electric 1.2.x
- Add migration guide in CHANGELOG for users upgrading from 0.6.1

Breaking changes:
- Electric 1.1.x is no longer supported
- Users should use `live_sse` instead of `experimental_live_sse`
- `ELECTRIC_EXPERIMENTAL_MAX_SHAPES` env var is retired, use `max_shapes` config option
- Update StatusMonitor.mark_connection_pool_ready/2 to /3 (new pool type arg)
- Remove ShapeStatus.opts/1 calls (function removed in Electric 1.2.x)
- Fix storage format to use keyword lists instead of maps
- Implement Inspector.load_supported_features/1 callback
- Implement PublicationManager.wait_for_restore/1 callback
- Update test helpers for Electric 1.2.x storage format
- Change default Postgres port from 55555 to 54321
- Update application tests for Electric 1.2.x compatibility

Note: Sandbox mode is not yet compatible with Electric 1.2.x due to
Electric.Replication.Supervisor being removed. This will be addressed
in a future release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Format application_test.exs to pass mix format --check-formatted
- Update example apps to use electric ~> 1.2 (matching phoenix_sync)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@balegas balegas marked this pull request as draft January 6, 2026 15:00
balegas and others added 5 commits January 6, 2026 15:00
Sandbox mode is not compatible with Electric 1.2.x due to
Electric.Replication.Supervisor being removed. Switch example
apps to use embedded mode for testing until sandbox is updated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update dev.exs and test.exs configs across all apps to use
port 54321 instead of 55555 for PostgreSQL connections.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comprehensive plan for verifying and updating the Phoenix.Sync.Sandbox
to work with Electric 1.2.x, including:

- List of all Electric internal APIs used by Sandbox
- Risk assessment for each API
- Implementation phases
- Testing strategy
- Success criteria
- Deprecate sandbox mode (incompatible with Electric 1.2.x architecture)
- Deprecate LiveView streams (sync_stream/4, sync_stream_update/3)
- Update sandbox internals to use Electric.Shapes.Supervisor
- Add custom Storage module for sandbox that skips DB snapshots
- Add stub modules for ShapeCleaner and ExpiryManager
- Implement Inspector.load_supported_features/1 callback
- Implement PublicationManager.wait_for_restore/1 callback
- Update StatusMonitor calls for Electric 1.2.x API

Test infrastructure changes:
- Change test mode from :sandbox to :embedded
- Exclude :sandbox and :igniter tests by default
- Add extract_data_messages/2 helper for response format changes
- Remove HTTP mode from parameterized tests (requires running server)
- Update CI to use port 54321 and include igniter tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove Phoenix.Sync.Sandbox.Postgres adapter from example apps
- Use Ecto.Adapters.Postgres directly (sandbox mode is deprecated)
- Remove Phoenix.Sync.Sandbox.start! from data_case.ex
- Add .claude/ to .gitignore
- Remove internal implementation plan doc

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

3 participants