test(engine): seed recovery_rolls_forward_load_overwrite edge-free

The test seeded the full fixture (test.jsonl, which carries Knows/WorksAt edges)
then fault-injected a per-table Overwrite of node:Person down to a single row.
Overwrite RI validation now correctly rejects that: dropping the seeded Persons
strands the retained edges, so the load failed with "src 'Alice' not found in
Person" during validation — before it reached the post-finalize failpoint the
test drives, so the recovery roll-forward was never exercised.

Seed Persons only (no edges) so the overwrite is a clean single-table
roll-forward, which is what the test asserts (RolledForward{node:Person}). The
overwrite still removes the seeded Persons, so F1's overwrite-removed-ids path is
still exercised — just without an orphan.

Feature-gated: this binary runs under `--features failpoints`, a separate CI
step from the workspace test run, so it's invisible to `cargo test -p
omnigraph-engine` and only the post-merge main CI exercises it.
This commit is contained in:
Ragnor Comerford 2026-07-01 10:47:51 +02:00 committed by Ragnor Comerford
parent b2cfea035e
commit b73cf1a92e

View file

@ -1016,9 +1016,20 @@ async fn recovery_rolls_forward_load_overwrite() {
{
let mut db = Omnigraph::init(&uri, helpers::TEST_SCHEMA).await.unwrap();
load_jsonl(&mut db, helpers::TEST_DATA, LoadMode::Overwrite)
.await
.unwrap();
// Seed Persons only (no edges): the fault-injected step below overwrites
// node:Person down to a single row, and a per-table overwrite that drops
// Persons referenced by seeded Knows/WorksAt edges is now rejected as an
// orphan during validation — before it ever reaches the post-finalize
// failpoint this test drives. Keeping the seed edge-free makes the
// overwrite a clean single-table roll-forward, which is what's under test.
load_jsonl(
&mut db,
"{\"type\":\"Person\",\"data\":{\"name\":\"Alice\",\"age\":30}}\n\
{\"type\":\"Person\",\"data\":{\"name\":\"Bob\",\"age\":31}}\n",
LoadMode::Overwrite,
)
.await
.unwrap();
parent_commit_id = branch_head_commit_id(dir.path(), "main").await.unwrap();
let _failpoint = ScopedFailPoint::new(names::MUTATION_POST_FINALIZE_PRE_PUBLISHER, "return");