Add TuiTui platform support#849
Conversation
|
tuitui是360集团自研IM,主要服务于360员工和相关生态伙伴 |
There was a problem hiding this comment.
Pull request overview
Adds first-class TuiTui platform support to cc-connect, covering runtime integration, build registration, web config metadata, and end-user setup docs so TuiTui can behave like the existing chat-platform adapters.
Changes:
- Add a new
platform/tuituiadapter with WebSocket ingest, policy checks, media handling, reply-context reconstruction, and tests. - Register TuiTui in build/config surfaces and add a plugin stub for selective builds.
- Add web-form metadata, locale strings, and documentation links/setup guidance for TuiTui.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
web/src/lib/platformMeta.ts |
Adds manual-form metadata for TuiTui in the web UI. |
web/src/i18n/locales/zh.json |
Adds new TuiTui-related field labels in Simplified Chinese. |
web/src/i18n/locales/zh-TW.json |
Adds new TuiTui-related field labels in Traditional Chinese. |
web/src/i18n/locales/ja.json |
Adds new TuiTui-related field labels in Japanese. |
web/src/i18n/locales/es.json |
Adds new TuiTui-related field labels in Spanish. |
web/src/i18n/locales/en.json |
Adds new TuiTui-related field labels in English. |
README.zh-CN.md |
Lists TuiTui in the supported-platform table. |
README.md |
Lists TuiTui in the supported-platform table. |
platform/tuitui/tuitui.go |
Implements the TuiTui platform adapter and policy/media/session logic. |
platform/tuitui/tuitui_test.go |
Adds unit tests and an opt-in real-connection smoke test. |
Makefile |
Registers TuiTui in the selective platform build list. |
docs/tuitui.md |
Adds the TuiTui setup and behavior guide. |
config.example.toml |
Adds example TuiTui configuration. |
cmd/cc-connect/plugin_platform_tuitui.go |
Adds the build-tagged platform registration stub. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Addressed the Copilot review feedback in
Local verification:
|
chenhg5
left a comment
There was a problem hiding this comment.
Review Summary
Clean, well-structured new platform adapter following all established cc-connect platform patterns. CI is green across all 5 checks. MERGEABLE.
What's good:
init()+core.RegisterPlatform("tuitui", New)wiring ✓app_id/app_secretvalidated atNew()startup ✓no_tuituibuild tag for selective compilation ✓- All 5 i18n locale files updated (en/zh/zh-TW/ja/es) ✓
- Web UI integration via
platformMeta.ts✓ - Documentation in
docs/tuitui.md✓ - 326 lines of tests covering DM, group, channel, and access policy paths ✓
TUITUI_APP_SECRETenv var substitution inconfig.example.toml✓
💭 Nit (optional): Consider adding compile-time interface assertions at the package level (var _ core.Platform = (*Platform)(nil)) — other newer platform adapters include these and they catch drift immediately if the interface changes.
APPROVED.
e0d5daa to
e21864a
Compare
chenhg5
left a comment
There was a problem hiding this comment.
结论: Request changes
总体判断: PR 自 chenhg5 2026-05-05 approve 后, author zzl360 在 2026-07-15 09:21 / 10:11 / 10:39 推了 3 个新 commit (e21864a + 1871189 + 762c251),在 platform/tuitui/tuitui.go 引入了 5 个 lint violation (run 29408915690) — 其中 4 个 errcheck (Close calls) 阻塞 merge,1 个 staticcheck QF1003 是 P3 nit。需要修这 4 个 errcheck 才能进入下一轮评估。
Review 范围:
- 对比旧 approve (7f1c9df) → 当前 head (762c251) 的 author 新 commit。
- 跑了 gh CI API 看哪个 job 失败。
- 提取 762c251 (last commit) 的文件清单。
- 重点关注 CI gating (lint fail) 而非 exhaustive review (PR diff vs main 也很大, 但实际 author 新增 commit 只是 3 个小幅修改)。
🚨 P1 必须处理:
- 4 个
errcheckviolations 在platform/tuitui/tuitui.go(lint, blocking merge):- 影响: lint job fail → 后续 4 个 jobs 全部 skipping。PR 在 lint fix 前无法 merge。
- 证据 (run 29408915690, job 87331048242, 2026-07-15T10:41:57Z):
platform/tuitui/tuitui.go:325:18: Error return value of `conn.Close` is not checked (errcheck) platform/tuitui/tuitui.go:689:23: Error return value of `resp.Body.Close` is not checked (errcheck) platform/tuitui/tuitui.go:756:23: Error return value of `resp.Body.Close` is not checked (errcheck) platform/tuitui/tuitui.go:829:23: Error return value of `resp.Body.Close` is not checked (errcheck) - 建议: 参考仓库惯例把 Close 错误处理掉 (slog / _ = / if err { ... }) 。
conn.Close()(line 325) 通常用 defer + 如果想简化为_ = conn.Close(),因为是 cleanup。resp.Body.Close()三处都在 HTTP 路径, 可以保留 (e.g.,_ = resp.Body.Close()) 或读 body 完成后用io.Copy(io.Discard, resp.Body) + close模式, 不过 _ = 就够了。 - 验证: 在本地跑
golangci-lint run platform/tuitui/...确认零 errcheck 输出,然后 push。
🔵 可选 (P3):
staticcheck QF1003在platform/tuitui/tuitui.go:579:platform/tuitui/tuitui.go:579:2: QF1003: could use tagged switch on rctx.chatType (staticcheck)- 不阻塞,但建议改成
switch rctx.chatType { case "x": ...; case "y": ... }让代码更易读。这个 nit 通常可以一次 PR 顺手清掉。
- 不阻塞,但建议改成
🟠 建议改进 (P2, 非阻塞):
- TuiTui 平台历史注入 (
feat(tuitui): prefer injected recent history) 是平台适配层的小改动, 我没深入 review。lint 修完后下一轮可以补一轮 correctness review。
❓ 需要确认:
- (空)
Testing / Risk:
- 已看到的验证: 5 jobs 中只有 lint 跑过, 其他 4 skipping。lint 失败行号见上。3 个新 commit 文件清单: 762c251 只动
platform/tuitui/tuitui.go (+6/-1)+tuitui_test.go (+14/-0),前两个 commit 累积改动需要再翻。 - 未覆盖风险: 整个 PR vs main 的 diff 也有 300+ files (主要是 main 同步, 不是 author 主动添加),实际 author 改动只集中在
platform/tuitui/。我只看了 last commit 的 +/- 30 行,前两个 commit 的代码 diff 没逐行看过。
Next step:
|
@zzl360 lint 失败在 |
762c251 to
073eb1a
Compare
|
已按 review 意见更新:
验证结果:
|
Summary
Scope
This PR is now a single TuiTui-only commit. Unrelated Codex prompt injection, send-command safeguards, cron, session, and general config changes were removed from the branch history.
The small
core.Message.OnAcceptedcallback is platform-neutral infrastructure required by TuiTui so cached chat context is not consumed by slash commands, rejected messages, or queue failures.Testing
golangci-lint v2.11.4 run --new-from-rev HEAD ./...(0 issues)go test ./...go test -race ./platform/tuituipnpm build/npm run buildinwebmake build PLATFORMS_INCLUDE=tuituimake build PLATFORMS_INCLUDE=feishuReview fixes