Watch
0
0
Fork
You've already forked hyperhive
0

keep the mirror hint off forge errors, forward the hyperhive mirror from any controller host

This commit is contained in:
atlas 2026-11-09 13:07:41 +01:00
commit 52cdfe84a0

View file

@ -374,8 +374,7 @@ async fn hyperhive_pin(
let Some(flake) = committed_flake else {
let head = forge
.head_files(HYPERHIVE_OWNER, HYPERHIVE_REPO, None, &[])
.await
.with_context(missing_hyperhive)?
.await?
.with_context(missing_hyperhive)?;
return Ok(HyperhivePin {
rev: head.commit,
@ -575,6 +574,8 @@ mod tests {
compares: Mutex<Vec<(String, String)>>,
/// Every compare fails, as a forge that is down does.
compare_fails: bool,
/// Reads of this `owner/repo` fail, as on a forge that refuses or is down.
head_fails: Option<String>,
/// Every `head_files` read, as `("owner/repo", branch)`.
head_reads: Mutex<Vec<(String, Option<String>)>>,
}
@ -603,6 +604,9 @@ mod tests {
branch: Option<&str>,
paths: &[&str],
) -> Result<Option<DefaultBranchFiles>> {
if self.head_fails.as_deref() == Some(&format!("{owner}/{repo}")) {
anyhow::bail!("forge answered 503");
}
self.head_reads
.lock()
.unwrap()
@ -874,6 +878,25 @@ mod tests {
assert!(forge.commits.lock().unwrap().is_empty());
}
#[tokio::test]
async fn a_forge_error_reading_hyperhive_does_not_carry_the_mirror_hint() {
let mut forge = forge_with(&[]);
forge.head_fails = Some("hyperhive/hyperhive".to_owned());
let err = update(
&forge,
&FakeLocker::locked(),
&settings(),
None,
&argus_and_reviewer(),
&[],
)
.await
.unwrap_err();
let err = format!("{err:#}");
assert!(err.contains("forge answered 503"), "{err}");
assert!(!err.contains("hyperhiveUpstream"), "{err}");
}
#[tokio::test]
async fn a_refused_lock_commits_nothing() {
let forge = forge_with(&[]);