Skip to content

docs(email-security): the message search is literal, and blank text is not a filter - #402

Open
maximelb wants to merge 3 commits into
masterfrom
wf2-q-literal-docs
Open

docs(email-security): the message search is literal, and blank text is not a filter#402
maximelb wants to merge 3 commits into
masterfrom
wf2-q-literal-docs

Conversation

@maximelb

@maximelb maximelb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Publishes the contract that go-mailsec#163 and lc_api-go#947 implement.

What was wrong. The API reference lists q among the message-index filters and says
nothing about how the text is matched. It was matched as a SQL pattern, so % and _ were
wildcards and a backslash was an escape character: a search for 50% off also returned
50 percent off, a search for invoice_2026 also returned invoiceX2026, a lone %
returned every message in the index, and c:\temp returned the row without the backslash
and missed the one with it. None of that was documented, taught or refused — it was an
accident of the query, and the fix is to match literally rather than to document wildcards
nobody asked for.

What this adds. One bullet under "Shared behaviours": q is a literal, case-insensitive
substring over the message's subject and sender address; % and _ are ordinary characters;
surrounding whitespace is ignored and whitespace-only text is not a filter.

It is placed in the shared-behaviours list rather than in the GET /messages row on purpose:
the held read-budget PR (#389) rewrites that row, and two PRs editing the same line would
collide at merge time. The two statements compose — that one is about what a search must be
accompanied by, this one about what the text means.

Hold. This describes behaviour that is not in production until the Email Security gateway
and collector ship there, and Email Security's prod rollout is on hold. Do not merge until
the prod release.

…s not a filter

The API reference listed `q` among the message-index filters and said
nothing about how the text is matched. It was matched as a SQL pattern,
so `%` and `_` were wildcards: a search for `50% off` also returned
`50 percent off`, and a lone `%` returned everything.

The backend now matches the text literally (go-mailsec#163) and the
gateway reads it once, trimmed (lc_api-go#947). This documents the
contract that results: a literal, case-insensitive substring over subject
and sender, whitespace ignored, whitespace-only text not a filter.

Placed in "Shared behaviours" rather than in the `GET /messages` row so it
does not collide with the held read-budget PR (#389), which rewrites that
row.
@maximelb

maximelb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

merge with the prod release

lcbill
lcbill previously approved these changes Sep 9, 2026
@maximelb

maximelb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

/lc-review

…listed, and correct the rate-limit claim

Independent review of the free-text search docs.

1. The literal-search contract was published only in the API reference's shared
   behaviours. The page that documents the message-list filters still described
   `q` as "free-text over the message's identifying fields" — the sentence a
   reader looking up `q` actually lands on. It now says literal, names the two
   fields, and states the rules a caller trips over: no wildcards, whitespace
   ignored, needs something that bounds the read, 512 characters.

2. The EML download section claimed to be "the only [route] that is"
   rate-limited and that "No other Email Security route is rate-limited". That
   has been false since the read governor shipped: a `q` bounded only by time
   and a coverage call over an explicit window are counted per organization per
   read class and answer 429. The download quota's real distinction is that it
   fails CLOSED and the governor fails open, so that is what it now says.
@maximelb

maximelb commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

/lc-review

lcbill
lcbill previously approved these changes Sep 9, 2026
@maximelb

Copy link
Copy Markdown
Contributor Author

merge with the prod release

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