Skip to content

[anneal][v2] Initial commit#3376

Open
joshlf wants to merge 1 commit into
mainfrom
G34qjom3lz7cc6hd57tgp44t4pzlstdhj
Open

[anneal][v2] Initial commit#3376
joshlf wants to merge 1 commit into
mainfrom
G34qjom3lz7cc6hd57tgp44t4pzlstdhj

Conversation

@joshlf
Copy link
Copy Markdown
Member

@joshlf joshlf commented May 15, 2026

Co-authored-by: Mark Dittmer markdittmer@google.com


Latest Update: v6 — Compare vs v5

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v5 v4 v3 v2 v1 Base
v6 vs v5 vs v4 vs v3 vs v2 vs v1 vs Base
v5 vs v4 vs v3 vs v2 vs v1 vs Base
v4 vs v3 vs v2 vs v1 vs Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/G34qjom3lz7cc6hd57tgp44t4pzlstdhj && git checkout -b pr-G34qjom3lz7cc6hd57tgp44t4pzlstdhj FETCH_HEAD

Checkout

git fetch origin refs/heads/G34qjom3lz7cc6hd57tgp44t4pzlstdhj && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G34qjom3lz7cc6hd57tgp44t4pzlstdhj && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G34qjom3lz7cc6hd57tgp44t4pzlstdhj

Stacked PRs enabled by GHerrit.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.88%. Comparing base (be6f199) to head (1f95236).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3376   +/-   ##
=======================================
  Coverage   91.88%   91.88%           
=======================================
  Files          20       20           
  Lines        6076     6076           
=======================================
  Hits         5583     5583           
  Misses        493      493           

☔ 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.

@joshlf joshlf changed the title [anneal][v2] Atomic toolchain management via directory locking [anneal][v2] Initial commit May 15, 2026
@joshlf joshlf force-pushed the G34qjom3lz7cc6hd57tgp44t4pzlstdhj branch 4 times, most recently from 1652fd0 to af503ff Compare May 15, 2026 13:11
Copy link
Copy Markdown
Collaborator

@mdittmer mdittmer left a comment

Choose a reason for hiding this comment

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

Presumably the name foo is a pointer for us to finish bikeshedding on toolchain/toolchain-config/setup/install?

Comment thread anneal/v2/foo/src/sync.rs
Comment on lines +185 to +190
let entries: Vec<_> = fs::read_dir(temp.path())
.unwrap()
.map(|e| e.unwrap().file_name())
.filter(|n| n != ".dirlock")
.collect();
assert!(entries.is_empty());
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't understand the interaction between guard and these expectations. AFAICT, guard has not be dropped, so it's not clear to me why we would assert that it contains no lock file.

Comment thread anneal/v2/foo/src/sync.rs Outdated
populate: impl FnOnce(&Path) -> IoResult<()>,
) -> IoResult<()> {
let parent = guard.path();
assert_eq!(parent, dst.parent().expect("dst must have at least one ancestor"));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like a strange thing to assert. If I'm reading correctly, we require that the parameters be (guard, dst) = (Guard("/foo/bar"), Path("/foo/bar/baz")). There are a couple considerations:

  1. Is it not sufficient that IsAncestor(guard.dir, dst) (rather than IsParent(guard.dir, dst)?
  2. If we insist on IsParent(guard.dir, dst), then would it be more ergonomic to accept (guard, dst) = (Guard("/foo/bar"), Path("baz")) and have fully_qualified_dst = guard.dir.join(dst)? I suppose that would replace this check with some kind of IsSingleComponentPath(dst).

Comment thread anneal/v2/foo/src/sync.rs
let dst = Path::new("/");
let _ = install(&mut guard, dst, |_| Ok(()));
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If we're going to bother with multi-threaded and multi-process directory guards, we should probably test it! Could we have one or two stress tests that "fight over" the same path and ensure there's one clear winner?

Comment thread anneal/v2/foo/src/lib.rs Outdated
Comment thread anneal/v2/foo/src/lib.rs Outdated
Comment on lines +18 to +22
pub struct Config {
pub os: &'static str,
pub arch: &'static str,
pub url: &'static str,
pub sha256: [u8; 32],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please document pub items. In particular, there are details and relationships worth calling out:

  • os and arch correspond to rust stdlib consts
  • sha256 is the expected digest for file fetched at url

Comment thread anneal/v2/foo/src/lib.rs Outdated

/// Extracts the `.tar.zst` from `reader` and installs it at `dst`, optionally
/// validating its hash.
pub(crate) fn install(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What's the purpose of pub(crate) here? Is the intent that a pub wrapper will manage guard and dst (and use a Config for the rest of the parameters)? (Possibly said wrapper was going to be the commented-out associated functions on Config?)

@joshlf
Copy link
Copy Markdown
Member Author

joshlf commented May 15, 2026

Presumably the name foo is a pointer for us to finish bikeshedding on toolchain/toolchain-config/setup/install?

Exactly

Co-authored-by: Mark Dittmer <markdittmer@google.com>
gherrit-pr-id: G34qjom3lz7cc6hd57tgp44t4pzlstdhj
@joshlf joshlf force-pushed the G34qjom3lz7cc6hd57tgp44t4pzlstdhj branch from af503ff to 1f95236 Compare May 15, 2026 16:00
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.

3 participants