-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocument_test.go
More file actions
490 lines (474 loc) · 19.1 KB
/
Copy pathdocument_test.go
File metadata and controls
490 lines (474 loc) · 19.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
package codegraph
import (
"bytes"
"context"
"errors"
"reflect"
"strings"
"testing"
"testing/fstest"
)
func TestDocumentsMatchFilesystem(t *testing.T) {
source := fixture()
source["worker.py"] = &fstest.MapFile{Data: []byte("def work():\n pass\ndef entry():\n work()\n")}
source["web/app.ts"] = &fstest.MapFile{Data: []byte("function work() {}\nfunction entry() { work(); }\n")}
paths := []string{"main.go", "helper.go", "lib/work.go", "entry_test.go", "worker.py", "web/app.ts"}
var inputs []Document
for _, path := range paths {
inputs = append(inputs, Document{Path: path, Content: source[path].Data})
}
ctx := context.Background()
opts := Options{ModulePath: "example.org/demo"}
want, _, err := Build(ctx, "rev", documents(source, paths...), opts)
if err != nil {
t.Fatal(err)
}
g, err := New("rev", opts)
if err != nil {
t.Fatal(err)
}
if _, err := g.addDocumentsSync(ctx, inputs...); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(g.Nodes(), want.Nodes()) || !reflect.DeepEqual(g.Relations(), want.Relations()) || !reflect.DeepEqual(g.Report(), want.Report()) {
t.Fatal("document and filesystem inputs produced different graph facts or coverage")
}
}
func TestDocumentsResolveAcrossBatchesAndInputForms(t *testing.T) {
ctx := context.Background()
source := fixture()
g, err := New("rev", Options{ModulePath: "example.org/demo"})
if err != nil {
t.Fatal(err)
}
main := Document{Path: "main.go", Content: source["main.go"].Data}
r, err := g.addDocumentsSync(ctx, main, main)
if err != nil || (len(r.Diagnostics) == 0) || !reflect.DeepEqual(r.Documents, []string{"main.go"}) {
t.Fatalf("explicit batch must not discover dependencies: %+v, %v", r, err)
}
r, err = g.addDocumentsSync(ctx, Document{Path: "lib/work.go", Content: source["lib/work.go"].Data})
if err != nil || (len(r.Diagnostics) == 0) {
t.Fatal(r, err)
}
r, err = g.addDocumentsSync(ctx, Document{Path: "helper.go", Content: source["helper.go"].Data})
if err != nil || len(r.Diagnostics) != 0 {
t.Fatal(r, err)
}
if got := query(t, g, `MATCH (:Function {name:'Entry'})-[:calls]->(n:Function {name:'Work'}) RETURN n`, nil); len(got) != 2 {
t.Fatalf("cross-document calls missing: %v", got)
}
nodes, relations, report := g.Nodes(), g.Relations(), g.Report()
if _, err := g.addDocumentsSync(ctx, main, Document{Path: "helper.go", Content: source["helper.go"].Data}); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) {
t.Fatal("re-adding files as documents changed identities or coverage")
}
if _, err := g.addDocumentsSync(ctx, Document{Path: "helper.go", Content: []byte("package app\nfunc Changed(){}")}); !errors.Is(err, ErrSnapshotChanged) {
t.Fatalf("filesystem identity not shared with documents: %v", err)
}
changed := fstest.MapFS{"main.go": {Data: []byte("package app\nfunc Changed(){}")}}
if _, err := g.addDocumentsSync(ctx, Document{Path: "main.go", Content: changed["main.go"].Data}); !errors.Is(err, ErrSnapshotChanged) {
t.Fatalf("document identity not shared with files: %v", err)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) {
t.Fatal("conflicting input changed graph")
}
}
func TestDocumentsOwnContent(t *testing.T) {
ctx := context.Background()
content := []byte("package app\nfunc Entry(){ Work() }\n")
original := bytes.Clone(content)
g, err := New("rev", Options{})
if err != nil {
t.Fatal(err)
}
if _, err := g.addDocumentsSync(ctx, Document{Path: "main.go", Content: content}); err != nil {
t.Fatal(err)
}
// A later rebuild must still use the submitted snapshot, not caller memory.
for i := range content {
content[i] = 'x'
}
r, err := g.addDocumentsSync(ctx,
Document{Path: "work.go", Content: []byte("package app\nfunc Work(){}\n")},
Document{Path: "main.go", Content: original},
)
if err != nil || len(r.Diagnostics) != 0 {
t.Fatal(r, err)
}
if got := query(t, g, `MATCH (:Function {name:'Entry'})-[:calls]->(n:Function {name:'Work'}) RETURN n`, nil); len(got) != 1 {
t.Fatalf("caller mutation corrupted retained source: %v", got)
}
}
func TestDocumentsRollback(t *testing.T) {
seed := Document{Path: "seed.go", Content: []byte("package app\nfunc Seed(){}\n")}
added := Document{Path: "added.go", Content: []byte("package app\nfunc Added(){}\n")}
for _, tc := range []struct {
name string
opts Options
documents []Document
wantErr error
cancel bool
}{
{name: "changed path", documents: []Document{added, {Path: seed.Path, Content: added.Content}}, wantErr: ErrSnapshotChanged},
{name: "conflicting duplicates", documents: []Document{added, {Path: added.Path, Content: seed.Content}}, wantErr: ErrSnapshotChanged},
{name: "file count", opts: Options{MaxDocuments: 1}, documents: []Document{added}, wantErr: ErrBuildBudget},
{name: "file bytes", opts: Options{MaxDocumentBytes: int64(len(seed.Content))}, documents: []Document{added}, wantErr: ErrBuildBudget},
{name: "source bytes", opts: Options{MaxSourceBytes: int64(len(seed.Content) + len(added.Content) - 1)}, documents: []Document{added}, wantErr: ErrBuildBudget},
{name: "node count", opts: Options{MaxNodes: 3}, documents: []Document{added}, wantErr: ErrBuildBudget},
{name: "invalid path", documents: []Document{added, {Path: "../escape.go", Content: seed.Content}}},
{name: "canceled", documents: []Document{added}, wantErr: context.Canceled, cancel: true},
} {
t.Run(tc.name, func(t *testing.T) {
g, err := New("rev", tc.opts)
if err != nil {
t.Fatal(err)
}
if _, err := g.addDocumentsSync(context.Background(), seed); err != nil {
t.Fatal(err)
}
nodes, relations, report := g.Nodes(), g.Relations(), g.Report()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
if tc.cancel {
cancel()
}
r, err := g.addDocumentsSync(ctx, tc.documents...)
if err == nil || (tc.wantErr != nil && !errors.Is(err, tc.wantErr)) {
t.Fatalf("error = %v, want %v", err, tc.wantErr)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) || !reflect.DeepEqual(report, r) {
t.Fatal("failed batch changed published state")
}
})
}
}
func TestDocumentsPartialCoverage(t *testing.T) {
g, err := New("rev", Options{Scope: []string{"src"}})
if err != nil {
t.Fatal(err)
}
r, err := g.addDocumentsSync(context.Background(),
Document{Path: "src/good.go", Content: []byte("package app\nfunc Good(){}")},
Document{Path: "src/bad.go", Content: []byte("package broken\nfunc (")},
Document{Path: "src/unknown.codegraph-unknown", Content: []byte("unknown")},
Document{Path: "outside.go", Content: []byte("package app")},
)
if err != nil || (len(r.Diagnostics) == 0) || !reflect.DeepEqual(r.Documents, []string{"src/good.go", "src/unknown.codegraph-unknown"}) {
t.Fatal(r, err)
}
codes := map[string]string{}
for _, d := range r.Diagnostics {
codes[d.Location.Path] = d.Code
}
want := map[string]string{"src/bad.go": "parse_error", "src/unknown.codegraph-unknown": "unsupported_language", "outside.go": "out_of_scope"}
if !reflect.DeepEqual(codes, want) {
t.Fatalf("diagnostics = %v, want %v", codes, want)
}
}
func TestDocumentOnlyDocumentsEnterGraph(t *testing.T) {
g, r, err := Build(context.Background(), "rev", []Document{
{Path: "main.go", Content: []byte("package app\nfunc Entry(){}\n")},
{Path: "notes.cg-unrecognized", Content: []byte("plain text notes\n")},
}, Options{})
if err != nil || (len(r.Diagnostics) == 0) {
t.Fatal(r, err)
}
if !reflect.DeepEqual(r.Documents, []string{"main.go", "notes.cg-unrecognized"}) {
t.Fatalf("file-only document missing from coverage: %v", r.Documents)
}
if !hasDiagnostic(r, "unsupported_language") {
t.Fatalf("coverage gap not diagnosable: %+v", r.Diagnostics)
}
rows := query(t, g, `MATCH (f:Document {path:'notes.cg-unrecognized'}) RETURN f`, nil)
if len(rows) != 1 {
t.Fatalf("file node = %v", rows)
}
f := rows[0]["f"].(Node)
if f.Kind != DocumentKind || f.Language != "" || f.Name != "notes.cg-unrecognized" {
t.Fatalf("file-only node = %+v", f)
}
if got := query(t, g, `MATCH (:Document {path:'notes.cg-unrecognized'})-[:declares]->(n) RETURN n`, nil); len(got) != 0 {
t.Fatalf("file-only document parsed declarations: %v", got)
}
if got := query(t, g, `MATCH (f:Document) RETURN f`, nil); len(got) != 2 {
t.Fatalf("mixed batch file nodes = %v", got)
}
if got := query(t, g, `MATCH (:Document {path:'main.go'})-[:declares]->(n:Function {name:'Entry'}) RETURN n`, nil); len(got) != 1 {
t.Fatalf("grammar-backed document lost extraction: %v", got)
}
}
func TestDocumentOnlyDocumentsIdentity(t *testing.T) {
ctx := context.Background()
g, err := New("rev", Options{})
if err != nil {
t.Fatal(err)
}
notes := Document{Path: "notes.cg-unrecognized", Content: []byte("plain text notes")}
if _, err := g.addDocumentsSync(ctx, notes); err != nil {
t.Fatal(err)
}
nodes, relations, report := g.Nodes(), g.Relations(), g.Report()
if _, err := g.addDocumentsSync(ctx, notes, notes); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) {
t.Fatal("re-adding a file-only document changed identities or coverage")
}
if _, err := g.addDocumentsSync(ctx, Document{Path: notes.Path, Content: []byte("changed notes")}); !errors.Is(err, ErrSnapshotChanged) {
t.Fatalf("conflicting file-only content = %v", err)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) {
t.Fatal("conflicting input changed graph")
}
}
func TestDocumentOnlyDocumentsOwnContent(t *testing.T) {
ctx := context.Background()
content := []byte("original notes")
g, err := New("rev", Options{})
if err != nil {
t.Fatal(err)
}
if _, err := g.addDocumentsSync(ctx, Document{Path: "notes.cg-unrecognized", Content: content}); err != nil {
t.Fatal(err)
}
for i := range content {
content[i] = 'x'
}
if _, err := g.addDocumentsSync(ctx, Document{Path: "notes.cg-unrecognized", Content: []byte("original notes")}); err != nil {
t.Fatalf("caller mutation corrupted retained source: %v", err)
}
if _, err := g.addDocumentsSync(ctx, Document{Path: "notes.cg-unrecognized", Content: content}); !errors.Is(err, ErrSnapshotChanged) {
t.Fatalf("mutated caller memory matched retained source: %v", err)
}
}
func TestDocumentOnlyDocumentsBudget(t *testing.T) {
seed := Document{Path: "seed.go", Content: []byte("package app\nfunc Seed(){}\n")}
notes := Document{Path: "notes.cg-unrecognized", Content: []byte("plain text notes longer than the seed file")}
for _, tc := range []struct {
name string
opts Options
}{
{"file count", Options{MaxDocuments: 1}},
{"file bytes", Options{MaxDocumentBytes: int64(len(seed.Content))}},
{"source bytes", Options{MaxSourceBytes: int64(len(seed.Content) + len(notes.Content) - 1)}},
} {
t.Run(tc.name, func(t *testing.T) {
g, err := New("rev", tc.opts)
if err != nil {
t.Fatal(err)
}
if _, err := g.addDocumentsSync(context.Background(), seed); err != nil {
t.Fatal(err)
}
nodes, relations, report := g.Nodes(), g.Relations(), g.Report()
if _, err := g.addDocumentsSync(context.Background(), notes); !errors.Is(err, ErrBuildBudget) {
t.Fatalf("file-only document bypassed budget: %v", err)
}
if !reflect.DeepEqual(nodes, g.Nodes()) || !reflect.DeepEqual(relations, g.Relations()) || !reflect.DeepEqual(report, g.Report()) {
t.Fatal("failed batch changed published state")
}
})
}
}
const gitlinkCommit = "0123456789abcdef0123456789abcdef01234567"
// +case=`A supplied gitlink is one versioned Document, regardless of filename or checkout availability`
func TestGitlinkDocumentIdentity(t *testing.T) {
ctx := context.Background()
g, err := New("parent", Options{})
if err != nil {
t.Fatal(err)
}
document := Document{Path: "sdk.ts", Gitlink: gitlinkCommit}
// A previous exploration at the same path must not poison the typed cache.
if _, err := g.Extract(ctx, Document{Path: document.Path, Content: []byte("function wrong() {}")}); err != nil {
t.Fatal(err)
}
facts, err := g.AddDocument(ctx, document).Wait()
if err != nil || facts.Gitlink != gitlinkCommit || facts.Language != "" || len(facts.Declarations) != 0 || len(facts.Issues) != 0 {
t.Fatal(facts, err)
}
report, err := g.Wait(ctx)
if err != nil || len(report.Diagnostics) != 0 || len(g.Nodes()) != 1 || len(g.Relations()) != 0 {
t.Fatal(report, err, g.Nodes())
}
node, ok := g.Node(document.ID())
if !ok || node.Kind != DocumentKind || node.Gitlink != gitlinkCommit || node.Location.Path != document.Path || node.Location.EndByte != 0 {
t.Fatal(node)
}
rows := query(t, g, `MATCH (n:Document {gitlink:$commit}) RETURN n,n.gitlink AS revision`, map[string]any{"commit": gitlinkCommit})
if len(rows) != 1 || !reflect.DeepEqual(rows[0]["n"], node) || rows[0]["revision"] != gitlinkCommit {
t.Fatal(rows)
}
if err := g.AddDocuments(ctx, document); err != nil {
t.Fatal(err)
}
if _, err := g.Wait(ctx); err != nil {
t.Fatal(err)
}
for _, changed := range []Document{{Path: document.Path, Gitlink: strings.Repeat("a", 40)}, {Path: document.Path}} {
if err := g.AddDocuments(ctx, changed); !errors.Is(err, ErrSnapshotChanged) {
t.Fatal("changed material accepted", err)
}
}
fresh, err := g.Extract(ctx, Document{Path: document.Path, Gitlink: strings.Repeat("b", 64)})
if err != nil || fresh.Gitlink != strings.Repeat("b", 64) {
t.Fatal("exploration reused another revision", fresh, err)
}
still, _ := g.Node(document.ID())
if still.Gitlink != gitlinkCommit {
t.Fatal("exploration changed published graph", still)
}
}
// +case=`Imports stop at the supplied gitlink boundary; no child module or callable is fabricated`
func TestGitlinkImports(t *testing.T) {
for _, tc := range []struct {
path, source, root string
opts Options
confidence Confidence
}{
{"src/app.ts", "import {work} from '../sdk/src/api'; export function run(){work()}", "sdk", Options{}, Exact},
{"src/app.js", "import '../sdk';", "sdk", Options{}, Exact},
{"src/app.tsx", "import '../sdk/lib';", "sdk", Options{}, Exact},
{"app.py", "import sdk.api\nsdk.api.work()\n", "sdk", Options{}, Scoped},
{"pkg/app.py", "from .sdk.api import work\nwork()\n", "pkg/sdk", Options{}, Exact},
{"app.go", "package app\nimport sdk \"example.org/app/sdk/api\"\nfunc Run(){sdk.Work()}\n", "sdk", Options{ModulePath: "example.org/app"}, Exact},
} {
t.Run(tc.path, func(t *testing.T) {
source := Document{Path: tc.path, Content: []byte(tc.source)}
gitlink := Document{Path: tc.root, Gitlink: gitlinkCommit}
g, report, err := Build(context.Background(), "parent", []Document{source, gitlink}, tc.opts)
if err != nil {
t.Fatal(err)
}
count := 0
for _, edge := range g.Relations() {
if edge.Target == gitlink.ID() {
if edge.Kind != Imports || edge.Source != source.ID() || edge.Confidence != tc.confidence || edge.Evidence[0].Basis != "gitlink_boundary" || edge.Location.Path != tc.path || edge.Location.EndByte <= edge.Location.StartByte {
t.Fatal(edge)
}
count++
}
if edge.Kind == Calls {
t.Fatal("invented child callable", edge)
}
}
if count != 1 {
t.Fatal("missing gitlink edge", g.Relations(), report)
}
for _, node := range g.Nodes() {
if node.Location != nil && strings.HasPrefix(node.Location.Path, tc.root+"/") {
t.Fatal("invented child source", node)
}
}
for _, d := range report.Diagnostics {
if d.Location.Path == tc.root || d.Code == "unresolved_import" {
t.Fatal("gitlink reported as unsupported or missing", d)
}
}
})
}
}
func TestGitlinkImportPathBoundaries(t *testing.T) {
g, report, err := Build(context.Background(), "parent", []Document{
{Path: "app.ts", Content: []byte("import './sdk-extra/a'; import '@example/sdk'; import './sdk/a'; import './sdk/b';")},
{Path: "sdk", Gitlink: gitlinkCommit},
}, Options{})
if err != nil {
t.Fatal(err)
}
edges := g.RelationsTo(DocumentID("sdk"), Imports)
if len(edges) != 2 {
t.Fatal(edges)
}
gaps := 0
for _, d := range report.Diagnostics {
if d.Code == "unresolved_import" {
gaps++
}
}
if gaps != 2 {
t.Fatal("guessed a package alias or crossed a path segment", report)
}
}
func TestGitlinkBatchAndBudgets(t *testing.T) {
ctx := context.Background()
gitlink := Document{Path: "sdk", Gitlink: gitlinkCommit}
source := Document{Path: "app.ts", Content: []byte("import './sdk/api';")}
g, _, err := Build(ctx, "parent", []Document{source}, Options{})
if err != nil {
t.Fatal(err)
}
if err = g.AddDocuments(ctx, gitlink); err != nil {
t.Fatal(err)
}
if _, err = g.Wait(ctx); err != nil {
t.Fatal(err)
}
all, _, err := Build(ctx, "parent", []Document{gitlink, source}, Options{})
if err != nil || !reflect.DeepEqual(g.Nodes(), all.Nodes()) || !reflect.DeepEqual(g.Relations(), all.Relations()) {
t.Fatal("batch order changed graph", err)
}
for _, options := range []Options{{MaxDocumentBytes: 39}, {MaxSourceBytes: 79}, {MaxDocuments: 1}, {MaxNodes: 1}} {
g, err := New("limited", options)
if err != nil {
t.Fatal(err)
}
err = g.AddDocuments(ctx, gitlink, Document{Path: "other", Gitlink: gitlinkCommit})
if err == nil {
_, err = g.Wait(ctx)
}
if !errors.Is(err, ErrBuildBudget) || len(g.Nodes()) != 0 {
t.Fatal("gitlink bypassed budget or partial publication", options, err, g.Nodes())
}
}
}
func TestGitlinkInvalidAndOverlappingMaterials(t *testing.T) {
ctx := context.Background()
for _, bad := range []Document{
{Path: ".", Gitlink: gitlinkCommit},
{Path: "sdk", Gitlink: "short"},
{Path: "sdk", Gitlink: strings.Repeat("z", 40)},
{Path: "sdk", Gitlink: gitlinkCommit, Content: []byte("source")},
} {
g, _ := New("invalid", Options{})
if _, err := g.Extract(ctx, bad); err == nil {
t.Fatal("invalid extraction accepted", bad)
}
if err := g.AddDocuments(ctx, Document{Path: "ok.ts", Content: []byte("function ok(){}")}, bad); err == nil {
t.Fatal("invalid batch accepted", err)
}
if _, err := g.GetDocument(DocumentID("ok.ts")); !errors.Is(err, ErrDocumentNotFound) {
t.Fatal("invalid batch partially admitted", err)
}
}
link := Document{Path: "sdk", Gitlink: gitlinkCommit}
child := Document{Path: "sdk/api.ts", Content: []byte("export function work(){}")}
for _, docs := range [][]Document{{link, child}, {child, link}, {link, {Path: "sdk/nested", Gitlink: gitlinkCommit}}} {
g, _ := New("overlap", Options{})
if err := g.AddDocuments(ctx, docs...); err == nil {
t.Fatal("mixed snapshots admitted", err)
}
for _, doc := range docs {
if _, err := g.GetDocument(doc.ID()); !errors.Is(err, ErrDocumentNotFound) {
t.Fatal("overlapping batch partially admitted", err)
}
}
}
for _, docs := range [][]Document{{link, child}, {child, link}} {
g, _ := New("batches", Options{})
if err := g.AddDocuments(ctx, docs[0]); err != nil {
t.Fatal(err)
}
if err := g.AddDocuments(ctx, docs[1]); err == nil {
t.Fatal("in-flight overlap admitted")
}
if _, err := g.Wait(ctx); err != nil {
t.Fatal(err)
}
if err := g.AddDocuments(ctx, docs[1]); err == nil {
t.Fatal("published overlap admitted")
}
}
}