Skip to content

Commit d870ce9

Browse files
Align native fixtures with captured database scope and exact guards (#96)
The UN30 facade fixture now supplies its actual per-test database config to full storage assembly, so the rooted Q pool shares the correct database. The forged namespace insertion must match its exact BEFORE INSERT registration guard and roll back, preserving every route/source state assertion. The durable scope-drift test now expects the shared family-selection contract: 502 INTEGRITY_ERROR with retryable=false for both descriptor and renew, before a G/Q repository is selected. It retains stream error/no-END, scope restoration and no-IO assertions. Three owned nightly format/parse and whitespace source checks pass; native execution remains unrun.
1 parent b00b7e5 commit d870ce9

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎src/api/router/snapshot_session_tests.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,11 +1293,12 @@ async fn mst2_durable_http_warm_reads_renew_and_frame_delivery_reject_primary_sc
12931293
.try_get_by_index(0)
12941294
.unwrap();
12951295
overwrite_primary_scope_for_test(db, uuid::Uuid::new_v4().to_string()).await;
1296+
// Family selection rejects physical authority drift as INTEGRITY_ERROR.
12961297
error(
12971298
fixture.send("GET", "descriptor", Body::empty()).await,
1298-
500,
1299-
"INTERNAL",
1300-
true,
1299+
502,
1300+
"INTEGRITY_ERROR",
1301+
false,
13011302
)
13021303
.await;
13031304
error(
@@ -1314,9 +1315,9 @@ async fn mst2_durable_http_warm_reads_renew_and_frame_delivery_reject_primary_sc
13141315
)
13151316
.await
13161317
.unwrap(),
1317-
500,
1318-
"INTERNAL",
1319-
true,
1318+
502,
1319+
"INTEGRITY_ERROR",
1320+
false,
13201321
)
13211322
.await;
13221323
assert!(

‎src/api/router/snapshot_storage_route_tests.rs‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,11 +483,19 @@ async fn mst2_generic_storage_routes_raw_lease_derives_atomically_and_half_rows_
483483
SELECT (jsonb_populate_record(NULL::mst2_lease_storage_route,
484484
to_jsonb(r)||jsonb_build_object('lease_id','{lease}'))).* FROM mst2_lease_storage_route r",
485485
)).await;
486-
rejected(db,
486+
let txn = db.begin().await.unwrap();
487+
let error = txn.execute_unprepared(
487488
"INSERT INTO mst2_metadata_namespace SELECT (jsonb_populate_record(NULL::mst2_metadata_namespace,
488489
to_jsonb(n)||jsonb_build_object('namespace_uuid','00000000-0000-4000-8000-000000000001',
489490
'graph_domain','qualified-v1'))).* FROM mst2_metadata_namespace n",
490-
).await;
491+
).await.expect_err("unadmitted qualified namespace must be rejected before commit");
492+
assert!(
493+
error.to_string().contains(
494+
"qualified namespace registration has no exact admitted rooted family scope and lock set"
495+
),
496+
"wrong qualified namespace rejection: {error}"
497+
);
498+
txn.rollback().await.unwrap();
491499
assert_eq!(routes(db).await, original);
492500
assert_eq!(sources(db).await, source);
493501
}

‎src/context/un30_readonly.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ async fn un30_building_the_read_facade_writes_no_sidebar() {
244244
.await
245245
.expect("writable connection"),
246246
);
247-
let config = Arc::new(crate::config::testing::isolated_config(
248-
temp.path().join("config"),
249-
));
247+
let mut config = crate::config::testing::isolated_config(temp.path().join("config"));
248+
config.database = db_config.clone();
249+
let config = Arc::new(config);
250250

251251
assert!(
252252
!sidebar_table_exists(&writable).await,

0 commit comments

Comments
 (0)