🐛 fix(config): restore factor conditional continuations#3799
Merged
gaborbernat merged 1 commit intotox-dev:mainfrom Feb 20, 2026
Merged
Conversation
…tox-dev#3796) Commit 78eb394 moved continuation line collapsing before factor filtering to fix tox-dev#2912, but this broke the common pattern of using different factor prefixes on consecutive continuation lines (e.g. `cov: coverage run \` / `!cov: python \` / `somefile.py`). The collapsed single line caused factor prefixes to be passed as literal command arguments. Restore the original order (filter first, collapse after) and make filter_for_env continuation-aware instead. Two flags track whether a kept line has an active backslash chain and whether a filtered-out line is pending skip, so unfactored continuations are only dropped when exclusively reachable through removed factored lines. This fixes both tox-dev#3796 and tox-dev#2912.
gaborbernat
added a commit
to gaborbernat/tox
that referenced
this pull request
Feb 20, 2026
…ors (tox-dev#3802) The pending_skip logic from tox-dev#3799 was too aggressive: it skipped all unfactored lines following a filtered factor-conditional continuation, even when those lines were independent shared arguments (e.g. pytest, --remote-data). Now only terminal continuation pieces are skipped, while lines that are themselves continuations are preserved.
gaborbernat
added a commit
that referenced
this pull request
Feb 20, 2026
…ors (#3802) (#3804) The continuation-aware factor filtering from #3799 was too aggressive when skipping unfactored lines. In configs like the [asdf project's tox.ini](https://github.com/asdf-format/asdf/blob/a50580d/tox.ini), shared arguments such as `pytest \`, `--remote-data \`, and `--durations=10 \` were being silently dropped whenever they followed a filtered factor-conditional line ending with `\`. This caused commands to lose most of their arguments for non-matching environments, breaking CI. The fix narrows the skip condition so that only terminal continuation pieces (lines that don't themselves end with `\`) are dropped after a filtered factor. Lines that are themselves continuations are preserved, since they typically represent independent shared arguments rather than exclusive content of the filtered line. The `active_continuation` tracking is also corrected to recognize continuations initiated by unfactored lines, not just factored ones. This preserves the existing fixes for both #2912 (factor-specific multiline commands) and #3796 (alternative factor continuations) while restoring correct behavior for mixed factor/unfactored continuation patterns. Fixes #3802 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.
Commit 78eb394 (#3787) moved continuation line collapsing (
\) before factor filtering to fix #2912, where factor-specific multiline commands leaked continuation lines into non-matching environments. However, this broke the common pattern of using different factor prefixes on consecutive continuation lines — the collapsed single line caused prefixes like!cov:to be passed as literal command arguments instead of being filtered.commands = cov: coverage run \ !cov: python \ somefile.pyRunning
tox -e py-covproducedcoverage run '!cov:' python somefile.pyinstead ofcoverage run somefile.py.The fix restores the original order (factor filter first, collapse
\after) and makesfilter_for_envcontinuation-aware. Two flags track whether a kept line has an active backslash chain (active_continuation) and whether a filtered-out line's continuation should be skipped (pending_skip). An unfactored continuation line is only dropped when it is exclusively reachable through removed factored lines, preserving the fix for #2912 while restoring the conditional continuation pattern from #3796.Fixes #3796.