WeKnora/internal/datasource/connector/notion
yetuge a75e8e9ac0
fix(datasource): 语雀/Notion/IMA/飞书连接器 API 响应体补体积上限 (#3985)
* fix(datasource): 语雀/Notion/IMA/飞书 API 响应体补体积上限

#3887 给 GitLab 客户端补了 readCapped 上限;语雀、Notion、IMA、飞书四个
连接器的 API 读取仍是裸 io.ReadAll,破损或恶意端点可让同步进程缓冲无界
响应体。各连接器比照 GitLab 同步同一上限(16 MiB)与显式超限报错,limit
做成字段以便测试下调。飞书 429/5xx 错误路径的 best-effort 读取刻意不动。

* fix(datasource): 响应体上限为零值时回退到默认 16 MiB

测试里直接用字面量构造的 Client 不经过 NewClient,jsonLimit 为 0,
readCapped 会拒绝任何响应,导致 feishu/core 11 个现有测试失败。
readCapped 遇到非正数 limit 时改用 maxJSONResponseBytes。

* fix(datasource): 响应体超限不再重试;补齐飞书 token 与下载错误分支的读取上限

- yuque/ima/feishu/notion 的 readCapped 改用哨兵错误 errResponseTooLarge,
  文案不变;yuque doRequest、ima callAPIAt、feishu DoRequest 遇到超限直接返回,
  不再按退避重试 3 次(同一请求必然再次超限,只会白耗限流额度)。
- 飞书 GetTenantAccessToken 改为 readCapped + json.Unmarshal,和其他 API 响应同一上限。
- 飞书 downloadRawBytes 的 429/5xx/非 200 错误预览只读 4 KiB,
  download failed 错误不再携带完整响应体。

---------

Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-10-08 14:02:29 +08:00
..
client.go fix(datasource): 语雀/Notion/IMA/飞书连接器 API 响应体补体积上限 (#3985) 2026-10-08 14:02:29 +08:00
client_test.go fix(datasource): 语雀/Notion/IMA/飞书连接器 API 响应体补体积上限 (#3985) 2026-10-08 14:02:29 +08:00
connector.go fix(notion): 查询撞厂商上限被截断时不再静默,截断轮次不下发删除 (#3845) 2026-10-07 23:54:08 +08:00
connector_test.go ci: add app frontend and docreader checks 2026-07-30 14:13:15 +08:00
discovery_failure_test.go fix(notion): 在资源发现失败时中止增量同步 (#3682) 2026-09-25 18:47:38 +08:00
empty_page_test.go fix(notion): 修复页面清空后旧正文残留 2026-09-29 00:52:07 +08:00
markdown.go feat(notion): implement Connector interface, markdown renderer, and DI registration 2026-04-08 16:31:25 +08:00
markdown_test.go fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
pagination_guard_test.go fix(notion): 分页循环补重复游标防护与跳数上限 (#3890) 2026-10-08 01:29:20 +08:00
query_truncation_test.go fix(notion): 查询撞厂商上限被截断时不再静默,截断轮次不下发删除 (#3845) 2026-10-07 23:54:08 +08:00
query_windowing_test.go fix(notion): 查询撞厂商上限被截断时不再静默,截断轮次不下发删除 (#3845) 2026-10-07 23:54:08 +08:00
truncation_test.go fix(notion): 超过 block 上限截断时补 Warn,避免内容与子页面静默缺失 (#3771) 2026-10-08 01:29:12 +08:00
types.go fix(notion): 查询撞厂商上限被截断时不再静默,截断轮次不下发删除 (#3845) 2026-10-07 23:54:08 +08:00
types_test.go feat(notion): add Notion API client and type definitions 2026-04-08 16:31:25 +08:00