For each expanded query variant: hit Notion's workspace search OR
per-database data_sources.query (when --databases is specified).
Union and dedupe by page ID, cap at 30 candidates total. Filters out
non-page objects (databases) from workspace search results.
Property filters (--filter JSON) pass through to data_sources.query
when in per-database mode.
5 tests: workspace dedup, 30-cap, DB-mode dispatch, page-only filter,
property-filter passthrough. 17 passing total.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code review polish:
- Add stderr warning for the fourth failure path (LLM returned valid
JSON but it's not a list-of-strings). Previously this fell back
silently, making debugging harder when Haiku produces unexpected
shapes.
- Drop unused f-string prefixes from two warnings (no interpolation).
- Type hint: Callable[..., str] = None → Optional[Callable[..., str]] = None
for strict type-checker compatibility.
12/12 tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Generates up to 5 query variants (synonyms + cross-language KR↔EN) so
later Notion API search can union over them. Permissive failure modes:
LLM error or non-JSON response falls back to [original] with stderr
warning. Dedupes and caps variants.
4 tests: variants list, dedup+cap, JSON-parse fallback, exception
fallback. 12 passing total.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>