Repository navigation
feat(platform): give an emailed attachment its mail's context - #3014
Merged
Merged
Conversation
A CV named for its author says nothing about the role it was sent for. Its chunk header was the filename alone, so it could only be found by the author's name or by words inside the document — and a covering email's subject, which usually names the role, reached no index at all. The header now carries the mail: filename, the conversation's subject, and the correspondent. It is prepended to every chunk, so it feeds both the keyword leg and the embedding, widening retrieval on both. `indexDocument` gains an optional `title` distinct from `filename`. The filename is still what the corpus row stores and the UI shows; the title is only what the header announces. A Document Hub file passes none, so its header is unchanged. Absent context is omitted rather than invented. A mail with neither subject nor correspondent keeps a bare filename header, which is the case that started this: an attachment arrived with no subject and no body, and no header text could have connected it to anything. `(no subject)` is a STORED subject, not a render-time fallback, so indexing it would put the placeholder into the corpus as prose. It was duplicated as a literal in three ingest files; it is now `NO_SUBJECT` in `ingest/constants.ts` and those three read it from there.
This was referenced Aug 21, 2026
This was referenced Sep 27, 2026
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.
An emailed attachment can now be found by the mail it arrived on, not only by its filename and contents.
Why
A CV named for its author says nothing about the role it was sent for. Its chunk header was the filename alone, and the covering email's subject — which usually names the role — reached no index at all. So "what CVs came in for the sales position" could only match a document whose own text happened to say "sales".
Found while verifying #3011 and #3012 on a live deployment.
What changed
indexDocumentgains an optionaltitle, distinct fromfilename. The filename is still what the corpus row stores and the UI shows; the title is only what the header announces. A Document Hub file passes none and its header is unchanged.(no subject)is a stored subject rather than a render-time fallback, so it is excluded — indexing it would put the placeholder into the corpus as prose. It was a duplicated literal in three ingest files and is nowNO_SUBJECTiningest/constants.ts.Risk
The correspondent comes from the conversation's linked contact, and a contact id is a reference rather than a permission. The read checks the contact's own organization, so a foreign contact's name cannot reach this org's header. A mutation removing that check is covered.
A dangling conversation costs only the context, never the binding: scope depends on the conversation id, and the subject and correspondent are enrichment.
Tests
New coverage: the header text for subject-plus-correspondent, subject-only, and neither; that a Document Hub file gets no title override; that the title reaches the written chunk rather than merely being passed; that the placeholder subject is excluded; and that a cross-org contact supplies no name.
Nine mutations, all red. Two were survivors first: nothing asserted the title reached the header (the ingest tests mocked
indexDocument), and nothing asserted the cross-org contact check.Scope
Does not index message bodies — that needs a new corpus ref class and a gate branch, since every ref currently resolves through
fileMetadataand a message has no such row. It also needs an erasure cascade. Both follow separately.This would not have helped the attachment that prompted it, which arrived with no subject and no body. It fixes the normal case.
Gate: typecheck,
oxlint --type-aware, oxfmt, SAST 0 findings, platform 75,241 tests.