pjfanning opened a new pull request, #498: URL: https://github.com/apache/pekko-persistence-r2dbc/pull/498
### Motivation `AGENTS.md` gives two rules for new files that the header creator could not both satisfy: > **⚠️ Mandatory workflow for new files:** Create the file without any header → run `sbt headerCreateAll` → sbt adds the correct header automatically. Never hand-write or copy-paste a license header. > New files containing new code must use the standard Apache license header. Do not add the special Pekko header that mentions Akka unless you are copying code from an existing Akka-derived file. A file with no existing header fell into the `case None` branch of the `cStyleComment` comment creator, which emitted `apacheHeader` — the variant ending "This file is part of the Apache Pekko project, which was derived from Akka." That is the header the second rule tells new code not to use, so contributors had to hand-write the standard ASF boilerplate, which the first rule forbids. `headerCheck` does not catch the difference either: `isValidCopyrightAnnotated` only calls `isApacheCopyrighted`, and both forms contain "Licensed to the Apache Software Foundation (ASF)". So the rule was left to human review, and 16 files in the repo (`MonoToFuture.scala`, the MySQL DAOs, `RuntimePluginConfigSpec.scala` and others) already carry the hand-written standard header. ### Modification Add `apacheStandardHeader` with the full ASF boilerplate and use it for files with no existing header. `apacheHeader` is unchanged and still prepended to files that already carry a Lightbend copyright — code derived from Akka, where the Pekko header is correct. The `case None` branch now deliberately ignores its `text` argument, matching what `hashLineComment` already does for `apacheSpdxHeader`. ### Result `headerCreate` on a new file emits the standard ASF header, byte-identical to the 16 files already using it, so the documented workflow now produces the documented outcome. Files that already have a header are untouched — `headerCheckAll` reports nothing, so there is no churn on the existing tree. ### Tests - `sbt "core/Test/headerCreate"` on a scratch headerless file — generated header is byte-identical to the one in `core/src/main/scala/org/apache/pekko/persistence/r2dbc/internal/MonoToFuture.scala` (scratch file removed afterwards). - `sbt headerCheckAll` — success; no existing file reported as missing or carrying a wrong header. - `sbt scalafmtSbtCheck` — success. No unit test accompanies this: `project/` is the sbt meta-build and the repo has no scripted or meta-build test infrastructure to hang one on. ### References None - follow-up to the license header discussion on #489 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
