Skip to content

fix(web): plumb has_image/has_file into search index#449

Closed
intendednull wants to merge 1 commit into
mainfrom
claude/issue-355-search-index-fields
Closed

fix(web): plumb has_image/has_file into search index#449
intendednull wants to merge 1 commit into
mainfrom
claude/issue-355-search-index-fields

Conversation

@intendednull
Copy link
Copy Markdown
Owner

Summary

  • Indexer at crates/web/src/app.rs:382 hard-coded has_image: false / has_file: false / letter_id: None, so the documented has:image / has:file / in:#letter operators silently returned zero hits.
  • New pure helper willow_client::derive_has_image_file(body) derives the booleans from the body string: inline [file:name:b64] payloads (the format produced by ClientHandle::share_file_inline) split on filename extension, and image URLs in plain text fire has:image to match the renderer's auto-embed behaviour.
  • Wired the helper into the indexer Effect in app.rs. letter_id stays None for now — there is no active-letter signal in web state because letters-dms.md hasn't landed. Tracked in Search index: thread active-letter id into IndexableMessage.letter_id #448.

Tradeoffs

  • Helper lives in willow-client (not willow-web) because the inline-file body format is owned by ClientHandle::share_file_inline and a future native consumer (agent / CLI) needs the same booleans. Runner-up: parse-from-Content::File directly — rejected because DisplayMessage is built from ChatMessage which only carries body: String; the structured Content enum is collapsed at projection time, so body is the only signal available without a wider refactor.
  • Image URL detection mirrors the renderer's extension-list rule rather than full URL parsing — keeps the indexer cheap and matches what users visually see embedded.

Test plan

  • cargo fmt --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo check -p willow-web --target wasm32-unknown-unknown
  • cargo test -p willow-client --lib search:: (10 new tests in derive::tests + 1 regression test in execute_tests::derived_attachment_flags_drive_has_image_and_has_file_operators)
  • cargo test -p willow-web --lib

Refs #355
Follow-up: #448

https://claude.ai/code/session_01HnwK1dP6rnrsbLxtg92zfF


Generated by Claude Code

Indexer at app.rs:382 hard-coded has_image/has_file/letter_id, so
has:image / has:file / in:#letter operators silently returned zero.

DisplayMessage has no attachments field — files inline as
[file:name:b64] in body, image URLs auto-embed in renderer. Added
willow_client::search::derive::derive_has_image_file body helper:
inline-file payload → has_image (image ext) or has_file (else);
http(s) URL with image ext → has_image. Pure, dual-target.

letter_id deferred — no active-letter signal in web state; letters-dms
spec exists but feature not implemented. Tracked in follow-up.

Refs #355

https://claude.ai/code/session_01HnwK1dP6rnrsbLxtg92zfF
@intendednull
Copy link
Copy Markdown
Owner Author

Fix conflicts please

Copy link
Copy Markdown
Owner Author

Superseded by #442. main now have IndexableMessage::from_display_message with same has_image/has_file derive logic. Closing — fix already shipped.

Test coverage on main covers same surface (search/tests.rs from_display_message_tests mod). Letter_id plumbing follow-up still tracked at #448.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants