fix(gateway): accept html and generic documents - #51880
Conversation
Related / competing OPEN cluster for inbound document acceptance: #12702 (adds |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the gateway coverage. Current main already accepts the PR's generic-document path, but a narrow useful correction remains.
Problems
- Generic authorized-file acceptance is already on
main:4314d451changedgateway/platforms/base.py:1701-1714to cache non-media attachments regardless of extension, and Telegram already accepts them atplugins/platforms/telegram/adapter.py:7994-8005. - The added
.html/.htm/.tsventries in the static expected-extension test are catalog snapshots;tests/gateway/test_document_cache.py's newcache_media_bytesbehavior test is the stronger contract.
Suggested changes
- Re-scope salvage to the still-needed pieces: canonical MIME mappings, normalized
doc_mime, and the context-note correction.gateway/run.py:2074-2079currently says everytext/*attachment was included, while Telegram intentionally skips inline content above 100 KiB or after UTF-8 decoding fails (plugins/platforms/telegram/adapter.py:8013-8027). - Keep the behavioral regression test and avoid extending the static extension snapshot.
Automated hermes-sweeper review.
| [ | ||
| ".pdf", | ||
| ".md", | ||
| ".html", |
There was a problem hiding this comment.
The behavior test added below is the regression contract for HTML routing. Adding individual extensions to this static list turns it into a catalog snapshot; please rely on the behavior test rather than expanding this enumeration.
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Summary
Two open PRs address adjacent inbound-document classification problems. #51880 adds canonical HTML/TSV MIME handling and corrects misleading document context, while #55777 detects extensionless UTF-8 text and carries explicit inline-state through the Telegram path.
Related pull requests
- #51880
related— (+84/-20) — keep open, narrow before merge: generic-document acceptance is already present on main, but the diff still provides useful canonical MIME mappings for HTML/TSV, normalized Telegram MIME selection, a truthful optional-inline context note, and behavioral coverage. This follows the keep_open review on #51880; remove the redundant generic-acceptance framing and static extension snapshot. - #55777
related— (+124/-23) — keep open as a separate follow-up: the diff addresses the distinct extensionless-upload cause by conservatively sniffing UTF-8 text, routing the primary Telegram ingress through cache_media_bytes, and tracking whether text was actually inlined. This follows the keep_open review on #55777; its per-attachment inline-state is more precise than #51880's globally optional wording but requires rebasing around the narrower #51880 change.
Suggested consolidation
Merge #51880 after narrowing it to canonical MIME mappings, normalized doc_mime use, truthful context-note behavior, and behavioral tests. Keep #55777 open and rebase it afterward for the distinct extensionless-text classification and explicit inline-state work; neither PR should be closed as a duplicate.
Cross-PR triage: Reviewed 2 pull requests and 0 issues in this complex. Each diff was read against this issue; Assessment working set: 27 kB of PR diffs, 4 kB of issue/PR text, 5 kB of discussion (4 comments), 0 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.
Summary
.html/.htmand.tsvas first-class document types with canonical MIME typesVerification
python -m pytest tests/gateway/test_document_cache.py tests/gateway/test_document_context_note.py tests/gateway/test_telegram_group_gating.py -q -o 'addopts='