Reproduce full retained reboot ledger and qualify finite 1 GiB journal budget
Rust development slice / linux (push) Failing after 7s

This commit is contained in:
2026-11-13 22:09:25 +01:00
parent 4102b97fb9
commit 2c8e6519de
8 changed files with 318 additions and 25 deletions
+2 -2
View File
@@ -113,7 +113,7 @@ mod passive_pressure_tests {
super::prepare_dir(&dir).unwrap();
let mut db = super::open(&dir).unwrap();
assert_eq!(super::next_sequence(&mut db).unwrap(), 1);
db.execute_batch("PRAGMA max_page_count=16384").unwrap();
db.execute_batch("PRAGMA max_page_count=65536").unwrap();
drop(db);
let mut db = super::open(&dir).unwrap();
assert_eq!(
@@ -124,7 +124,7 @@ mod passive_pressure_tests {
assert_eq!(
db.query_row("PRAGMA max_page_count", [], |r| r.get::<_, u32>(0))
.unwrap(),
65536
262144
);
assert_eq!(super::next_sequence(&mut db).unwrap(), 2);
drop(db);
+3 -3
View File
@@ -204,14 +204,14 @@ pub fn lock_state(dir: &Path, uid: u32) -> Result<fs::File> {
f.try_lock_exclusive()?;
Ok(f)
}
/// Finite 256 MiB bound for durable agent/helper history. Unexpected page sizes
/// Finite 1 GiB bound for durable agent/helper history. Unexpected page sizes
/// are refused rather than silently multiplying the byte limit. No compaction
/// or tombstone deletion occurs here; SQLITE_FULL must still fail closed.
pub fn bounded_journal_capacity(db: &rusqlite::Connection) -> Result<()> {
let page_size: u32 = db.query_row("PRAGMA page_size", [], |r| r.get(0))?;
ensure!(page_size == 4096, "JOURNAL_PAGE_SIZE_UNSUPPORTED");
let maximum: u32 = db.query_row("PRAGMA max_page_count=65536", [], |r| r.get(0))?;
ensure!(maximum == 65536, "JOURNAL_STORAGE_CAPACITY_BLOCKED");
let maximum: u32 = db.query_row("PRAGMA max_page_count=262144", [], |r| r.get(0))?;
ensure!(maximum == 262144, "JOURNAL_STORAGE_CAPACITY_BLOCKED");
Ok(())
}
+2 -2
View File
@@ -96,7 +96,7 @@ fn journal_capacity_is_finite_and_retains_original_consumption_on_reopen() {
let original: Vec<u8> = db
.query_row("SELECT start FROM execution_evidence", [], |r| r.get(0))
.unwrap();
db.execute_batch("PRAGMA max_page_count=16384").unwrap();
db.execute_batch("PRAGMA max_page_count=65536").unwrap();
drop(db);
let mut db = open_ledger(&dir, uid).unwrap();
assert_eq!(
@@ -107,7 +107,7 @@ fn journal_capacity_is_finite_and_retains_original_consumption_on_reopen() {
assert_eq!(
db.query_row("PRAGMA max_page_count", [], |r| r.get::<_, u32>(0))
.unwrap(),
65536
262144
);
let preserved: (String, Option<Vec<u8>>, Vec<u8>) = db.query_row("SELECT c.grant_id,c.result,e.start FROM consumed c JOIN execution_evidence e USING(grant_id)", [], |r|Ok((r.get(0)?,r.get(1)?,r.get(2)?))).unwrap();
assert_eq!(preserved, (permit.grant_id.to_string(), None, original));