The machine never stops.
Joining the publication of get-tested, I have the pleasure to welcome diff-package-api
to the suite of CI tools that power my continuous integration setups.
diff-package-api
is a GitHub Action workflow that runs against your Haskell package and compares the API it exposes against a file tracked in your repository that contains the expected API exposed by your package.
It is powered by print-api
, which is adapted from the dump-decls
tool created by @bgamari for the benefit of the GHC release engineering team.
It’s still fresh from the oven, so you are highly encouraged to try it out for your projects and give usability feedback. Some aspects of its usage are a bit annoying, like the need to have one golden file per GHC version, but this is due to the very precise level of details regarding the provenance of the identifiers. For instance, between GHC 9.8.2 and GHC 9.10.1, the switch to ghc-internal
has changed the provenance of TypeError
:
module Data.Text.Display.Generic where
- type Assert :: GHC.Types.Bool -> GHC.TypeError.ErrorMessage -> Constraint
+ type Assert :: GHC.Types.Bool -> GHC.**Internal**.TypeError.ErrorMessage -> Constraint
(emphasis mine)
While I’m opening a bottle to celebrate, I will also produce an architecture document that ought to answer a lot of questions about the precise details of how it all works and when it stops working.
This is not a PVP compliance checker (although perhaps it could?). For the moment it forces you to stay honest on the changes of your packages’ API.
Here a few screenshots from a PR on text-display. You can go there to see (or hear) by yourself if the screenshots are not convenient.
The updated API interface file in a pull request
When diff-package-api
complains
Me when I can keep trace of potentially breaking API changes
dope.
My warmest thanks to @bgamari, @TeofilC and @mpickering for their help, both direct and indirect.