fix: IndexNow hears of deleted and edited records

RecordDeleted marks the listed rows it excludes and RecordSaved the rows
whose lastmod it moves (indexnow_pending_at); the next rebuild sends
them to IndexNow as removed or changed and clears the marks. RecordSaved
checks for a nil event before reading it. TestIndexNow now deletes and
edits through the record events, as the admin does.
This commit is contained in:
Jakub Zych
2026-11-04 23:02:09 +01:00
parent 6b67ab759b
commit f58d55555c
8 changed files with 147 additions and 12 deletions

View File

@@ -100,3 +100,14 @@ func testConfig(t *testing.T) *compass.Config {
}
return cfg
}
// TestRecordSavedNilEvent pins L2 IN-01: a nil event is ignored before it
// is read.
func TestRecordSavedNilEvent(t *testing.T) {
if err := RecordSaved(t.Context(), nil, nil); err != nil {
t.Fatal(err)
}
if err := RecordDeleted(t.Context(), nil, nil); err != nil {
t.Fatal(err)
}
}