Skip to content

Add CI job for checking stdlib semver compatibility - #160253

Open
Kobzol wants to merge 6 commits into
rust-lang:mainfrom
Kobzol:csc-ci
Open

Add CI job for checking stdlib semver compatibility#160253
Kobzol wants to merge 6 commits into
rust-lang:mainfrom
Kobzol:csc-ci

Conversation

@Kobzol

@Kobzol Kobzol commented Jul 31, 2026

Copy link
Copy Markdown
Member

View all comments

This CI job installs the latest published version of cargo-semver-checks and then runs the x test std-semver-check bootstrap command added in #159671.

If csc finds semver breakage, the job will fail. If csc cannot parse the rustdoc JSON data (e.g. because the format was bumped), the job will print an error, but it will not fail.

If a PR wants to explicitly go around the csc check (either there is an actual semver break or csc produces a false positive), if the src/bootstrap/stdlib-semver-check-stamp is changed in the same PR, then the check will be skipped

CI runs:

CC @rust-lang/libs @obi1kenobi

r? @jieyouxu (for bootstrap and CI stuff)

try-job: x86_64-gnu-stdlib-semver-check

@rustbot

rustbot commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Warning

If you are changing how CI LLVM is built or linked, make sure to bump
src/bootstrap/download-ci-llvm-stamp.

cc @jieyouxu

This PR modifies bootstrap.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc labels Jul 31, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Jul 31, 2026
@Kobzol

Kobzol commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=x86_64-gnu-stdlib-semver-check

rust-bors Bot pushed a commit that referenced this pull request Jul 31, 2026
Add CI job for checking stdlib semver compatibility


try-job: x86_64-gnu-stdlib-semver-check
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 31, 2026
@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 79f5ace failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Kobzol marked this pull request as draft July 31, 2026 07:55
@Kobzol

Kobzol commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=x86_64-gnu-stdlib-semver-check

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 31, 2026
Add CI job for checking stdlib semver compatibility


try-job: x86_64-gnu-stdlib-semver-check
@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: cf27501 (cf2750129ae79b5df875523f88c46d6fe8a84b4c)
Base parent: 922325b (922325bb13bfea5b41454318563f2a65e83c2336)

@Kobzol
Kobzol marked this pull request as ready for review July 31, 2026 08:41
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2026
@Urgau

Urgau commented Jul 31, 2026

Copy link
Copy Markdown
Member

I expect quite a few semver breaking changes over the development of nightly features, how are contributors supposed to bypass the CI for changes that are okay? What about stable feature where the breakage is accepted?

@Kobzol

Kobzol commented Jul 31, 2026

Copy link
Copy Markdown
Member Author

That's a very good question, that I don't yet know the answer to :) In terms of implementation, we could have some file in the standard library subtree (something like the LLVM bootstrap stamp files) that could be manually bumped in PRs that expect a breaking change. And for those PRs the test would just be green.

@cuviper

cuviper commented Jul 31, 2026

Copy link
Copy Markdown
Member

A file-based bypass sounds good to me.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Add CI job for checking stdlib semver compatibility

try-job: x86_64-gnu-stdlib-semver-check
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0bb0391 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Add CI job for checking stdlib semver compatibility

try-job: x86_64-gnu-stdlib-semver-check
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 7920893 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Add CI job for checking stdlib semver compatibility

try-job: x86_64-gnu-stdlib-semver-check
@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Add CI job for checking stdlib semver compatibility

try-job: x86_64-gnu-stdlib-semver-check
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2d06403 (2d06403073949d757f25faf287ed7514be455eb7)
Base parent: 7c329d6 (7c329d6c76e11ca40c5673818ab0439c1be8962c)

@Kobzol

Kobzol commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

Ok, should be ready now, including an opt-out mechanism. I updated the PR description and added CI links to the various cases that can happen.

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 3, 2026

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some behavioral / dealing with job failure questions, but otherwise CI/bootstrap changes look good to me.

@rustbot author

View changes since this review

Comment on lines +4714 to +4722
// 101 marks that csc was unable to parse the JSON data, but it did not fail with a
// semver breakage.
Some(status) if status.code() == Some(101) => {
eprintln!(
"cargo-semver-checks was unable to process {library} (this is not a fatal error)\n{}\n{}",
res.stderr(),
res.stdout()
);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: hm, is it possible that the JSON data remains borked but this swallows the problem? I assume that if std JSON data becomes borked there's additional mechanisms to catch that, or at least is possible for library maintainers to notice?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless the breakage is something super specific, like "only std is broken and nothing else", there are plenty of other things that could catch this including both rustdoc tests and cargo-semver-checks CI which runs vs nightly. std/core etc. aren't that special AFAIK in rustdoc JSON so the likelihood of such narrow breakage is very low.

In the reasonably near future cargo-semver-checks should start connecting rustdoc JSON for std/core/alloc together with the user's crate, at which point its CI will become even more attuned to finding possible breakage in rustdoc output.

So I think we're reasonably well set up for success here, and feel that more complexity here is probably not worth the possible payoff.

Comment on lines +494 to +495
- name: x86_64-gnu-stdlib-semver-check
<<: *job-linux-4c

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: could we maybe provide a doc_url for how to handle failures from this job? Or alternatively, if it's possible to allow co-posting a more general "job failure help message".

Comment on lines +494 to +495
- name: x86_64-gnu-stdlib-semver-check
<<: *job-linux-4c

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: Hm, this is an auto job. I wonder how often we would hit csc failures in practice for libs changes, I suppose we'll have to find out. But seems fine to start with this to try it out.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my historical analysis, we expect about one instance of breakage per year. We may get a few more false-positives but I hope not many.

With that in mind, I think having even a pretty manual process like "post in this Zulip topic if you aren't sure what to do" should be okay, and I'd be happy to watch that topic and help people who might be stuck or confused.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants