Skip to content

Conversation

@fhausmann
Copy link
Contributor

@fhausmann fhausmann commented Jan 5, 2026

This will fix #10941 and fix #10614.

PR for docs: treeverse/dvc.org#5498

@github-project-automation github-project-automation bot moved this to Backlog in DVC Jan 5, 2026
@CLAassistant
Copy link

CLAassistant commented Jan 5, 2026

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

❌ Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.
βœ… Project coverage is 90.98%. Comparing base (2431ec6) to head (1144775).
⚠️ Report is 179 commits behind head on main.

Files with missing lines Patch % Lines
dvc/commands/dag.py 96.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10945      +/-   ##
==========================================
+ Coverage   90.68%   90.98%   +0.30%     
==========================================
  Files         504      505       +1     
  Lines       39795    41083    +1288     
  Branches     3141     3255     +114     
==========================================
+ Hits        36087    37380    +1293     
- Misses       3042     3064      +22     
+ Partials      666      639      -27     

β˜” 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.

help="Print DAG with mermaid format wrapped in Markdown block.",
)
dag_parser.add_argument(
"--collapse-substages",
Copy link
Collaborator

@skshetry skshetry Jan 6, 2026

Choose a reason for hiding this comment

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

We don't use substages anywhere, so this terminology may be confusing. I’m divided between keeping it short with just --collapse for brevity or going with the more descriptive --collapse-foreach-matrix, which is accurate but quite long. I'm leaning towards the latter.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your feedback.

Sure, I can rename everything to the more descriptive --collapse-foreach-matrix.

Comment on lines 175 to 176
if collapse:
filtered_graph = _collapse_graph(filtered_graph)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work with outs? If not, let's add a check in def run() to prevent --outs and --collapse from getting used together. Alternatively, it could be a mutually exclusive group.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you run with outs, it will not modify or collapse the nodes, because they don't contain any information about which stage they belong to.
However, this would indeed yield incorrect results if a filename contains "@". I will add a check in def run().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In addition, I fixed a bug that assumes a file some_file_name_with_@_something.dvc is treated as a stage. Thus, I introduced the function _is_foreach_matrix_stage.

Comment on lines 6 to 7
from dvc.exceptions import InvalidArgumentError
from dvc.parsing import JOIN
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you move this import inside the function? CLI imports from these files, so this might slow down other commands.

We have a benchmark for this, and you can see that this regressed the startuptime slightly for dvc --help.

https://github.com/treeverse/dvc/actions/runs/20741797938/job/59549936999?pr=10945#step:6:95

@skshetry skshetry enabled auto-merge (squash) January 6, 2026 08:29
@skshetry skshetry merged commit e062f54 into treeverse:main Jan 6, 2026
48 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in DVC Jan 6, 2026
@skshetry
Copy link
Collaborator

skshetry commented Jan 6, 2026

Thank you @fhausmann for contributing. πŸ™‚

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Simplify dvc dag (foreach stages) Output of dvc dag is unreadable if used with foreach/matrix stages

3 participants