-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustdoc-json: Guard agains 2 commits making the same modification to FORMAT_VERSION
#94591
Comments
cc @rust-lang/rustdoc |
I'm not sure what the best solution would be here... Adding a tidy check on the version number wouldn't work in this case unless you rebased your PR. Maybe adding this comment would be better, not sure... |
You could make a |
Do we definitely need a format version? |
Anacdotaly it is used to detect when the json moves, which does happen quite a bit: Iff and when where talking about stabilization, we should reconsider, but I think it works well for now |
Instead of names, pull request URLs? |
No, not yet; I just didn't found the time and the right way to get it but the solution from
Yes, a changelog would be useful but I don't think it's not required. The format number is good no need for more. #[derive(Deserialize)]
struct CrateFormatVersion {
format_version: u32,
} |
I think the issue with that is that you can't determine it before opening a PR, but we could have people just update that after opening their PR maybe? |
I currently do not make direct use of There are several reasons I don't make direct use of it:
That said, I think there is value in keeping
The risk of two features having the same logical name is low, but can be eliminated by scoping with username:
I'm not a big fan of having to force push directly after creating a PR to update with the PR number. I think the single number |
Regarding my usage: no, I don't use Changelog is probably unnecessary for my purposes, but I agree on the fact that something more structured than a single number could be more useful on the long run, and semver could make sense... Although this does not (deterministically) solve the problem of conflicting increments in the number if it remains confined in the code. Regarding the problem itself, I don't see a solid solution which doesn't use git-related information (e.g. the hash of the commit that last changed a particular file or that changed the On a higher level, if this kind of feature is needed at all... Typically if a software library produces different outputs given the same input, its semver should change... So, in principle, if that happened to rustdoc's (json) output, wouldn't be this a change in rustdoc's version? OTOH, having the version number in the output json moves the issue of parsing the json to the consumer level, which could support multiple versions, which might be desirable for various reasons. It seems to me that a "clean solution" would be to change rustdoc's semver if the json output changes, but also include that same version in the produced json file. ... But I'm sure this solution would conflict with many other things I'm not aware of, so just take it as my humble and ignorant perspective. |
I use Thinking about it more though, I don't absolutely need a format version or change log since I have a comprehensive test suite that should detect any breaking changes to the format that actually impact my tool. |
This is at risk of happening with #127289 and #127276 for the 30->31 change. Both of these PR's are mine and were spawned from the same zulip thread, which is why there's overlapping changes to such a low-traffic area of the codebase |
One solution to this could be releasing breaking changes to rustdoc-json-types only alongside a new compiler version itself, i.e. with the new 6-week cycle, if there is any change to be made, but such an approach would require stabilising the existence of JSON as an output format of rustdoc |
If merge A and merge B both try to increase the version from 10 to 11, git will helpfully merge both of them, resulting in the version 11 having both changes. If a nightly is released in the time between A and B are merged, then both will claim to have the save version, but with different features.
This almost happened with #94009 and #94150, but was prevented by manual noticing and intervension, which is not ideal.
We should figure out a way such that if 2 commits both attempt to merge the same increments, git will raise this as a merge conflict, so this situation wont occor again.
A way to do this would be to store in a comment the logical "latest feature"
Eg: PR Foo
PR Bar:
If Foo is merged, when Bar is attempted to be merged, the following conflict will occor
This could work, but will have a problem if two features are given the same name, and then we're back to where we were. If someone knows some git-trickery to get around that, that would be great, but if not, I still thing doing this (or something to this effect) would be worthwhile.
cc @Dylan-DPC @CraftSpider
@rustbot modify labels: +T-rustdoc +A-rustdoc-json
The text was updated successfully, but these errors were encountered: