fix(notion-search): drop unused _flatten_property arg + lock falsy-value behavior

Code review polish:
- Drop the unused `name` parameter from `_flatten_property` (it was
  reserved for future per-property-name special-casing but never used).
- Add a regression test pinning that checkbox=False and number=0 are
  preserved in the enriched output. The existing empty-value filter is
  `if value not in (None, [], "")` which keeps falsy-but-meaningful
  values, but the contract wasn't tested.

22/22 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 07:59:49 +09:00
parent 8aa0fa26e9
commit e67209b905
2 changed files with 26 additions and 2 deletions

View File

@@ -154,7 +154,7 @@ TEXT_BEARING_BLOCK_TYPES = {"paragraph", "heading_1", "heading_2", "heading_3",
"numbered_list_item", "to_do", "toggle"}
def _flatten_property(name: str, prop: Dict):
def _flatten_property(prop: Dict):
"""Flatten a Notion property to a Python value suitable for display/rerank."""
ptype = prop.get("type")
if ptype == "title":
@@ -224,7 +224,7 @@ def enrich_candidates(notion, candidates: List[Dict]) -> List[Dict]:
for name, prop in properties.items():
if prop.get("type") == "title":
continue
value = _flatten_property(name, prop)
value = _flatten_property(prop)
if value not in (None, [], ""):
flat_props[name] = value
excerpt = _fetch_excerpt(notion, c["id"])