fix(headless): wait for memcard bootstrap IO progress
Intrepid/Prometeu/Runtime/pipeline/head There was a failure building this commit

Coordinate bounded native publication progress during frame advance while preserving watchdogs, guest budgets and resource ownership. Add controlled and packaged reopen regressions, clarify the runtime specs, and retain qualification evidence.
This commit is contained in:
2026-11-10 23:26:40 +00:00
parent 49d7fca0b7
commit c3589be1ad
34 changed files with 5904 additions and 5 deletions
@@ -844,6 +844,15 @@ fn packaged_installation_smoke() {
c.wait_exit();
}
#[test]
#[ignore = "requires PROMETEU_PROTOCOL_TEST_INSTALL pointing to an isolated installation"]
fn packaged_memcard_reopen_first_frame() {
let installation = PathBuf::from(
std::env::var_os("PROMETEU_PROTOCOL_TEST_INSTALL").expect("set isolated installation path"),
);
memcard_process::presentation_reopen(&installation.join("prometeu"));
}
#[test]
#[ignore = "requires PROMETEU_PROTOCOL_TEST_INSTALL pointing to an isolated installation"]
fn packaged_native_log_observation() {
@@ -102,6 +102,63 @@ fn persistence(binary: &Path) {
assert!(fs::read(&image).unwrap() == bytes);
}
pub(super) fn presentation_reopen(binary: &Path) {
let root = TempDir::new();
let image = root.0.join("presentation-reopen.pmc");
let write = card(MemcardFixture::Write, "1");
let mut writer = start_at(binary);
mount(&mut writer, &image, "create", "read_write");
launch(&mut writer, &write, "persistent");
oracle(&mut writer, 101);
assert_eq!(writer.ok("get_memcard_state", json!({}))["dirty"], false);
writer.close();
for version in ["1", "2"] {
let read = card(MemcardFixture::ReadWithPresentation, version);
let mut reader = start_at(binary);
mount(&mut reader, &image, "open", "read_write");
launch(&mut reader, &read, "persistent");
let booted = reader.ok("get_state", json!({}));
assert_eq!(booted["pc"], 0);
assert_eq!(booted["tickIndex"], 0);
assert_eq!(booted["logicalFrameIndex"], 0);
// Exactly one command owns the first frame; there is no oracle retry.
let advanced = reader.ok("advance", json!({"frames":1}));
assert_eq!(advanced, json!({"requested":1,"completed":1,"stop":"completed"}));
let state = reader.ok("get_state", json!({}));
assert_eq!(state["logicalFrameIndex"], 1);
assert_eq!(state["tickIndex"], 2);
assert_eq!(state["status"], "paused");
assert_eq!(state["appId"], 4294967295u32);
assert_eq!(state["stackTop"].as_array().unwrap().last().unwrap()["value"], "201");
assert_eq!(reader.ok("get_fault", json!({})), Value::Null);
let media = reader.ok("get_memcard_state", json!({}));
assert_eq!(
media["request"],
Value::Null,
"presentation must finish without a payload save"
);
assert_eq!(media["io"]["active"], false);
assert_eq!(media["dirty"], false);
assert_eq!(reader.ok("capture", json!({}))["logicalFrameIndex"], 1);
reader.close();
}
// Preserve the original reader's independent read-without-writing oracle.
let bytes = fs::read(&image).unwrap();
let read = card(MemcardFixture::Read, "2");
let mut reader = start_at(binary);
mount(&mut reader, &image, "open", "read_write");
launch(&mut reader, &read, "persistent");
oracle(&mut reader, 201);
reader.close();
assert_eq!(fs::read(&image).unwrap(), bytes);
}
#[test]
fn memcard_reopen_presentation_completes_exactly_one_first_frame() {
presentation_reopen(Path::new(env!("CARGO_BIN_EXE_prometeu")));
}
#[test]
fn memcard_public_distinct_process_save_readback_and_version_identity() {
persistence(Path::new(env!("CARGO_BIN_EXE_prometeu")));