refactor: convert org.apache.pekko.X imports to pekko.X style#3348
Merged
Conversation
pjfanning
reviewed
Jul 14, 2026
He-Pin
force-pushed
the
refactor/pekko-style-imports
branch
from
July 15, 2026 03:38
fc019a2 to
3b0664a
Compare
He-Pin
added a commit
that referenced
this pull request
Jul 15, 2026
…d at file scope Motivation: The previous refactor commit (3b0664a) failed CI on four jobs: - Check headers (2 files had a leading blank line before the license header) - Code is formatted (docs module, same root cause) - Check / Code Style (scalafmt on docs module) - Check / Tests (next) - Scala 3 compile failed in actor-typed-tests and remote-tests because `import pekko.*` references at file scope were not preceded by the bare `import org.apache.pekko` that brings the short package name into scope. The script had added the bare import only inside nested object/class blocks, which is invisible at file scope under Scala 3's stricter import resolution. Modification: - Strip the leading blank line in docs/src/test/scala/docs/persistence/ PersistenceMultiDocSpec.scala and project/Paradox.scala so the license header starts on line 1 again. - Add a file-scope `import org.apache.pekko` immediately after the package declaration (or at the top of the file for header-less files) in every Scala file that uses `import pekko.*` at file scope without an existing bare import at file scope. Same-pattern search across the whole repository found 27 additional files beyond the 3 that Scala 3 flagged in CI; all are fixed to prevent the same failure under Scala 2 and to keep the two import styles consistent. - The nested `import org.apache.pekko` already present inside doc snippets (e.g. `object FaultToleranceDocSpec { ... }`) is preserved, since those blocks demonstrate the pattern inline. Result: - sbt +headerCheckAll passes. - sbt scalafmtCheckAll and scalafmtSbtCheck pass. - sbt ++ 3.3.7 actor-typed-tests / Test / compile and remote-tests / MultiJvm / compile both succeed. - scalafmt --list --mode diff-ref=origin/main reports no files needing formatting. - Change footprint: 30 files, +58/-2 (only the bare imports and two leading-blank-line removals; no unrelated formatting churn). Tests: - sbt +headerCheckAll -> success - sbt scalafmtCheckAll; scalafmtSbtCheck -> success - sbt ++ 3.3.7 actor-typed-tests / Test / compile -> success - sbt ++ 3.3.7 remote-tests / MultiJvm / compile -> success - scalafmt --list --mode diff-ref=origin/main -> no output References: Refs #3348
He-Pin
marked this pull request as draft
July 15, 2026 08:48
He-Pin
added a commit
that referenced
this pull request
Jul 15, 2026
Motivation: The import refactoring introduced duplicate //#config and //#spec Paradox markers, causing the docs build to fail with "Label [config] block not closed" and "Label [spec] block not closed" errors. Modification: Remove the duplicate markers and place imports correctly within their respective Paradox snippet blocks. Result: Paradox doc build succeeds again. Tests: sbt docs/paradox (fixes the 2 Paradox errors from CI) References: Fixes CI failure in #3348
He-Pin
marked this pull request as ready for review
July 15, 2026 12:50
pjfanning
reviewed
Jul 15, 2026
He-Pin
added a commit
that referenced
this pull request
Jul 17, 2026
Motivation: The Pekko codebase uses two import styles: `import org.apache.pekko.X.Y.Z` for the bare package import and `import pekko.X.Y.Z` for the shorter form. Many files still use the fully qualified style for individual imports. Modification: Convert `import org.apache.pekko.X.Y.Z` to `import pekko.X.Y.Z` across all Scala source files by adding `import org.apache.pekko` as a bare package import and using the `pekko.*` prefix for subsequent imports. The bare `import org.apache.pekko` is placed immediately adjacent to the `import pekko.*` imports with no blank lines separating them. Result: All Scala source files now use the shorter `pekko.X` import style consistently, with the bare `import org.apache.pekko` grouped directly with the pekko imports. Tests: - sbt +headerCheckAll -> success - scalafmt --list --mode diff-ref=origin/main -> no output References: Refs #3348
He-Pin
force-pushed
the
refactor/pekko-style-imports
branch
from
July 17, 2026 13:10
2bd356e to
54c6002
Compare
Member
Author
|
@pjfanning It's fixed now |
pjfanning
reviewed
Jul 18, 2026
| import org.apache.pekko.stream.testkit.{ TestPublisher, TestSubscriber } | ||
| import org.apache.pekko.testkit.{ PekkoSpec, TestLatch } | ||
| import org.apache.pekko | ||
|
|
Member
There was a problem hiding this comment.
still quite a few gaps like this
pjfanning
reviewed
Jul 18, 2026
|
|
||
| package docs.stream | ||
|
|
||
| import org.apache.pekko |
Member
There was a problem hiding this comment.
can we keep this with the pekko imports?
Motivation: The Pekko codebase uses two import styles: `import org.apache.pekko.X.Y.Z` for the bare package import and `import pekko.X.Y.Z` for the shorter form. Many files still use the fully qualified style for individual imports. Modification: Convert `import org.apache.pekko.X.Y.Z` to `import pekko.X.Y.Z` across all Scala source files by adding `import org.apache.pekko` as a bare package import and using the `pekko.*` prefix for subsequent imports. The bare `import org.apache.pekko` is placed immediately adjacent to the `import pekko.*` imports with no blank lines separating them. Result: All Scala source files now use the shorter `pekko.X` import style consistently, with the bare `import org.apache.pekko` grouped directly with the pekko imports. Tests: - sbt +headerCheckAll -> success - scalafmt --list --mode diff-ref=origin/main -> no output References: Refs #3348
Motivation: PR review feedback: import org.apache.pekko and import pekko.X should be grouped together without blank lines or non-pekko imports separating them. Modification: Remove blank lines between import org.apache.pekko and import pekko.X, move non-pekko imports after the pekko import group with a blank line separator. Result: All pekko imports are consistently grouped together across 82 files. Tests: - Not run - import ordering only References: Refs #3348
He-Pin
force-pushed
the
refactor/pekko-style-imports
branch
from
July 18, 2026 14:29
54c6002 to
436d0cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Pekko codebase uses two import styles:
import org.apache.pekko.Xfor the bare package import andimport pekko.Xfor the shorter form. However, many files still use the fully qualifiedimport org.apache.pekko.X.Y.Zstyle for individual imports instead of the shorterimport pekko.X.Y.Zstyle.Modification
A one-time transformation was applied across all 411 Scala source files:
import org.apache.pekko.X.Y.Z→import pekko.X.Y.Zimport org.apache.pekkois added as a bare package import at the top of each affected file (if not already present)This rewrites 885 individual import statements. Auto-generated files in
target/directories are excluded.The transformation was performed with a text-based script that:
org.apache.pekko.prefix withpekko.in import statementsimport org.apache.pekkoafter the package declaration for files that need itimport org.apache.pekko.actor.{ A, B }→import pekko.actor.{ A, B })import org.apache.pekko.actor._→import pekko.actor._)Scalafmt was run after the transformation to normalize formatting.
Result
All Scala source files now use the shorter
pekko.Ximport style consistently. Theimport org.apache.pekkobare import is present in all files that usepekko.*imports.Tests
Not run - import refactoring only, no behavioral changes.
References
None - import style improvement