Fix platform-matrix watchdog check: exact manifest suffix match (Sam & Claude)
read_manifest used a loose `filename.contains(manifest_type)` substring match, so for host=osa type=watchdog-host-status it nondeterministically grabbed either `…watchdog-host-status.json` (correct, has `.status`) or its sibling `…watchdog-host-status-run-manifest.json` (no `.status`). When the run-manifest won the read_dir race, source/mode read as "unknown" and the FreeBSD watchdog-socket-read row failed (11/12). Match the exact `<host>-<manifest_type>.json` suffix and pick the lexically greatest (most-recent dated) filename, so selection is deterministic and the run-manifest sibling is excluded. The underlying watchdog data was always correct; this was a false failure from loose fixture matching. cargo test --workspace: all green. cargo clippy --all-targets -D warnings: clean. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
07d04efa8a
commit
b325c38f31
1 changed files with 16 additions and 15 deletions
|
|
@ -18,21 +18,22 @@ struct PlatformTest {
|
|||
|
||||
fn read_manifest(host: &str, manifest_type: &str) -> Option<serde_json::Value> {
|
||||
let manifest_dir = Path::new("manifests");
|
||||
// Find the most recent matching manifest
|
||||
if let Ok(entries) = fs::read_dir(manifest_dir) {
|
||||
for entry in entries.flatten() {
|
||||
if let Ok(filename) = entry.file_name().into_string() {
|
||||
if filename.contains(host) && filename.contains(manifest_type) {
|
||||
if let Ok(content) = fs::read_to_string(entry.path()) {
|
||||
if let Ok(json) = serde_json::from_str::<serde_json::Value>(&content) {
|
||||
return Some(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
// Match the exact `<host>-<manifest_type>.json` suffix so a loose substring
|
||||
// does not also grab a sibling like `…watchdog-host-status-run-manifest.json`
|
||||
// (which has no `.status`). Collect all matches and pick the lexically
|
||||
// greatest filename — dated `YYYY-MM-DD-` prefixes sort to "most recent" —
|
||||
// so the result is deterministic regardless of `read_dir` ordering.
|
||||
let suffix = format!("{}-{}.json", host, manifest_type);
|
||||
let mut matches: Vec<_> = fs::read_dir(manifest_dir)
|
||||
.ok()?
|
||||
.flatten()
|
||||
.filter_map(|entry| entry.file_name().into_string().ok().map(|n| (n, entry.path())))
|
||||
.filter(|(name, _)| name.ends_with(&suffix))
|
||||
.collect();
|
||||
matches.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
let (_, path) = matches.last()?;
|
||||
let content = fs::read_to_string(path).ok()?;
|
||||
serde_json::from_str::<serde_json::Value>(&content).ok()
|
||||
}
|
||||
|
||||
fn test_deepseek_cache_probe(platform: &str, host: &str) -> PlatformTest {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue