Skip to content

[WIP] tidy: skip triagebot.toml path checks for local submodule directories that we can't read #139860

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

Closed
wants to merge 1 commit into from

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Apr 15, 2025

Fixes #139856 where tidy fails locally if some submodules are not checked out as part of triagebot.toml path existence checks (initially implemented in #137885 to help detect broken triagebot.toml paths).

I say "unchecked out", but really it's an extremely naive heuristic of "don't bother checking paths to or under a submodule if we can't even read the submodule dir".

I'm not happy about this implementation because it's quite convoluted.

Testing

You can test this locally by:

  • First set build.submodules = true to be able to successfully run ./x test tidy.
  • Set build.submodules = false.
  • Explicitly deinit a submodule, e.g. src/tools/enzyme.
  • Change or add a [mentions] path to e.g. src/tools/enzyme/xd, observe no tidy error is emitted.
  • CHange or add a [mentions] path to non-submodule, e.g. xd, observe a tidy error is emitted.

Alternatives

Honestly, I'm also kinda tempted to just either:

  1. Gate this check as CI-only, or even
  2. Remove this check entirely.

But I suppose other options are:

Review advice

  • Can't assume git exists
  • More than happy to hear better solutions

cc @Kobzol @onur-ozkan for opinions

r? bootstrap

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 15, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Apr 15, 2025

The implementation looks fine to me. I have just one question.

What is "Vacuously"?

@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 15, 2025

The implementation looks fine to me. I have just one question.

What is "Vacuously"?

I guess I just wanted to say we don't know if it exists or not, we just don't actually check it and instead simply skip it, I can reword that a bit lol

…locally

I say "unchecked out", but really it's an extremely naive heuristic of
"don't bother checking paths to or under a submodule if we can't even
read the submodule dir".
@Kobzol
Copy link
Contributor

Kobzol commented Apr 15, 2025

I just found the word funny xD

I tried it locally, but it seems like tidy doesn't even get that far?

./x test tidy
Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.06s
submodule library/backtrace does not appear to be checked out, but it is required for this step
Consider setting `build.submodules = true` or manually initializing the submodules.

@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 15, 2025

Oh right, sorry, it's because I have like an partially initialized set of submodules... I.e. what I did was to first build.submodule = true to be able to run ./x test tidy, and then manually git submodule deinit src/tools/enzyme, then introduce a src/tools/enzyme/xd mentions path that's invalid. I updated the repro steps, hopefully you can also repro.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 15, 2025

Right, I was just wondering how common is that? Do people run tidy without initialized submodules? It would mean that they would need to manually initialize certain modules otherwise required to run tidy - do you think that's common? Furthermore, it looks like tidy already breaks without some submodules, so this check only solves a part of the issue.

@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 15, 2025

Right, I was just wondering how common is that? Do people run tidy without initialized submodules? It would mean that they would need to manually initialize certain modules otherwise required to run tidy - do you think that's common? Furthermore, it looks like tidy already breaks without some submodules, so this check only solves a part of the issue.

Yeah that is a good point, I wouldn't expect this configuration to be super common. I.e. this PR only kinda mitigates the problem for triagebot checks, but tidy probably will still fail on other checks.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 15, 2025

Based on that, I'm not completely sure if it's super worth it, but it's not a lot of code, so fine by me. You can r=me once CI is green if you want to land it, up to you.

@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 15, 2025

Tbh I don't want to land this as-is because I don't feel the complexity pulls its weight. Maybe just don't run this locally?

@jieyouxu
Copy link
Member Author

Update: okay so I asked Waffle for extra clarifications (it's not submodules = false), apparently it's because jj git clone doesn't create empty subdirectories for git submodules like git does, because jj's submodule support is not yet completed

The tool is fairly feature-complete, but some important features like support for Git submodules are not yet completed.

In that sense, I think this is the wrong approach (and even if we wanted to mitigate this for jj purposes I'd at most only skip locally), so I'm going to close this.

@jieyouxu jieyouxu closed this Apr 15, 2025
@jieyouxu jieyouxu deleted the tidy-trigger branch April 15, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tidy triagebot.toml trigger_files fails on jj git clone unchecked out submodules
4 participants