chore: Re-add sbt-scalafmt to the sbt 2.x plugin builds#625
Conversation
Now that both builds are on sbt 2.0.1, sbt-scalafmt (which needs >= 2.0.0-RC11) can be re-added, restoring the formatter that was dropped while they were on RC10. sbt-uni gains a local .scalafmt.conf (it had none); the existing sbt-uni-playwright sources are reformatted to the mirrored repo-root style. CI now enforces it: the two sub-build jobs run scalafmtCheckAll before scripted, so formatting is checked the same way the main build's code_format job checks it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request integrates the sbt-scalafmt plugin and reformats the codebase according to the newly added .scalafmt.conf configuration. The review feedback identifies a potential resource leak in PlaywrightEngine.scala where an exception thrown during streams.close() in the finally block could prevent subsequent cleanups of the browser session and temporary files.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if streams != null then | ||
| streams.close() |
There was a problem hiding this comment.
If streams.close() throws an exception, the subsequent critical cleanups (session.close() and materializer.close()) will be skipped. This can lead to leaked browser processes (Playwright) and leftover temporary files. Wrapping streams.close() in a try-catch block ensures that browser shutdown and file cleanup always execute.
if streams != null then
try streams.close()
catch case NonFatal(_) => ()## Why While `sbt-uni` and `sbt-uni-playwright` were pinned to sbt `2.0.0-RC10`, `sbt-scalafmt` (needs ≥ `2.0.0-RC11`) had to be left out. Now that they're on **sbt 2.0.1** (#624, merged), the formatter can be re-added — restoring the same `scalafmtCheckAll` enforcement the main build already has. (Supersedes #625, which GitHub auto-closed when its stacked base branch was deleted on merge. Rebased onto main; diff is scalafmt-only.) ## What - Add `addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")` (the main build's version) to `sbt-uni` and `sbt-uni-playwright` metabuilds. - Add a local `.scalafmt.conf` to `sbt-uni` (it had none — its sources already conform). - Reformat the 7 existing `sbt-uni-playwright` sources (formatting-only; still compiles). - **Enforce in CI**: `test_sbt_plugin` and `test_sbt_uni_playwright` now run `scalafmtCheckAll` before `scripted`. ## Validation `scalafmtCheckAll` passes for both builds on sbt 2.0.1, and both still `compile`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Why
While
sbt-uniandsbt-uni-playwrightwere pinned to sbt2.0.0-RC10,sbt-scalafmt(which needs ≥2.0.0-RC11) had to be left out. Now that #624 moves them to sbt 2.0.1, the formatter can be re-added — restoring the samescalafmtCheckAllenforcement the main build already has.What
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.1")(the version the main build uses) tosbt-uniandsbt-uni-playwrightmetabuilds..scalafmt.conftosbt-uni(it had none — its sources happened to already conform to the mirrored repo-root style).sbt-uni-playwrightsources to that style (they were written before the formatter was available; formatting-only, still compiles).test_sbt_pluginandtest_sbt_uni_playwrightjobs now runscalafmtCheckAllbeforescripted.Validation
scalafmtCheckAllpasses for both builds on sbt 2.0.1, and both stillcompile.Follow-up:
sbt-uni-crossproject(added in #623) gets the same treatment in that PR, so all three sbt 2.x builds end up consistent.🤖 Generated with Claude Code