Skip to content

v0.19.4 — skip binary stubs in content search

Choose a tag to compare

@mariusei mariusei released this 30 Jun 13:17
· 309 commits to main since this release

The same binary-as-text defect 0.19.1 and 0.19.2 chased, in the one
read_text() path those releases missed: content_search, which backs
search_structures(content_pattern).

search_structures(content_pattern=...) first scans the directory, then
reads every matched file in full to search it line by line. That read
did not skip unsupported file-info stubs — the same multi-GB binaries
(GeoTIFF, shapefiles, large media) that scan_directory and
preview_directory already learned to leave on disk. Pointed at a
document-heavy directory, the call read those stubs as text and hit the
MCP client's 300s ceiling before returning anything.

  • content_search now skips unsupported file-info stubs before
    read_text(), so a hit can only be anchored in a file that actually
    parses — the same guard the other read paths apply.

Scope, honestly: this closes the stub-reading path only. A broad
content_pattern over "." is still bounded by the rest of the work it
does — full-text reads of every supported file and the sheer file count
under the directory. The lever for that remains narrowing the directory
argument; type_filter/name_pattern filter results after the read, not
before. A built-in time/byte budget is a separate, unmade decision.

950 tests pass; golden output unchanged.