Phase 3 part 2: the morning check and the Monday report

The morning check compares the last 7 days of final Search Console data
with the 7 before, by page and by search, and lists only moves past the
thresholds (editable). Each move is explained from the data: the search
whose clicks changed, and whether a position change is real or a change
in the mix of searches. Missing rows are "no data", not zero. The Monday
report has three numbers with where the change came from, the 3 pages
that moved most, and "Waiting for your yes"; it's written each Monday,
kept, and optionally emailed through the outreach mailbox. Schema 13.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 07:23:23 -07:00
co-authored by Claude Opus 5.5
parent 5ea620a091
commit 68ff18690b
17 changed files with 1058 additions and 32 deletions
+27
View File
@@ -100,4 +100,31 @@ func TestSearchConsole(t *testing.T) {
t.Errorf("SEO page lacks %q", want)
}
}
// The morning check: last week has data, the week before none, so the
// pages are new.
body = do(h, http.MethodGet, "/seo/check", nil, nil).Body.String()
for _, want := range []string{"2026-11-04 to 2026-11-10", "/pricing/", "new"} {
if !strings.Contains(body, want) {
t.Errorf("check lacks %q", want)
}
}
if body := do(h, http.MethodGet, "/seo/report", nil, nil).Body.String(); !strings.Contains(body, "No report yet") {
t.Error("a report before one was written")
}
rec = postForm(h, "/seo/report?site=0", nil)
if rec.Code != http.StatusSeeOther || !strings.Contains(rec.Header().Get("Location"), "week=2026-11-10") {
t.Fatalf("write report: %d %s %s", rec.Code, rec.Header().Get("Location"), rec.Body)
}
body = do(h, http.MethodGet, "/seo/report", nil, nil).Body.String()
for _, want := range []string{"1. The week", "Waiting for your yes", "/pricing/", "4,200"} {
if !strings.Contains(body, want) {
t.Errorf("report lacks %q", want)
}
}
// Thresholds.
postForm(h, "/settings/search", url.Values{"min_clicks": {"10"}, "min_positions": {"2.5"}, "min_impressions": {"500"}, "email_report": {"on"}})
if body := do(h, http.MethodGet, "/settings/search", nil, nil).Body.String(); !strings.Contains(body, `name="min_positions" inputmode="decimal" value="2.5"`) || !strings.Contains(body, `name="email_report" checked`) {
t.Error("thresholds weren't saved")
}
}