Skip to content

[Merged by Bors] - chore(Cache): use createDirAll - #21705

Closed
joneugster wants to merge 2 commits into
masterfrom
eugster/cache_use_createDirAll
Closed

joneugster wants to merge 2 commits into
masterfrom
eugster/cache_use_createDirAll

Conversation

@joneugster

@joneugster joneugster commented Feb 11, 2025 •

Copy link
Copy Markdown
Member

The additional check if !(← path.pathExists) then is superfluous as createDirAll already handles existing directories itself.


Open in Gitpod

@joneugster joneugster added easy < 20s of review time. See the lifecycle page for guidelines. t-meta Tactics, attributes or user commands labels Feb 11, 2025
@github-actions

github-actions Bot commented Feb 11, 2025 •

Copy link
Copy Markdown

PR summary cf13efe0a9

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- mkDir

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@grunweg

grunweg commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Can you try to ask on zulip if this detail of createDirAll is meant to be guaranteed/submit a docs PR mentioning this if so? I'd like to be sure we're not relying on unstable implementation details.

Apart from that, code changes LGTM.
maintainer delegate?

@github-actions

Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by grunweg.

@github-actions github-actions Bot added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Feb 11, 2025
@joneugster

Copy link
Copy Markdown
Member Author

IO.FS.createDirAll has been added by @Kha 4 years ago and has not been modified once since. I'm pretty confident it's written the way it's intended to be. (EDITED PR description)

Moreover, looking at the source code, it uses try-except for each creation, which also shows that it is deliberately accepting existing directories.

partial def createDirAll (p : FilePath) : IO Unit := do
  if ← p.isDir then
    return ()
  if let some parent := p.parent then
    createDirAll parent
  try
    createDir p
  catch
    | e =>
      if ← p.isDir then
        pure ()  -- I guess someone else was faster
      else
        throw e

@adomani

adomani commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Thanks, I also tested this one locally and it seems to work.

I am going to delegate, but could you wait until the other changes to Cache have been merged and "tested" on master? I am a little conscious of touching similar files in different places and creating tangles that might be hard to debug in case something goes wrong!

bors d+

@mathlib-bors

mathlib-bors Bot commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

✌️ joneugster can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Feb 11, 2025

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

bors merge

Thanks!

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Feb 11, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Feb 11, 2025
The additional check `if !(← path.pathExists) then` is superfluous as `createDirAll` already handles existing directories itself.
@eric-wieser

Copy link
Copy Markdown
Member

bors r-

whoops

@mathlib-bors

mathlib-bors Bot commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Canceled.

@ghost ghost removed ready-to-merge This PR has been sent to bors. delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). labels Feb 11, 2025
@joneugster

Copy link
Copy Markdown
Member Author

bors r+

@adomani

adomani commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

The bot removed the labels "in the wild"!!

mathlib-bors Bot pushed a commit that referenced this pull request Feb 11, 2025
The additional check `if !(← path.pathExists) then` is superfluous as `createDirAll` already handles existing directories itself.
@mathlib-bors

mathlib-bors Bot commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title chore(Cache): use createDirAll [Merged by Bors] - chore(Cache): use createDirAll Feb 11, 2025
@mathlib-bors mathlib-bors Bot closed this Feb 11, 2025
@mathlib-bors
mathlib-bors Bot deleted the eugster/cache_use_createDirAll branch February 11, 2025 21:57
@joneugster

Copy link
Copy Markdown
Member Author

The bot removed the labels "in the wild"!!

Was it intentional that it removed delegated too?

Sorry if I merged now too early, I've slowly added one delegated PR at a time, merging master in-between

@adomani

adomani commented Feb 12, 2025

Copy link
Copy Markdown
Contributor

The bot is expected to remove both labels, but I do not know what Eric's intention was with bors r-.

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

Labels

easy < 20s of review time. See the lifecycle page for guidelines. t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants