Show the application order for mixins referencing other mixins - #73
Open
PiousCrossten wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## PiousCrossten/mixins-referencing-mixins #73 +/- ##
===========================================================================
+ Coverage 37.37% 46.11% +8.74%
===========================================================================
Files 12 12
Lines 602 618 +16
Branches 102 104 +2
===========================================================================
+ Hits 225 285 +60
+ Misses 365 318 -47
- Partials 12 15 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Print an additional 'application order' line for every mixin which references other mixins through a 'mixin' key, so the resolved composition is visible without following the references by hand. The order is computed with colcon_mixin.mixin.order and therefore matches the order which is applied at build time. Circular, unknown and malformed references are reported inline as 'unavailable (<reason>)' rather than raised, so the remaining mixins are still being shown. Mixins which don't reference other mixins are shown exactly as before. Add tests covering the added line and its indentation in both the list and the single mixin output, its absence for mixins without references and for an empty reference list, re-application through several paths and the three error cases.
PiousCrossten
force-pushed
the
PiousCrossten/Streach-Goal-Show--render-resolvedgraph
branch
from
August 20, 2026 02:26
f2a58c2 to
a8258a6
Compare
PiousCrossten
changed the base branch from
PiousCrossten/mixins-referencing-mixins
to
master
August 22, 2026 10:46
PiousCrossten
changed the base branch from
master
to
PiousCrossten/mixins-referencing-mixins
August 22, 2026 10:48
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.
Makes the result of mixin composition visible in
colcon mixin show. Once a mixin can reference other mixins, the arguments printed for it no longer tell the whole story: the values it inherits, and the order they get applied in, are only discoverable by following themixinkeys by hand. This adds a singleapplication orderline for the mixins which have references.Follow-up to #70, which implements the composition itself (#39).
Given:
colcon mixin showgains the lines marked+:and
colcon mixin show build devprints it unindented, matching the existing single mixin output:Mixins which don't use the key -
debug,ccache, and every mixin in an existing mixin repository - print exactly as they did before.How it works
_get_application_order()returnsNonefor a mixin without amixinkey or with an empty one, andmain()only prints when it returns something. That single check is the only thing standing between the old and the new behaviour, so a mixin which doesn't compose takes no new code path at all.The order comes from
compute_application_order()incolcon_mixin.mixin.order- the same functionmixin_argument.pyuses to decide what to apply. What is shown is therefore the order which is applied, not a second implementation of the same rules. That includes the duplicates, which are intentional: a mixin reached through several paths is applied once per path to keep last-applied-wins semantics, so a mixin referencing two mixins which both referencedebugshowsCircular, unknown and malformed references are caught and rendered inline:
They are reported rather than raised on purpose:
showis the command a user reaches for when a mixin file is misbehaving, so a single broken reference must not hide the mixins which are fine.One small refactor:
indentmoves out of the argument loop, since the new line is printed after that loop and would otherwise be undefined for a mixin without any arguments.Tests
test/test_show.py- 8 tests covering the added line for a chain of references, its absence both for plain mixins and for an emptymixin: [], the unindented single mixin output, re-application through several paths, and the three error cases (unknown, circular, malformed).Known limitation
A mixin whose body is not a dict -
base:left with an empty YAML body parses asNone- makescolcon mixin show <verb> <referencing-mixin>raise anAttributeError.add_mixins()checks that a mixin file contains a dict but not that each mixin does, so the same file already fails oncolcon mixin showwithout arguments and oncolcon build --mixin, both in code this PR doesn't touch. Validating the mixin bodies inadd_mixins()would fix all three at once - happy to add that here or open it separately, whichever you prefer.Stacked on #70 - this PR targets that branch, so the diff here shows only the show subverb work. It'll retarget to
masterand be rebased once #70 lands.