summaryrefslogtreecommitdiffstats
path: root/tests/db.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:33:17 +0000
commit4304b0f336ddba7b4ec6780795059ff2066d105b (patch)
tree10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /tests/db.rs
parente757979f1a2afdbe7146066345bb9acd19d3b151 (diff)
downloadaur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz
aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its arguments or fields, or cited the design docs (§n, I-n, m-n, decision n). 2247 comments down to 83. What survives: the section dividers that segment the large modules, the secret-handling warnings, the agent wire-frame directions, and the few notes without which the code they attach to reads as redundant, reorderable, or unsound.
Diffstat (limited to 'tests/db.rs')
-rw-r--r--tests/db.rs14
1 files changed, 0 insertions, 14 deletions
diff --git a/tests/db.rs b/tests/db.rs
index 31f4326..ea8c4de 100644
--- a/tests/db.rs
+++ b/tests/db.rs
@@ -35,7 +35,6 @@ fn migrations_apply_from_empty_and_are_idempotent() {
})
.unwrap();
assert_eq!(v as usize, db::MIGRATIONS.len(), "all migrations applied");
- // Re-running migration over an existing DB is a no-op, not an error.
assert_eq!(db::migrate(&env.cfg.db_path()).unwrap(), 0);
let journal: String = env
.db
@@ -54,7 +53,6 @@ fn default_settings_are_seeded() {
assert_eq!(db::setting_i64(&env.db, "retention_versions", 0), 5);
}
-/// I7: a pkgbase has at most one open review, enforced by a partial unique index.
#[test]
fn i7_second_open_review_is_rejected_by_the_database() {
let env = Env::new();
@@ -67,7 +65,6 @@ fn i7_second_open_review_is_rejected_by_the_database() {
});
assert!(err.is_err(), "second pending_review must fail");
- // A terminal state frees the slot again.
insert_candidate(&env, pb, snap2, "id-2", "rejected");
let n: Option<i64> = env.query_i64(
"SELECT count(*) FROM candidate WHERE pkgbase_id=?1",
@@ -76,7 +73,6 @@ fn i7_second_open_review_is_rejected_by_the_database() {
assert_eq!(n, Some(2));
}
-/// Same identity for the same pkgbase must never create a second candidate (I3).
#[test]
fn candidate_identity_is_unique_per_pkgbase() {
let env = Env::new();
@@ -88,7 +84,6 @@ fn candidate_identity_is_unique_per_pkgbase() {
assert!(res.is_err(), "UNIQUE(pkgbase_id, identity_hash) must hold");
}
-/// I10: every state transition is recorded, and the log cannot be rewritten.
#[test]
fn audit_log_is_append_only() {
let env = Env::new();
@@ -106,11 +101,9 @@ fn audit_log_is_append_only() {
std::panic::catch_unwind(|| env.exec("DELETE FROM audit WHERE id=?1", &params(vec![id]))).is_err(),
"audit DELETE must be refused by trigger"
);
- // Inserts keep working.
db::audit_system(&env.db.writer, "test2", "pkgbase", "1", serde_json::json!({})).unwrap();
}
-/// §16: concurrent approvals on the same pkgbase are a guarded compare-and-swap.
#[test]
fn accepted_release_pointer_is_compared_and_swapped() {
let env = Env::new();
@@ -129,7 +122,6 @@ fn accepted_release_pointer_is_compared_and_swapped() {
Ok(tx.last_insert_rowid())
})
.unwrap();
- // First swap from NULL wins, second loses.
assert!(db::cas_accepted_release(&env.db.writer, pb, None, rel).unwrap());
assert!(!db::cas_accepted_release(&env.db.writer, pb, None, rel).unwrap());
assert_eq!(
@@ -138,7 +130,6 @@ fn accepted_release_pointer_is_compared_and_swapped() {
);
}
-/// §11a: WAL lets readers proceed concurrently with the writer.
#[test]
fn many_readers_do_not_block_the_writer() {
let env = std::sync::Arc::new(Env::new());
@@ -166,7 +157,6 @@ fn many_readers_do_not_block_the_writer() {
.unwrap(),
);
}
- // Write while they read: none of these may fail with SQLITE_BUSY.
for i in 0..200 {
db::set_setting(&env.db.writer, &format!("k{i}"), "1").unwrap();
}
@@ -180,7 +170,6 @@ fn world_snapshot_dedupes_by_hash() {
let env = Env::new();
let m = |b: &str, v: &str| db::WorldMember { pkgbase: b.into(), version: v.into() };
let a = db::put_world_snapshot(&env.db.writer, &[m("foo", "1-1"), m("bar", "2-1")]).unwrap();
- // Order-insensitive: same set, same snapshot.
let b = db::put_world_snapshot(&env.db.writer, &[m("bar", "2-1"), m("foo", "1-1")]).unwrap();
assert_eq!(a, b);
let members = db::world_members(&env.db, a).unwrap();
@@ -199,7 +188,6 @@ fn duplicate_open_notices_are_suppressed() {
assert!(db::put_notice_once(&env.db.writer, pb, "pin_drift", "info", detail.clone())
.unwrap()
.is_none());
- // Acknowledging lets a fresh one through.
let id = env
.query_i64("SELECT id FROM notice ORDER BY id DESC LIMIT 1", &[])
.unwrap();
@@ -213,7 +201,6 @@ fn duplicate_open_notices_are_suppressed() {
fn i1_query_flags_index_entries_without_approval() {
let env = Env::new();
let pb = env.subscribe("foo");
- // A published release with no approval row: exactly the thing I1 forbids.
let rel = env
.db
.writer
@@ -235,7 +222,6 @@ fn i1_query_flags_index_entries_without_approval() {
#[test]
fn a_setting_that_is_absent_is_the_default_and_one_that_is_nonsense_falls_back() {
- // m-9: absent means default, nonsense means default *and a complaint*.
let env = Env::new();
assert_eq!(db::setting_i64(&env.db, "stage_b_cooldown", 86400), 86400);
db::set_setting(&env.db.writer, "stage_b_cooldown", "86400x").unwrap();