feat(monorepo): detect dependency cycles and release in topological order#618
Merged
Conversation
There was a problem hiding this comment.
Benchmark
Details
| Benchmark suite | Current: 042a7e6 | Previous: 0b5fe57 | Ratio |
|---|---|---|---|
full_check_flow/100_commits |
5489553 ns/iter (± 157149) |
||
full_check_flow/1000_commits |
51558258 ns/iter (± 644307) |
This comment was automatically generated by workflow using github-action-benchmark.
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.
Closes #418.
dependsOnwas handled as a flat list with no cycle behaviour: the dependency cascade simply capped its fixed-point loop atpackages.len()rounds to avoid spinning forever, so a cyclic config silently produced an incorrect/partial result instead of a clear error.This adds a single graph pass (Tarjan SCC) over the package dependency graph, run at the very top of
run_release_logic— before any git work, lock, or write — so it covers bothferrflow checkandferrflow releaseand can never leave a partial release behind:cycle detected: api → web → api, and carries error codeE8003(MONOREPO_DEPENDENCY_CYCLE).dependsOnkeep their config order, so existing behaviour is unchanged for the common case.Tests
graph.rsunit tests: identity order with no deps, dependency-before-dependent, linear chain, unknown-dependency names ignored, two-package cycle, self-dependency, three-package cycle path rendering.cycle_detection): two packages depending on each other → a real (non-dry-run) release aborts withE8003, the message names both packages, no panic, and both version files are left untouched (no partial release).Full suite green (858 + 668 tests),
cargo fmt+clippyclean.Docs
In-repo
docs/errors.mdgains theE8003entry. The public docs-site monorepo page + errors reference are updated in a companionFerrFlow-CloudPR (cross-repo changes are kept separate).