Merge branch 't3/fix-github-check-failures': what GitHub's run on 8a6d731c3 found
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
commit
ef1d6e573a
7 files changed
+57
-44
No files matched your search
@@ -1209,10 +1209,17 @@ fn shim_git(home: &Home) -> PathBuf {
|
|||||||
/// Whether process `pid` is still there.
|
/// Whether process `pid` is still there.
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn alive(pid: u32) -> bool {
|
fn alive(pid: u32) -> bool {
|
||||||
std::path::Path::new(&format!("/proc/{pid}")).exists()
|
// `ps` on Linux and macOS alike (there is no /proc on macOS, where a
|
||||||
&& std::fs::read_to_string(format!("/proc/{pid}/stat"))
|
// test of "is it gone" would pass whatever the server had done): its
|
||||||
.map(|s| !s.contains(") Z "))
|
// state is empty for a process that isn't there, and starts with Z for
|
||||||
.unwrap_or(false)
|
// one that has ended and is not yet reaped.
|
||||||
|
let out = std::process::Command::new("ps")
|
||||||
|
.args(["-o", "stat=", "-p", &pid.to_string()])
|
||||||
|
.output()
|
||||||
|
.expect("ps runs");
|
||||||
|
let state = String::from_utf8_lossy(&out.stdout);
|
||||||
|
let state = state.trim();
|
||||||
|
!state.is_empty() && !state.starts_with('Z')
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The server, with the stand-in git first on its PATH.
|
/// The server, with the stand-in git first on its PATH.
|
||||||
@@ -2556,12 +2563,18 @@ fn fsck_of(repo: &std::path::Path) {
|
|||||||
fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_backup_succeeds() {
|
fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_backup_succeeds() {
|
||||||
let home = Home::new("close-git-locks");
|
let home = Home::new("close-git-locks");
|
||||||
let shim = slow_real_git(&home);
|
let shim = slow_real_git(&home);
|
||||||
|
// The close's bound lapses with git held inside its ref update, and
|
||||||
|
// what the test proves needs git to have got there first: the bound is
|
||||||
|
// long enough for the slowest machine to run every git before the
|
||||||
|
// update (a push, on a macOS runner, comes after a dozen of them and
|
||||||
|
// took longer than 1.5 s), as in the test of a lock a kill leaves. The
|
||||||
|
// hook holds git until the bound ends it, so each close takes the bound.
|
||||||
let server = server_with_shim(
|
let server = server_with_shim(
|
||||||
&home,
|
&home,
|
||||||
&shim,
|
&shim,
|
||||||
&[
|
&[
|
||||||
"--close-backup",
|
"--close-backup",
|
||||||
"1500",
|
"8000",
|
||||||
"--backup-quiet",
|
"--backup-quiet",
|
||||||
"3600000",
|
"3600000",
|
||||||
"--timers",
|
"--timers",
|
||||||
@@ -2592,7 +2605,7 @@ fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_back
|
|||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
shim.join("hooked").exists(),
|
shim.join("hooked").exists(),
|
||||||
"git never reached its ref update"
|
"git never reached its ref update before the close's bound ran out: {outcome:?}"
|
||||||
);
|
);
|
||||||
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
||||||
assert!(
|
assert!(
|
||||||
@@ -2629,7 +2642,7 @@ fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_back
|
|||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
shim.join("hooked").exists(),
|
shim.join("hooked").exists(),
|
||||||
"git never reached its ref update"
|
"git never reached its ref update before the close's bound ran out: {outcome:?}"
|
||||||
);
|
);
|
||||||
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
||||||
assert!(
|
assert!(
|
||||||
@@ -2665,7 +2678,7 @@ fn a_close_that_stops_git_in_a_commit_or_a_push_leaves_no_lock_and_the_next_back
|
|||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
shim.join("hooked").exists(),
|
shim.join("hooked").exists(),
|
||||||
"git never reached its ref update"
|
"git never reached its ref update before the close's bound ran out: {outcome:?}"
|
||||||
);
|
);
|
||||||
assert_eq!(locks_under(&target), Vec::<String>::new());
|
assert_eq!(locks_under(&target), Vec::<String>::new());
|
||||||
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
assert_eq!(locks_under(&archive), Vec::<String>::new());
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ fn books_that_keep_their_settings_say_where_facts_come_from() {
|
|||||||
let h = company(&dir);
|
let h = company(&dir);
|
||||||
assert!(shows(
|
assert!(shows(
|
||||||
&h,
|
&h,
|
||||||
"No company facts set yet: the agent records them as you give them."
|
"No company facts set yet: your assistant records them as you give them."
|
||||||
));
|
));
|
||||||
drop(h);
|
drop(h);
|
||||||
let mut s = Store::open(&dir.0.join("books-data")).unwrap();
|
let mut s = Store::open(&dir.0.join("books-data")).unwrap();
|
||||||
|
|||||||
@@ -2700,10 +2700,10 @@ fn the_docks_height_and_layout_are_the_apps_one_for_every_tab() {
|
|||||||
h.state_mut().view_mut(i).unwrap().dock_mut().open = true;
|
h.state_mut().view_mut(i).unwrap().dock_mut().open = true;
|
||||||
}
|
}
|
||||||
h.run_steps(4);
|
h.run_steps(4);
|
||||||
let top = |h: &Harness<'_, App>| h.get_by_label_contains(" Agent").rect().top();
|
let top = |h: &Harness<'_, App>| h.get_by_label_contains(" Assistant").rect().top();
|
||||||
let before = top(&h);
|
let before = top(&h);
|
||||||
// Resized in alpha: dragged up by a hundred points.
|
// Resized in alpha: dragged up by a hundred points.
|
||||||
let x = h.get_by_label_contains(" Agent").rect().left() + 300.0;
|
let x = h.get_by_label_contains(" Assistant").rect().left() + 300.0;
|
||||||
let panel_top = egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new("dock-open"))
|
let panel_top = egui::containers::panel::PanelState::load(&h.ctx, egui::Id::new("dock-open"))
|
||||||
.expect("the dock's panel")
|
.expect("the dock's panel")
|
||||||
.outer_rect
|
.outer_rect
|
||||||
|
|||||||
@@ -992,6 +992,23 @@ impl Drop for CloseGuard {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The test knob `--timer-hold`: say in `run/timer-held` that `name` is
|
||||||
|
/// held, as one line. The line, its newline included, goes out in one
|
||||||
|
/// `write` on a file opened for append: `writeln!` on a `File` is a write
|
||||||
|
/// for the name and another for the newline, so two writers (the sweep and
|
||||||
|
/// the backup, on a loaded machine) could interleave and leave "backupsweep"
|
||||||
|
/// and an empty line where each was to say its own name.
|
||||||
|
fn say_held(run: &std::path::Path, name: &str) {
|
||||||
|
use std::io::Write;
|
||||||
|
if let Ok(mut said) = std::fs::OpenOptions::new()
|
||||||
|
.create(true)
|
||||||
|
.append(true)
|
||||||
|
.open(run.join("timer-held"))
|
||||||
|
{
|
||||||
|
let _ = said.write_all(format!("{name}\n").as_bytes());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Books {
|
impl Books {
|
||||||
/// A server's books for `root`, none held yet.
|
/// A server's books for `root`, none held yet.
|
||||||
fn new(
|
fn new(
|
||||||
@@ -1097,16 +1114,7 @@ impl Books {
|
|||||||
let flag = flag.clone();
|
let flag = flag.clone();
|
||||||
stop.with_phase_watch(Arc::new(move |phase: &str| {
|
stop.with_phase_watch(Arc::new(move |phase: &str| {
|
||||||
let name = format!("{job}:{phase}");
|
let name = format!("{job}:{phase}");
|
||||||
{
|
say_held(&run, &name);
|
||||||
use std::io::Write;
|
|
||||||
if let Ok(mut said) = std::fs::OpenOptions::new()
|
|
||||||
.create(true)
|
|
||||||
.append(true)
|
|
||||||
.open(run.join("timer-held"))
|
|
||||||
{
|
|
||||||
let _ = writeln!(said, "{name}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let held = || {
|
let held = || {
|
||||||
std::fs::read_to_string(run.join("timer-hold"))
|
std::fs::read_to_string(run.join("timer-hold"))
|
||||||
.is_ok_and(|names| names.split(',').any(|n| n.trim() == name))
|
.is_ok_and(|names| names.split(',').any(|n| n.trim() == name))
|
||||||
@@ -1128,16 +1136,7 @@ impl Books {
|
|||||||
let Ok(run) = self.root.run_dir() else {
|
let Ok(run) = self.root.run_dir() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
{
|
say_held(&run, timer);
|
||||||
use std::io::Write;
|
|
||||||
if let Ok(mut said) = std::fs::OpenOptions::new()
|
|
||||||
.create(true)
|
|
||||||
.append(true)
|
|
||||||
.open(run.join("timer-held"))
|
|
||||||
{
|
|
||||||
let _ = writeln!(said, "{timer}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Held while the file names this timer (a list, comma-separated).
|
// Held while the file names this timer (a list, comma-separated).
|
||||||
let held = || {
|
let held = || {
|
||||||
std::fs::read_to_string(run.join("timer-hold"))
|
std::fs::read_to_string(run.join("timer-hold"))
|
||||||
@@ -1315,16 +1314,7 @@ impl Books {
|
|||||||
let flag = shared.hurry_flag();
|
let flag = shared.hurry_flag();
|
||||||
backups.set_hold(Arc::new(move |call: &str| {
|
backups.set_hold(Arc::new(move |call: &str| {
|
||||||
let name = format!("call:{call}");
|
let name = format!("call:{call}");
|
||||||
{
|
say_held(&run, &name);
|
||||||
use std::io::Write;
|
|
||||||
if let Ok(mut said) = std::fs::OpenOptions::new()
|
|
||||||
.create(true)
|
|
||||||
.append(true)
|
|
||||||
.open(run.join("timer-held"))
|
|
||||||
{
|
|
||||||
let _ = writeln!(said, "{name}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let held = || {
|
let held = || {
|
||||||
std::fs::read_to_string(run.join("timer-hold"))
|
std::fs::read_to_string(run.join("timer-hold"))
|
||||||
.is_ok_and(|names| names.split(',').any(|n| n.trim() == name))
|
.is_ok_and(|names| names.split(',').any(|n| n.trim() == name))
|
||||||
|
|||||||
@@ -520,7 +520,11 @@ pub(super) fn valid_redirect(text: &str) -> Option<reqwest::Url> {
|
|||||||
/// than the table keeps (a registration is held in memory, and in the file
|
/// than the table keeps (a registration is held in memory, and in the file
|
||||||
/// once the person has allowed it).
|
/// once the person has allowed it).
|
||||||
pub(super) fn redirects_fit(redirects: &[String]) -> bool {
|
pub(super) fn redirects_fit(redirects: &[String]) -> bool {
|
||||||
redirects.iter().map(String::len).sum::<usize>() <= MAX_REDIRECTS_TOTAL
|
// A fold, not `Iterator::sum`: kernel-only keeps `sum` for the kernel.
|
||||||
|
redirects
|
||||||
|
.iter()
|
||||||
|
.fold(0usize, |total, r| total.saturating_add(r.len()))
|
||||||
|
<= MAX_REDIRECTS_TOTAL
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What a redirect address shows the person: its host, or its scheme.
|
/// What a redirect address shows the person: its host, or its scheme.
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
//!
|
//!
|
||||||
//! The lines between a begin and its close count only if the close says
|
//! The lines between a begin and its close count only if the close says
|
||||||
//! `ok`: that is how a reader tells a complete call from an incomplete
|
//! `ok`: that is how a reader tells a complete call from an incomplete
|
||||||
//! one, and the one rule every reader applies ([`CallGate`], [`standings`],
|
//! one, and the one rule every reader applies (`CallGate`, [`standings`],
|
||||||
//! [`committed`]). Ids are handed out again after a failed call (nothing
|
//! [`committed`]). Ids are handed out again after a failed call (nothing
|
||||||
//! it wrote counted), so a reader that takes the journal raw would pin the
|
//! it wrote counted), so a reader that takes the journal raw would pin the
|
||||||
//! dead lines of a failed call on whatever takes the id next: every reader
|
//! dead lines of a failed call on whatever takes the id next: every reader
|
||||||
|
|||||||
@@ -148,7 +148,13 @@ fuzz_target!(|r: Request| {
|
|||||||
.into_bytes()
|
.into_bytes()
|
||||||
}
|
}
|
||||||
Body::Call { tool, arguments } => {
|
Body::Call { tool, arguments } => {
|
||||||
let args = serde_json::from_str::<serde_json::Value>(arguments).unwrap_or_default();
|
let mut args = serde_json::from_str::<serde_json::Value>(arguments).unwrap_or_default();
|
||||||
|
// Every write needs a request key (D-88): without one the
|
||||||
|
// fuzzer would only ever meet the refusal, never the tool.
|
||||||
|
// This door's request count is unique for its book.
|
||||||
|
if let Some(a) = args.as_object_mut() {
|
||||||
|
a.entry("request_key").or_insert_with(|| format!("fuzz-key-{n:08}").into());
|
||||||
|
}
|
||||||
serde_json::json!({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
|
serde_json::json!({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
|
||||||
"params": {"name": TOOLS[*tool as usize % TOOLS.len()], "arguments": args}})
|
"params": {"name": TOOLS[*tool as usize % TOOLS.len()], "arguments": args}})
|
||||||
.to_string()
|
.to_string()
|
||||||
|
|||||||
Reference in new issue
Block a user