Skip to content
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

Stricter mode of API checking w.r.t. API file dump order #260

Open
sandwwraith opened this issue Jul 23, 2024 · 1 comment
Open

Stricter mode of API checking w.r.t. API file dump order #260

sandwwraith opened this issue Jul 23, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@sandwwraith
Copy link
Member

sandwwraith commented Jul 23, 2024

Currently, apiCheck task is tolerant to ordering changes in API file: if two lines with, let's say, top-level functions, are swapped, it won't cause apiCheck to fail. While generally, it is a desirable behavior, it has one major drawback. Since API file ordering is not stable and it can change (e.g. it was changed between 0.15 and 0.16 versions for Klib dumps), it is quite easy to get into the following situation:

  1. You have 0.15 dump committed
  2. You make a PR that updates BCV to 0.16. apiCheck passes; no other changes are required.
  3. You (perhaps several weeks later) add one function to a public API and do apiDump. Suddenly, not only has your new function been added to the API, but the whole diff has also become cluttered with lines reordering — change which is not related to your new PR per se.

To avoid this, we should either write BCV/dump version to the file (so updating plugin would force users to do new apiDump), or make a configuration option that would strictly compare files — so that people who want to avoid such situation can opt-in to order check.

@JakeWharton
Copy link

I would also advocate for this being the default and to be opt-out. I much prefer opting out of strictness than opting in, because it means that the presence of an opt-out is deliberate whereas the absence of an opt-in could merely be ignorance that the configuration even exists.

zuevmaxim added a commit to Kotlin/kotlinx.coroutines that referenced this issue Aug 8, 2024
Refresh the API dump without code changes. Fix the order of items in the dump after updating to a newer version of the compatibility-validator. Version updates without dump refreshing were possible due to Kotlin/binary-compatibility-validator#260
@fzhinkin fzhinkin added the enhancement New feature or request label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants