Skip to content

test!: confirm the semver gate allows a declared break#10837

Closed
gustavovalverde wants to merge 7 commits into
mainfrom
test/semver-gate-break
Closed

test!: confirm the semver gate allows a declared break#10837
gustavovalverde wants to merge 7 commits into
mainfrom
test/semver-gate-break

Conversation

@gustavovalverde

Copy link
Copy Markdown
Member

Do not merge. Throwaway PR to validate the semver-checks gate from #10833.

What this does

Adds one pub field to RegtestParameters, a struct downstream code constructs with a struct literal. That is a breaking change (constructible_struct_adds_field) even though it only adds to the API, which is exactly the case a public-API surface diff treats as additive and misses. The two in-tree construction sites are updated so the workspace still compiles.

What to expect

The PR title has no !, so the gate should run and fail: cargo-semver-checks reports that the new field requires a major version bump, and the gate blocks because the break is not declared.

To confirm the escape and the edited re-trigger, change the title to test!: .... The gate should re-run and pass, because a declared break is allowed through (release-plz majors the version at release).

Close this PR once both behaviors are observed.

AI Disclosure

AI tools were used: Claude created this validation PR.

Fail a pull request that breaks a published crate's public Rust API unless the
break is declared with a conventional-commit `!` in the PR title.
cargo-semver-checks flags added-field and added-variant breaks, which require a
major version bump even though they only add to the API. The `!` marker is the
author's declaration and the signal release-plz uses to bump the major version.

Add semver-checks-result to both Mergify queue condition sets so the gate blocks
merges. Document the `!` convention in CONTRIBUTING and the tool division of
labor in docs/proposals/release-changelog-pipeline.md.
The gate failed its own CI: the pinned nightly toolchain emitted a rustdoc JSON
format that cargo-semver-checks cannot parse. Use stable, the supported and
recommended toolchain, matching the sibling required-check workflows.

Trigger on push and merge_group with the real check gated to pull_request, and
add `edited` so a title change re-runs the gate, so the merge queue is not
stalled. Compute the `!` marker in the changes job and skip the check for
declared breaks, so a tooling failure is reported as itself rather than as a
public API break.
…se baseline

The workspace run failed two ways: it semver-checked the zebrad binary, whose
build script needs test-only proto files absent from the baseline checkout, and
it compared against the base SHA, which lags the merge commit and attributed
unrelated main-branch changes to the PR.

Run cargo-semver-checks through obi1kenobi/cargo-semver-checks-action, the way
lint.yml runs cargo-deny. Exclude zebrad, check default features, check out the
PR head, and use the merge-base with the base branch as the baseline so only the
PR's own API delta is judged.
zebra-test has two feature-gated `expect_no_requests` methods with different
return types; cargo-semver-checks resolved different ones for the workspace
build and the isolated baseline build, producing a false "breaking change".

Exclude the binary, test-helper, and tooling crates (zebrad, zebra-test,
zebra-utils) so the gate checks only the nine library crates that downstream
code depends on.
@mergify

mergify Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 📃 Configuration Change Requirements

Mergify configuration change

  • check-success = Configuration changed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This is an explicitly throwaway, "do not merge" PR whose sole purpose is to validate the cargo-semver-checks CI gate introduced in #10833. It deliberately introduces an additive-but-breaking public API change (constructible_struct_adds_field) by adding one pub field to RegtestParameters, so the gate should detect the undeclared break and fail. The PR also carries the gate infrastructure from #10833 (workflow, path filter, Mergify required check, and CONTRIBUTING guidance), since it is branched from that change.

I verified the technical correctness of the change set:

  • All RegtestParameters construction sites still compile: every other site (tests/vectors.rs, config/tests/vectors.rs, zebrad/tests/integration/database.rs) uses ..Default::default(), so only the full struct literal in zebra-network/src/config.rs needed the new field, and new_regtest correctly ignores it via ...
  • The semver-checks.yml workflow mirrors the existing lint.yml changes + alls-green aggregator pattern, and the baseline/gate logic (skip on declared ! break, fail on undeclared break) is sound.
  • The exclude list leaves exactly the nine published library crates (the workspace has 12 members; no crate is publish = false), matching the comment and #10833's description.
  • mergify.yml correctly registers semver-checks-result as a required check in both the defaults and queue_rules blocks.

I found no objective code defects. The dead/unused gate_test_field on a consensus-critical zebra-chain struct is intentional and explicitly acknowledged in the description (the PR is to be closed once both gate behaviors are observed), so I did not raise it as a finding. That said, this PR modifies merge-gating CI (mergify.yml required checks) and a consensus-critical data structure, and is explicitly not intended to merge — both warrant human handling rather than automated approval.

Changes:

  • Adds a temporary pub gate_test_field: Option<bool> to RegtestParameters and updates the in-tree construction/destructuring sites to keep the workspace compiling.
  • Carries the cargo-semver-checks gate from #10833: new semver-checks.yml workflow, semver path filter, and semver-checks-result as a Mergify required check.
  • Documents the conventional-commit ! breaking-change marker in CONTRIBUTING.md.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
zebra-chain/src/parameters/network/testnet.rs Adds the temporary gate_test_field to RegtestParameters (the intended breaking change) and ignores it via .. in new_regtest.
zebra-network/src/config.rs Updates the only full struct-literal construction site to set gate_test_field: None so the workspace compiles.
.github/workflows/semver-checks.yml Adds the gate workflow: changes paths-filter + PR-title ! detection, semver-checks against the merge-base baseline, and an alls-green result job.
.github/path-filters.yml Adds a semver filter so the gate runs on Rust/manifest and workflow changes.
.github/mergify.yml Registers semver-checks-result as the fourth required aggregator check in both queue condition sets.
CONTRIBUTING.md Documents the ! breaking-change marker required by the gate.

@gustavovalverde gustavovalverde changed the title test: confirm the semver gate blocks an undeclared API break test!: confirm the semver gate allows a declared break Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Tells Mergify not to merge this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants