Skip to content

Allow declaration of "out-of-band" dependencies#726

Draft
cottsay wants to merge 4 commits into
masterfrom
cottsay/out-of-band-deps
Draft

Allow declaration of "out-of-band" dependencies#726
cottsay wants to merge 4 commits into
masterfrom
cottsay/out-of-band-deps

Conversation

@cottsay

@cottsay cottsay commented Feb 24, 2026

Copy link
Copy Markdown
Member

The "out-of-band" declaration on a dependency is intended to indicate that the dependency is a requirement but not a prerequisite for processing. As such, operations like "--packages-up-to" and graph computation will still show the relationship, but the topological ordering operation will not require the dependency as a prerequisite.

The "out-of-band" declaration on a dependency is intended to indicate
that the dependency is a requirement but not a prerequisite for
processing. As such, operations like "--packages-up-to" and graph
computation will still show the relationship, but the topological
ordering operation will not require the dependency as a prerequisite.
@cottsay cottsay self-assigned this Feb 24, 2026
@cottsay cottsay added the enhancement New feature or request label Feb 24, 2026
@codecov

codecov Bot commented Feb 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.21%. Comparing base (aee8364) to head (e50fec3).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #726   +/-   ##
=======================================
  Coverage   87.21%   87.21%           
=======================================
  Files          69       69           
  Lines        4106     4106           
  Branches      709      709           
=======================================
  Hits         3581     3581           
  Misses        414      414           
  Partials      111      111           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cottsay cottsay requested a review from Blast545 February 25, 2026 03:43
Comment thread colcon_core/topological_order.py Outdated
Comment on lines +65 to +76
if not ready:
# if nothing is ready, try removing out-of-band dependencies
ready = [
decorator for decorator, r in queued.items()
if not r.difference(out_of_band[decorator])
]
# prefer those with less out-of-band dependencies first
ready.sort(key=lambda d: (
len(out_of_band[d]), d.descriptor.name
))
# take only one at a time
ready = ready[:1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should this section be optional with a condition somehow? The out-of-band concept is a bit tricky to grasp, it would be nice to add an example to illustrate what we want.

We discussed it in a meeting, but it's not clear to me from the PR's code completely how this will work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried to write something to help answer your question, and it led me to really look at what's happening here, and it's just flat-out wrong. So the review process is 100% working here 😆 💯

This code was intended to help minimize the amount of out-of-order dependencies in the topological ordering. Instead of ignoring them outright, the idea was to wait until we have no option left but to break package ordering.

The main oversight here is that a DependencyDescriptor inherits equality operators from str, so tracking the dict of out_of_band decorators is broken. It results in treating nodes within the graph as out-of-order, when we want to treat edges in the graph as out-of-order. I'll fix it.

Second thought: I need to add an explicit test for this, particularly if it includes heuristics and extra complexity to treat the out-of-order dependencies as a last resort.

Third thought: If we're going to ignore these dependencies in topological ordering, we should also ignore them for job execution. Right now, we wouldn't need to change the sequential executor because it assumes that the packages (and therefore jobs) are in topological order and can be executed one-by-one without even thinking about dependencies. The parallel executor, however, needs to be changed to ignore out-of-band dependencies or it will deadlock when it sees them.

The overall picture here is that out-of-band dependencies SHOULD:

  1. Be considered as part of --packages-up-to, which should continue to downselect based on dependencies, not prerequisites.
  2. Be represented in colcon graph and colcon list -t, which also enumerate dependencies.

The out-of-band dependencies SHOULD NOT:

  1. Block execution of a package's task (i.e. the package build) if the upstream task has not yet completed (whether not attempted, in progress, or failed).

In our target use case, we will use #725 to interact with job creation in such a way that the new "crate" jobs become de-facto prerequisites (out-of-band is not True) even if building the actual packages targeted by out-of-band dependencies haven't been properly "built" yet.


tl;dr -

  1. I'll update this PR to fix the bug and add tests.
  2. I'll open a PR against colcon-parallel-executor to drop the existing "prerequisite" behavior for out-of-band dependencies.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sounds good!

Second thought: I need to add an explicit test for this, particularly if it includes heuristics and extra complexity to treat the out-of-order dependencies as a last resort.

I think this was particular concern, it's unclear when this last resort case happens. The PR should include a test illustrating the case it wants to cover.

The parallel executor, however, needs to be changed to ignore out-of-band dependencies or it will deadlock when it sees them.

I didn't think about this, but yes, we should also consider how this will play out with both executors. Sounds like this last resort mechanism might change the end result based on the order in which the jobs are executed. Something to consider and track.

@cottsay cottsay marked this pull request as ready for review March 24, 2026 21:29
@cottsay

cottsay commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

Alright, I simplified this change and added a test. We can revisit the idea behind "best effort" use of out-of-band dependencies later. It could result in a more expected execution order, but isn't strictly necessary to land the feature.

@cottsay cottsay marked this pull request as draft March 26, 2026 19:57
@cottsay

cottsay commented Mar 26, 2026

Copy link
Copy Markdown
Member Author

I'm just not happy with how this looks. Converting to draft for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants