refactor(strategies): centralize the content-or-response predicate in a first_usable_text helper (3 copies)

Author: LearningCircuitCreated Sep 27, 2026Updated Sep 28, 2026
Labelspriority: lowrefactoringpythonseverity:nitfrom-review-extractionfollow-up-work-in-progress

Summary

The "first usable of content/response, as a non-empty str" predicate exists three times across the strategy assembly sites; a first_usable_text helper on the base strategy would centralize it.

Field Value
Severity nit
Origin Review of #6741 (post-merge extraction)
Review section Prose review tail
Classification PR-introduced
Verified at main@43061a14ebff
Dedup distinct · 3 hits reviewed

Trigger

Any future change to the usability rule (e.g. whitespace-only vs missing-key semantics) must be replicated in three places or the strategies drift.

Impact

Maintenance/drift risk only; current behavior is correct at all three sites.

Pinned evidence

  • 43061a14ebff:src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py:L558-L566 - the next((candidate for candidate in (get("content"), get("response")) ...)) predicate
  • two further copies at the sibling assembly sites (focused_iteration and the langgraph precedent referenced by the review)

Fix direction

Add first_usable_text(citation_result, default) to the base strategy class and call it from all three assembly sites.

Targeted tests

The existing per-strategy empty/missing-key tests already pin behavior; add one direct unit test for the helper.

Provenance

Extracted from review of PR #6741 (post-merge extraction).

Source: LearningCircuit/local-deep-research