Skip to content

Changes for Elixir 1.19#45

Merged
NickNeck merged 6 commits intomainfrom
elixir-1-19
Oct 9, 2025
Merged

Changes for Elixir 1.19#45
NickNeck merged 6 commits intomainfrom
elixir-1-19

Conversation

@NickNeck
Copy link
Copy Markdown
Member

@NickNeck NickNeck commented Oct 8, 2025

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 8, 2025

Walkthrough

  • .github/workflows/ci.yml: Updated runner version and OS, simplified Elixir/OTP matrix (centered on Elixir 1.18.4 with selected OTPs), added a setup-beam step and included its version in deps/_build cache keys, added conditional PLT caching gated by matrix.lint, and moved several job conditionals to matrix.lint/matrix.coverage flags.
  • lib/rewrite.ex: Enumerable.slice/1 changed to return {:ok, size, to_list} where size = map_size(rewrite.sources) and to_list is a zero-arg function returning sources sorted by path.
  • lib/rewrite/dot_formatter.ex: Handle Code.format_string! returning ""; stricter %DotFormatter{} match and update subs via map update.
  • lib/rewrite/source.ex: Source.t() extended with timestamp, from, owner, private; hash type -> non_neg_integer(); many internal helpers tightened to %Source{} patterns and filetype update clauses refined; minor doc/spec typos.
  • mix.exs: Elixir requirement bumped to "~> 1.14"; removed private preferred_cli_env/0 and project entry; added public cli/0 and test_ignore_filters.
  • CHANGELOG.md: Dev version bumped to 1.2.0 and notes updated.
  • test/rewrite_test.exs: Added a test asserting Enum.to_list/1 returns ordered sources.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Changes for release 1.0.0 #38 — Large refactor touching DotFormatter, Rewrite struct, and Source types that overlaps with the changes to lib/rewrite.ex, lib/rewrite/dot_formatter.ex, and lib/rewrite/source.ex.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning There is no pull request description provided, so there is no contextual information summarizing the changeset or its intent. Please add a description that briefly outlines the key changes—such as CI workflow updates, new fields in Source.t, mix.exs version bump, and test additions—to help reviewers understand the scope and purpose of this PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The current title “Changes for Elixir 1.19” is related to only one aspect of the update and is too generic to convey the full scope of CI updates, code refactors, and type enhancements included in this PR. It does not clearly summarize the primary developer intent in a concise, descriptive way. Please revise the title to more specifically reflect the main changeset, for example “Support Elixir 1.19: bump required version, update CI for Ubuntu 24.04, and refine source types.”
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch elixir-1-19

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7652eb and c55294f.

📒 Files selected for processing (3)
  • CHANGELOG.md (2 hunks)
  • lib/rewrite/source.ex (9 hunks)
  • lib/rewrite/source/ex.ex (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • lib/rewrite/source/ex.ex
🧰 Additional context used
🧬 Code graph analysis (1)
lib/rewrite/source.ex (3)
lib/rewrite.ex (1)
  • format (858-861)
lib/rewrite/source/ex.ex (3)
  • handle_update (144-146)
  • handle_update (149-161)
  • format (283-293)
lib/rewrite/dot_formatter.ex (2)
  • get (406-412)
  • format_string (671-677)
🔇 Additional comments (7)
CHANGELOG.md (2)

3-7: LGTM!

The version bump to 1.2.0-dev and the changelog entries accurately reflect the scope of changes in this PR for Elixir 1.19 compatibility.


59-59: Good catch on the typo fix.

Correcting Rewrite.fromat!/2 to Rewrite.format!/2 aligns with the actual function name.

lib/rewrite/source.ex (5)

79-100: LGTM!

The enhanced documentation for hash, path, and timestamp fields provides clear explanations of their purpose and behavior, improving the module's usability.


104-104: LGTM!

The type correction from String.t() to non_neg_integer() accurately reflects the implementation at line 826, which uses :erlang.phash2/1.


160-162: LGTM!

The previously flagged typo has been corrected. The documentation now correctly spells "formatter" throughout.


529-543: LGTM!

The explicit %Source{} pattern matching in do_update/3 and update_filetype/3 adds defensive validation and improves code clarity. Good practice for internal helpers.


893-944: LGTM!

The format function documentation has been improved, and the previously flagged typo in the dot_formatter variable name at line 938 has been corrected. The implementation correctly uses DotFormatter.format_string/4 and propagates errors appropriately.


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 and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 8, 2025

Pull Request Test Coverage Report for Build eb4132a758e2346393d76df22c2fbf02525e38a0

Details

  • 9 of 10 (90.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 95.658%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/rewrite/dot_formatter.ex 1 2 50.0%
Totals Coverage Status
Change from base Build b263f613b32df2883bcfb3bcb743033c042da54f: -0.1%
Covered Lines: 749
Relevant Lines: 783

💛 - Coveralls

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/rewrite/source.ex (1)

935-943: Fix the typo in the Source.format/2 spec

The spec now advertises {:errror, term()}, which doesn’t match the actual {:error, term()} return and will mislead Dialyzer/users. Please correct the atom.

-  @spec format(t(), opts()) :: {:ok, t()} | {:errror, term()}
+  @spec format(t(), opts()) :: {:ok, t()} | {:error, term()}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b263f61 and 59da2df.

⛔ Files ignored due to path filters (1)
  • mix.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • .github/workflows/ci.yml (3 hunks)
  • lib/rewrite.ex (14 hunks)
  • lib/rewrite/dot_formatter.ex (3 hunks)
  • lib/rewrite/source.ex (8 hunks)
  • mix.exs (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/rewrite/source.ex (2)
lib/rewrite.ex (1)
  • do_update (596-613)
lib/rewrite/source/ex.ex (2)
  • handle_update (144-146)
  • handle_update (149-161)

Comment thread lib/rewrite.ex
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
.github/workflows/ci.yml (3)

92-93: Make coverage env explicit.

Avoid coupling to mix cli/0; run coverage in test env explicitly.

-        run: mix coveralls.github
+        run: MIX_ENV=test mix coveralls.github

14-33: Add Elixir 1.19 to the matrix when available.

This PR targets 1.19 readiness; include 1.19.x (or RC) once setup-beam supports it. Optionally set continue-on-error: true until GA.


1-1: Optional: add workflow concurrency and disable matrix fail-fast.

Prevents duplicate runs on rapid pushes and ensures all matrix jobs run.

 name: CI
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
 jobs:
   linux:
     name: Test on Ubuntu (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
     runs-on: ubuntu-24.04
     strategy:
+      fail-fast: false
       matrix:
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59da2df and eb4132a.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml (3 hunks)
  • CHANGELOG.md (1 hunks)
  • mix.exs (2 hunks)
🔇 Additional comments (2)
CHANGELOG.md (1)

3-7: Changelog entry looks good; remember to sync the tag/version on release.

Dev header and notes align with the code changes. When tagging 1.2.0, bump @Version and source_ref accordingly.

mix.exs (1)

16-16: Min Elixir bump aligns with PR goal.

Matches the CHANGELOG note. CI matrix includes 1.14.5, so coverage looks consistent.

Comment thread mix.exs
Comment thread mix.exs
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
test/rewrite_test.exs (1)

1114-1121: Consider testing path ordering more explicitly.

The test creates sources in alphabetical path order (a.exs, b.exs, c.exs), which means it doesn't fully validate that Enum.to_list/1 returns sources ordered by path. If the implementation returned sources in insertion order instead, this test would still pass.

For comparison, the "sources/1" test at lines 872-884 creates sources out of order (c, a, b) and verifies they're returned in path order (a.exs, b.exs, c.exs), which better validates the ordering behavior.

Apply this diff to create sources out of order and strengthen the test:

     test "to_list/1" do
       a = Source.from_string(":a", path: "a.exs")
       b = Source.from_string(":b", path: "b.exs")
       c = Source.from_string(":c", path: "c.exs")
-      {:ok, project} = Rewrite.from_sources([a, b, c])
+      {:ok, project} = Rewrite.from_sources([c, a, b])
 
       assert Enum.to_list(project) == [a, b, c]
     end
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb4132a and 11ba5ae.

📒 Files selected for processing (1)
  • test/rewrite_test.exs (1 hunks)

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 11ba5ae and c7652eb.

📒 Files selected for processing (1)
  • lib/rewrite/source.ex (9 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
lib/rewrite/source.ex (2)
lib/rewrite.ex (2)
  • do_update (596-613)
  • format (858-861)
lib/rewrite/source/ex.ex (3)
  • handle_update (144-146)
  • handle_update (149-161)
  • format (283-293)
🔇 Additional comments (3)
lib/rewrite/source.ex (3)

104-104: LGTM!

The hash type change to non_neg_integer() correctly reflects the implementation using :erlang.phash2/1 (line 826).


21-32: LGTM!

The struct expansion with timestamp, from, owner, and private fields is well-designed and properly documented. The type spec correctly reflects all new fields.

Also applies to: 101-112


529-543: LGTM!

Tightening the pattern matching to explicit %Source{} structs in the helper functions improves type safety and prevents accidentally passing incorrect data structures to these internal functions.

Comment thread lib/rewrite/source.ex Outdated
Comment thread lib/rewrite/source.ex Outdated
@NickNeck NickNeck merged commit 94d9112 into main Oct 9, 2025
16 checks passed
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