feat(monorepo): propagate the upstream bump type through the dependency cascade - #782
Merged
Conversation
BryanFRD
enabled auto-merge (squash)
August 4, 2026 20:39
There was a problem hiding this comment.
Reviewed the diff in full (config, cascade, graph, schema, fixtures).
BumpTypealready derivesOrdwithNone < Patch < Minor < Majorand a matchingDisplay, so.max()over resolved policies andbump.to_string()in the JSON/text outputs both do the right thing — no silent behavior gap there.PropagatePolicy::resolvecorrectly special-casesBumpType::Nonein every arm, so an unmoved upstream never manufactures a downstream bump under any policy (matches the dedicated test and the fixture'sdocs/nonecase).- The
Vec<String> → Vec<Dependency>change is consistent everywhere it matters (cascade.rs,graph.rs); other call sites only ever constructdepends_on: vec![], which still type-checks.bumped_names: HashSet<String>→bumped: HashMap<String, BumpType>is threaded through cleanly, andHashSetstays imported in both files where it's still used elsewhere (refresh_lockfilesinmod.rs, cycle detection ingraph.rs). - Cycle detection (
graph.rs) just swapsdep.as_str()fordep.name()— behavior unchanged, tests updated accordingly. - Untagged
Dependencyenum keeps both the plain-string and detailed-object config forms working, matches the schema'soneOf, and the new policy table (same/major-on-major/patch/none) is covered by unit tests plus an end-to-end fixture exercising all four policies against one major bump.
Nit: the new monorepo-deps-propagate-policies.json fixture's check_contains entries for cli/sdk don't include the (policy, dependency: core) suffix the way the other two fixtures do — not wrong (the line is still a valid substring), just slightly less precise than it could be.
No blocking issues. Nice, honest write-up in the PR description about deliberately deferring update_dependents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses points 1 and 3 of #493. Point 2 (
update_dependents) is not in this PR — see the end.The bug
The cascade hardcoded
BumpType::Patch(cascade.rs:79) and wrote"patch"into the JSON outputs. Socoregoing1.4.0 → 2.0.0on afeat!:handed its dependentclia patch, and consumers upgradedclistraight into a breaking API.Verified on a real fixture before the change:
clicame out at2.1.1. After:Propagation
bumped_names: HashSet<String>becomesbumped: HashMap<String, BumpType>, so the cascade knows what each upstream actually got. The dependent's bump is the strongest resolved bump across its moved dependencies — the same rule a package's own commits already follow.The default is
same: the dependent gets exactly what the upstream got. A breaking upstream makes the dependent breaking, which is the honest signal — it now builds against a breaking API.Per-dependency policy
depends_onaccepts the detailed form alongside the plain name, via an untagged enum, so every existing config keeps working unchanged:same(default)major-on-majorpatchnonepatchreproduces the pre-PR behaviour for anyone who wants it back;noneopts a dependency out of the cascade entirely. An upstream that did not move never manufactures a downstream bump, under any policy.Verified end to end
Built the binary and ran
ferrflow check --jsonon four monorepo fixtures:major-on-major+ minor upstream → dependent patchpatch+ major upstream → dependent patch (old behaviour intact)none+ major upstream → dependent absent from the plan entirelyAlso
Schema updated for both spellings (
dependsOn/depends_on) with theoneOfstring-or-object shape, and the cloud copy re-synced — byte parity verified.8 new tests on the policy table and both deserialisation forms, including that no policy can invent a bump from an unmoved upstream. Full suite green (1843),
clippy --all-targets -D warningsclean.What is not here:
update_dependentsPoint 2 of the issue — rewriting the dependency ranges in dependents' manifests — is deliberately left for its own PR, and I want to be explicit that I chose this rather than run out of room silently.
It is the riskiest part of the issue: it writes into user manifests, and getting it wrong corrupts a
package.jsonorCargo.toml. It also needs real per-format work that does not exist yet —json.rshas a hand-rolled span walker that only finds top-level string values, and there is an explicit test asserting the version bump must not touchdependencies. Doing it properly means a nested-span finder for JSON,toml_edithandling for both thedep = "1.2"anddep = { version = "1.2" }shapes, and a decision on constraint preservation (^,~,>=,workspace:*, git/path deps) — each of which deserves its own tests and review.The two parts are independent: propagation is useful on its own and this PR is complete without it. Happy to open the follow-up immediately.