Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't give a subsequent formatter an empty snapshot after skipping #15483

Merged
merged 1 commit into from
May 15, 2022

Conversation

thejcannon
Copy link
Member

Fixes #15406 by not piping a skipped formatter result into the next formatter.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@@ -15,7 +15,7 @@
from pants.engine.fs import EMPTY_DIGEST, CreateDigest, Digest, FileContent
Copy link
Member Author

@thejcannon thejcannon May 15, 2022

Choose a reason for hiding this comment

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

This file could use a good amount of TLC. It seems to under-test fmt pretty badly and has more than a few quirks.

It's out of scope for this PR though. I cleaned it up enough to test the fix (fails before, passes after)

@thejcannon thejcannon requested a review from Eric-Arellano May 15, 2022 16:10
@thejcannon thejcannon added category:bugfix Bug fixes for released features needs-cherrypick labels May 15, 2022
@thejcannon thejcannon added this to the 2.12.x milestone May 15, 2022
@@ -286,7 +286,8 @@ async def fmt_language(language_fmt_request: _LanguageFmtRequest) -> _LanguageFm
continue
result = await Get(FmtResult, FmtRequest, request)
results.append(result)
prior_formatter_result = result.output
if not result.skipped:
prior_formatter_result = result.output
Copy link
Member

Choose a reason for hiding this comment

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

Question for @Eric-Arellano @stuhood

Is the intention for skipped formatters to return an empty digest or just forward through the original input digest (untouched)?

As in, is the core intention for formatters to be pipelined (in some deterministic order), or is this a workaround/side-effect because skipped formatters happen to have empty digests?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a good point. Right now "skipped" is a magical combo of values. What would it look like if it was distinct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I don't think it matters much how Skip is factored, as long we don't waste time trying to run it etc

@sureshjoshi
Copy link
Member

@thejcannon Per our Slack chat - how is the console output of a skipped test handled?

Citing my original ticket:

Note below that even after skipping black in the lint goal, it is in the associated list and marked "succeeded". In reality, it should be failing if it's actually running. In 2.11, black just wouldn't be shown in that list. Personally, I think "black skipped" in yellow text might make more sense, but 🤷🏽

@thejcannon
Copy link
Member Author

thejcannon commented May 15, 2022

./pants -lerror --black-skip fmt ::

✓ autoflake made no changes.
✓ docformatter made no changes.
✓ google-java-format made no changes.
✓ isort made no changes.
✓ scalafmt made no changes.
✓ shfmt made no changes.

@thejcannon
Copy link
Member Author

✕ src/python/pants/backend/python/goals/tailor_test.py:tests failed in 5.42s.

wack

@thejcannon
Copy link
Member Author

✕ src/python/pants/backend/python/goals/tailor_test.py:tests failed in 5.42s.

wack

And then it passes. Flaky?

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -286,7 +286,8 @@ async def fmt_language(language_fmt_request: _LanguageFmtRequest) -> _LanguageFm
continue
result = await Get(FmtResult, FmtRequest, request)
results.append(result)
prior_formatter_result = result.output
if not result.skipped:
prior_formatter_result = result.output
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I don't think it matters much how Skip is factored, as long we don't waste time trying to run it etc

@thejcannon thejcannon merged commit 7c1c964 into pantsbuild:main May 15, 2022
@thejcannon thejcannon deleted the fix15406 branch May 15, 2022 20:56
Eric-Arellano pushed a commit to Eric-Arellano/pants that referenced this pull request May 23, 2022
…antsbuild#15483)

Fixes pantsbuild#15406 by not piping a skipped formatter result into the next formatter.

[ci skip-rust]
[ci skip-build-wheels]
Eric-Arellano added a commit that referenced this pull request May 23, 2022
…herry-pick of #15483) (#15602)

Don't give a subsequent formatter an empty snapshot after skipping (#15483)

Fixes #15406 by not piping a skipped formatter result into the next formatter.

[ci skip-rust]
[ci skip-build-wheels]

Co-authored-by: Joshua Cannon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:bugfix Bug fixes for released features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--black-skip breaks fmt goal on isort exception
3 participants