Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(indexing-notify): do not overwrite the batch-truncation warning

Rudy Celekli9ee3b3f65e63
diff --git a/scripts/indexing_notify.py b/scripts/indexing_notify.py
index 35a840b..5dae563 100644
--- a/scripts/indexing_notify.py
+++ b/scripts/indexing_notify.py
@@ -212,8 +212,7 @@ def batch_notify(
f"Only the first {DAILY_QUOTA} URLs will be submitted."
)
urls = urls[:DAILY_QUOTA]
-
- if len(urls) > 50:
+ elif len(urls) > 50:
result["quota_warning"] = (
f"Submitting {len(urls)} URLs will use {len(urls)}/{DAILY_QUOTA} "
f"of your daily quota."
diff --git a/tests/test_indexing_notify.py b/tests/test_indexing_notify.py
new file mode 100644
index 0000000..e5e2b36
--- /dev/null
+++ b/tests/test_indexing_notify.py
@@ -0,0 +1,53 @@
+"""
+Tests for scripts/indexing_notify.py — the Google Indexing API helper.
+
+Regression coverage for the over-quota warning. batch_notify truncates a
+batch larger than the daily quota and sets a warning saying the extra URLs
+will be dropped. A second, unconditional ``if len(urls) > 50`` branch then
+overwrote that warning (the truncated list is still > 50), so a user
+submitting more than DAILY_QUOTA URLs was never told any were dropped.
+"""
+
+from __future__ import annotations
+
+import os
+import sys
+
+_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
+if _SCRIPTS not in sys.path:
+ sys.path.insert(0, _SCRIPTS)
+
+import indexing_notify # noqa: E402
+
+
+def _stub_notify(monkeypatch):
+ # Keep batch_notify offline: never touch the Indexing API.
+ monkeypatch.setattr(indexing_notify, "notify_url",
+ lambda url, action: {"url": url, "success": True})
+ monkeypatch.setattr(indexing_notify.time, "sleep", lambda *_: None)
+
+
+def test_over_quota_batch_keeps_the_truncation_warning(monkeypatch) -> None:
+ _stub_notify(monkeypatch)
+ urls = [f"https://example.com/{i}" for i in range(indexing_notify.DAILY_QUOTA + 50)]
+ result = indexing_notify.batch_notify(urls, delay=0)
+ assert result["quota_warning"] is not None
+ # The user must be told the batch was truncated, not merely how much
+ # quota the (already truncated) submission uses.
+ assert "exceeds daily quota" in result["quota_warning"]
+ assert str(indexing_notify.DAILY_QUOTA) in result["quota_warning"]
+
+
+def test_mid_size_batch_still_reports_quota_usage(monkeypatch) -> None:
+ _stub_notify(monkeypatch)
+ urls = [f"https://example.com/{i}" for i in range(75)]
+ result = indexing_notify.batch_notify(urls, delay=0)
+ assert result["quota_warning"] is not None
+ assert "will use" in result["quota_warning"]
+
+
+def test_small_batch_has_no_quota_warning(monkeypatch) -> None:
+ _stub_notify(monkeypatch)
+ urls = [f"https://example.com/{i}" for i in range(10)]
+ result = indexing_notify.batch_notify(urls, delay=0)
+ assert result["quota_warning"] is None