From fa7d806ed417546fadac8374be5a3bb48ad6cf06 Mon Sep 17 00:00:00 2001 From: Rahul Krishna Date: Sun, 29 Nov 2026 16:46:07 -0500 Subject: [PATCH] test(neo4j): push the application row in the lazy no-delete test (#60) TestIntegration_LazyPushNeverDeletes pushed an empty GraphRows. It was written before validateIdentity (f601457) started to refuse a push with no application row, so the push failed with "missing application anchor" before it reached the delete check. The test now pushes a row set with only the application row: a lazy push where every module is gone. That passes the identity check, and a lazy push must still delete nothing. The check now covers edges as well as nodes. The same push with --eager deletes the subgraph (71 -> 1 nodes), so the test fails if a lazy push deletes rows. Co-Authored-By: Claude Opus 5.5 --- internal/neo4j/bolt_integration_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/internal/neo4j/bolt_integration_test.go b/internal/neo4j/bolt_integration_test.go index d99671d..d9a675c 100644 --- a/internal/neo4j/bolt_integration_test.go +++ b/internal/neo4j/bolt_integration_test.go @@ -78,16 +78,18 @@ func TestIntegration_LazyPushNeverDeletes(t *testing.T) { if err := WriteBolt(ctx, rows, a.Application.ID, seed); err != nil { t.Fatalf("seed: %v", err) } - before, _ := countSubgraph(t, ctx, cfg, a.Application.ID) + before, beforeEdges := countSubgraph(t, ctx, cfg, a.Application.ID) - // A lazy push of an EMPTY row set must delete nothing. - empty := GraphRows{} - if err := WriteBolt(ctx, empty, a.Application.ID, cfg); err != nil { - t.Fatalf("lazy empty push: %v", err) + // A lazy push that has no module rows must delete nothing. It still + // carries the application row: validateIdentity refuses a push without it. + appOnly := GraphRows{Nodes: []NodeRow{appRow(a)}} + if err := WriteBolt(ctx, appOnly, a.Application.ID, cfg); err != nil { + t.Fatalf("lazy application-only push: %v", err) } - after, _ := countSubgraph(t, ctx, cfg, a.Application.ID) - if after < before { - t.Errorf("lazy push deleted nodes: %d -> %d (lazy must be additive-only)", before, after) + after, afterEdges := countSubgraph(t, ctx, cfg, a.Application.ID) + if after < before || afterEdges < beforeEdges { + t.Errorf("lazy push deleted rows: nodes %d -> %d, edges %d -> %d (lazy must be additive-only)", + before, after, beforeEdges, afterEdges) } }