fix(web): plumb has_image/has_file into search index#449
Closed
intendednull wants to merge 1 commit into
Closed
Conversation
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
Owner
Author
|
Fix conflicts please |
Owner
Author
|
Superseded by #442. main now have Test coverage on main covers same surface (search/tests.rs Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/web/src/app.rs:382hard-codedhas_image: false/has_file: false/letter_id: None, so the documentedhas:image/has:file/in:#letteroperators silently returned zero hits.willow_client::derive_has_image_file(body)derives the booleans from the body string: inline[file:name:b64]payloads (the format produced byClientHandle::share_file_inline) split on filename extension, and image URLs in plain text firehas:imageto match the renderer's auto-embed behaviour.app.rs.letter_idstaysNonefor 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
willow-client(notwillow-web) because the inline-file body format is owned byClientHandle::share_file_inlineand a future native consumer (agent / CLI) needs the same booleans. Runner-up: parse-from-Content::Filedirectly — rejected becauseDisplayMessageis built fromChatMessagewhich only carriesbody: String; the structuredContentenum is collapsed at projection time, so body is the only signal available without a wider refactor.Test plan
cargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo check -p willow-web --target wasm32-unknown-unknowncargo test -p willow-client --lib search::(10 new tests inderive::tests+ 1 regression test inexecute_tests::derived_attachment_flags_drive_has_image_and_has_file_operators)cargo test -p willow-web --libRefs #355
Follow-up: #448
https://claude.ai/code/session_01HnwK1dP6rnrsbLxtg92zfF
Generated by Claude Code