fix: order builds by the requirements of inherited staging outputs #2973
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 317 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.345
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #2973"
general
weight: 0.35
pb01ka
Fixes #2492.
With
--recipe-dir, a recipe whose staging output host-depends on another local recipe could be built before that recipe and fail. With the recipes from the issue:extract_dependency_namessupplies the edges of the build-order graph, and it read only the output's own requirements. A staging output is not a node in that graph. Its requirements are stored instaging_cacheson every output that inherits it, and the sort never read that field, so nothing orderedpackage_aafterpackage_c. Repeating the dependency on the inheriting output, as described in the issue, worked around it.This change adds the build and host requirements of
recipe.staging_cachesto the output's build-time dependencies. Bothtopological_sort_by_dependencies(--recipe-dir,--up-to) andtopological_sort_variants(the order of one recipe's outputs) use this helper. Self-dependencies are still skipped, so a staging that host-depends on its own output adds no cycle. Staging requirements now follow the same rule as an output's own host dependencies. So if a staging host-depends on a local recipe that itself host-depends on the inheriting output, the sort now reports a cycle. Before, that recipe was ordered after the inheriting output, so the staging could only get it from a channel.Not covered: with
--parallel-builds 2, the issue's recipes still fail the same way. The readiness check (can_buildinsrc/build_queue.rs) looks only at the output's own requirements, sopackage_acan start beforepackage_cis built. I left that out to keep this change small.Testing (Rust 1.100.0; the repo pins 1.99.1):
test_topological_sort_considers_staging_requirements: fails on main (left: ["package-a", "package-c"],right: ["package-c", "package-a"]) and passes with the fix.cargo test --workspace --all-targets --features=recipe-generationpasses.cargo fmt -- --checkandtypospass.cargo clippy --all-targets --all-features --workspace -- -D warningsreports onlyclippy::needless_boolatsrc/build_queue.rs:600, a file this change does not touch.package_c,package_aandpackage_band writes all three packages.--render-onlyon the 25 recipes in the repo that use a staging output gives the same order before and after.AI-assisted.