Skip to content

Fix redundant sync/4 fallback on Elixir 1.20 - #7

Merged
michaelst merged 1 commit into
mainfrom
fix-redundant-sync-fallback
Oct 25, 2026
Merged

michaelst merged 1 commit into
mainfrom
fix-redundant-sync-fallback

Conversation

@michaelst

@michaelst michaelst commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

use LiveSync defined catch-all sync/3/sync/4 in __using__ and again via @before_compile. A LiveView defining only sync/3 kept the __using__ sync/4 and got a second from @before_compile; Elixir 1.20 warns "the following clause is redundant", failing --warnings-as-errors in consumers (12 LiveViews in Devhub).

  • Drop the __using__ defaults and defoverridable; @before_compile fallbacks cover every case (no super callers)
  • opts/1, subscription_key/1: impl_for! instead of calling on a possibly-nil impl (1.20 warning)
  • Bump to 0.1.13; .tool-versions → Elixir 1.20.4 / OTP 29.1.2

Tested: clean compile --warnings-as-errors + 11 tests on 1.20 and 1.19; Devhub app compiles warning-free and passes 5721 tests against this.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Missing watch implementations now raise an error instead of returning no result.
  • Chores
    • Updated the project’s Elixir and Erlang versions.
    • Updated the project version to 0.1.13.

__using__ and @before_compile both defined catch-all sync/4, so a
LiveView with only sync/3 got two; 1.20 flags the second as redundant.
Keep only the @before_compile fallbacks. impl_for! in opts/1 and
subscription_key/1. Bump to 0.1.13, Elixir 1.20.4 / OTP 29.1.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

LiveSync now delegates sync fallback generation to its before-compile callback and uses bang implementation lookup in opts/1 and subscription_key/1. The configured Elixir and Erlang versions and the project version also change.

Changes: LiveSync changes

Layer / File(s) Summary
Sync fallbacks and implementation lookup
lib/live_sync.ex
LiveSync.__using__/1 leaves fallback generation to the before-compile callback. opts/1 and subscription_key/1 use impl_for!/1.
Runtime and project versions
.tool-versions, mix.exs
The configured Elixir version changes to 1.20.4-otp-29, Erlang changes to 29.1.2, and the project version changes to 0.1.13.

Priority: Not assessed

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: brsntus

Merge Risk: Minimal · up to 2aa97

The PR appears ready to merge; no actionable correctness or compatibility risk was found in the reviewed changes.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@michaelst
michaelst merged commit 72e4b18 into main Oct 25, 2026
5 of 6 checks passed
@michaelst
michaelst deleted the fix-redundant-sync-fallback branch October 25, 2026 04:03
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