-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cabal and Cabal-syntax API checking #10259
base: master
Are you sure you want to change the base?
Conversation
Wow, this is awesome! 🤩 |
Do you happen to know whether cabal-install-solver needs to be included here, since it's a library? My assumption is that it's internal and as such has no public API to be checked. |
Also, this is very much WIP as I sort out what's needed (and deal with weirdshit like the fact that I somehow got a byte order mark the first time, and subsequent runs don't like it much). |
Cabal and Cabal-syntax are mission critical. The solver package is not (e.g. reverse dependencies count from Hackage: 259 for Cabal vs 1 for solver). So it's fine to start with those. |
Just made the current API dumps into artifacts, since not everyone will have an Ubuntu box to run |
228ca7d
to
e630390
Compare
@geekosaur why not use GHC 9.10.1? :) |
Originally I was thinking 9.4.8 for consistency with GHC_FOR_RELEASE, then discovered that wasn't supported so I bumped it. I could do it again with 9.10.1 if that's preferred. |
Yes, let's use the highest supported GHC now and bump it once it falls out of the support window |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can we provide a means to easily update these files with a single command locally?
Ideally it should be possible to run all cabal tests locally with a single command and update the output within the same framework. This is already an issue with the structured hash test, which is difficult to update and dependent on GHC version, and in practice, just more annoying busywork than informative for contributors.
Otherwise, I don't think this job should be required by contributors as it introduces a significant amount of friction. It could be run as part of CI to track how the API has changed over time rather than requiring a golden file to update or perhaps this test could just be run on release branches (where the API is not expected to change).
I think having such an API test is going to be very valuable, as it allows us to confidently assess the API impact of PRs under review. This will give us much more confidence and allow us to write more accurate changelogs, and avoid accidental changes in minor Cabal version etc. I'm grateful that the Cabal project is taking such a step. However, I share Matthew's concern about the workflow for accepting the test. At the moment one has to provision a docker container to run with the appropriate environment for the test. Either that, or one ends up with a situation like the structured hash test where one has to wait for CI to run, let it fail because of the test, then change the stdout locally, then push again. If one needs one more CI run than one did before then I think it is too onerous; I would much rather that the structured hash test and this test be separate tests which don't cause the whole CI pipeline to fail if they fail, so that they can be updated in parallel with working on the PR without cancelling the CI which might otherwise have valuable information. I also thing the surface area we are testing is a bit too large (I don't think the Cabal project has any guarantees about the entire set of exposed modules; that seems too much). As a result, I'm worried that we will get unreadable diffs as a result whenever there is a significant refactor. But I suppose we can wait and see how things pan out in that regard. |
👍
We all do, I don't think anyone has objected publicly or privately.
Yep, configuring the tool with an "ignore" list is in the plans. Cabal is just an early adopter and the needs of adopters will help determining how |
Actually no: as a first cut, the new API files are artifacts which can be downloaded and copied over the existing ones, specifically for this case. If there's some friendly way to make it completely automatic, I'm all ears, but I did specifically address that "contributors need to replicate the CI environment" issue. (And will shortly be using it myself, since I'll be redoing the golden API files for 9.10.1.) |
As semi-official release manager for the 3.12 branch, I would like this to run on every incoming PR. I do need to tune that though, as I don't want API changes to prevent merges; I want them to inform me whether a given PR is a backport candidate or not. As I'm still learning the details of workflows, I should probably put this back in draft even though I'm soliciting reviews. |
Uh, let me correct that: the test should always pass, this is accomplished by updating the golden tests by copying the new API files over the old ones as described above. Then the presence of such updates tells me as release manager that the PR shouldn't be backported. I think my ideal for both this and the structured hashes is that they'd be checkboxes in the PR that the tests could inspect in order to determine whether to report a mismatch or do an update. But
|
89e78dd
to
ad55b8c
Compare
(despite the labels, this is parked until post-ghc-9.12.1) If/when this does go in, "Check API Post Job" will need to be added to the required jobs. |
c73b64e
to
bc4a567
Compare
2d3d4cf
to
7049f23
Compare
@geekosaur do you want to split this into two PRs? It would be useful to run the make targets locally if we suspect an API change. |
010f50b
to
97a9151
Compare
@philderbeast, I'm not sure what a split would be worth. The only split that makes any sense to me would be to make the API files a separate commit in this PR, facilitating cherry-picking the rest into a test branch. |
@geekosaur, I'm trying this out. I was able to install PRINT_API_VERSION ?= eedf83e6f828217ba7946ca8bfaf4ab4062c2363
PRINT_API_URL := https://github.com/Kleidukos/print-api/archive/${PRINT_API_VERSION}.tar.gz
print-api/print-api.cabal:
rm -rf print-api
curl -sSL ${PRINT_API_URL} | tar -xz
mv print-api-* print-api
print-api-install: print-api/print-api.cabal
cabal install print-api:exe:print-api --project-dir=print-api --overwrite-policy=always |
@geekosaur I was thinking of a split into two, one with the makefile changes (so we could use it locally) and the other with CI changes. |
When I run it I'm seeing an error:
Note The fix for this error is to build |
Huh. I guess I'll have to add that to the rules. (I seem to have hit the same problem when trying to sanity check 3.12 branch against its base.) |
It turns out there is a consumer of cabal-install-solver, so I have added it to API generation and checking.
Uhhhhh… @Kleidukos, why is
ETA: no, this was our forgetting to bump the |
Welp. With this fix it appears that a few API changes leaked into 3.12 after all. That said, they're slight and I think they might be safe because there's backward compatibility code.
For the record:
Notes for future me: as of
Additionally, as mentioned above the |
Note PVP:
https://github.com/haskell/pvp/blob/master/v1.0/pvp-specification.md |
Not checking cabal-install or cabal-install-solver currently because they don't have public APIs. This may be incorrect for cabal-install-solver, so that may be added later.
Template B: This PR does not modify behaviour or interface
E.g. the PR only touches documentation or tests, does refactorings, etc.
Include the following checklist in your PR:
There should be no need for manual QA, because it's already been tested by multiple rebases on
master
which changed API (for example, #10270).