Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ Android:
Rust:

- `rust/crates/fire-models/src/rich_text.rs`
- `rust/crates/fire-rich-text/src/lib.rs`(`display_segments`)
- `rust/crates/fire-rich-text/src/ui_plan.rs`(`display_segments`)
- `rust/crates/fire-rich-text/src/presentation.rs`
- `rust/crates/fire-uniffi-types/src/records/render_block.rs`
- 全部构造 `RenderPresentationState` / `RenderDisplaySegmentState` 的测试
Expand Down
14 changes: 7 additions & 7 deletions docs/architecture/2026-09-22-ios-topic-detail-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Android 早期阶段不改调用点。`TopicRepository.fetchTopicDetailPage` / `
| `topics.rs` | `load_more_topic_posts` / `append_topic_detail_source` | 会话 `load_more` 与可见区预取 |
| `topics.rs` | `build_topic_tree_presentation` | 私有。树不进 UI 快照的源字段 |
| `topics.rs` | `fetch_topic_posts` / `fetch_topic_ai_summary` | 会话内部补洞与摘要 |
| `interactions.rs` | `like_post` / `unlike_post` -> `Option<PostReactionUpdate>`;`toggle_post_reaction`;`create_reply`;`create_boost`;`vote_poll` | 会话命令调用。返回值不穿过 FFI 给 Swift 改帖 |
| `interactions/` | `like_post` / `unlike_post` -> `Option<PostReactionUpdate>`;`toggle_post_reaction`;`create_reply`;`create_boost`;`vote_poll` | 会话命令调用。返回值不穿过 FFI 给 Swift 改帖 |
| `messagebus.rs` | `subscribe_message_bus_channel` / `unsubscribe_message_bus_channel` | 会话在 open/close 自己订阅 |
| `presence.rs` | `bootstrap_topic_reply_presence` / `update_topic_reply_presence` / `topic_reply_presence_state` | 会话内部 |
| `state_observer.rs` | `notify_session` / `notify_topic_list` / `notify_notification_center` | 不扩展。话题详情用会话级 observer |
Expand Down Expand Up @@ -213,8 +213,8 @@ Rust 没有对应方法。`notify_topic_list` 推的是整表 `TopicListResponse

```text
fire-models/src/topic_detail_ui.rs UI 投影,无逻辑
fire-core/src/core/topic_detail_session.rs
fire-core/src/core/topic_detail_project.rs
fire-core/src/core/topic_detail/ 会话、registry、命令
fire-core/src/core/topic_detail/project/ source+tree -> UI 快照投影
fire-uniffi-topics/src/session.rs Handle + observer 适配
fire-uniffi-topics/src/records.rs from_core 记录
```
Expand Down Expand Up @@ -983,8 +983,8 @@ VC `buildCurrentFeedState` 改为读 `snapshot.rows`、`phase`、`hasMore`、`co
新文件:

- `rust/crates/fire-models/src/topic_detail_ui.rs`
- `rust/crates/fire-core/src/core/topic_detail_session.rs`
- `rust/crates/fire-core/src/core/topic_detail_project.rs`
- `rust/crates/fire-core/src/core/topic_detail/`(会话、registry)
- `rust/crates/fire-core/src/core/topic_detail/project/`(source+tree -> 快照投影)
- `rust/crates/fire-uniffi-topics/src/session.rs`

改:
Expand Down Expand Up @@ -1101,8 +1101,8 @@ Kyc `FaceSessionHost` 持有会话并在 `releaseSession` 拆掉。Fire 的对
| --- | --- | --- |
| `rust/crates/fire-models/src/topic_detail_ui.rs` | 1 | 新增快照与 home patch |
| `rust/crates/fire-models/src/lib.rs` | 1 | 导出 |
| `rust/crates/fire-core/src/core/topic_detail_session.rs` | 1 | 会话、registry、常量、命令 |
| `rust/crates/fire-core/src/core/topic_detail_project.rs` | 1 | 私有 source+tree -> 快照;compat -> `TopicDetailPage` |
| `rust/crates/fire-core/src/core/topic_detail/` | 1 | 会话、registry、常量、命令 |
| `rust/crates/fire-core/src/core/topic_detail/project/` | 1 | 私有 source+tree -> 快照;compat -> `TopicDetailPage` |
| `rust/crates/fire-core/src/core/topics.rs` | 1 | source session 留私有;公开 fetch 变包装 |
| `FireSessionRuntimeState`、`SessionSnapshot`(`#[serde(skip)]`)、`SessionState` | 1 | `ReadPathLoginRequest` 不进信封、不抬 `snapshot_revision`。restore 时清掉。不改 `FireAuthRecoveryHint` |
| `rust/crates/fire-core/src/core/mod.rs` | 1 | registry;`request_read_path_login` / `complete_read_path_login` |
Expand Down
50 changes: 50 additions & 0 deletions docs/architecture/2026-09-23-page-and-rust-module-splits.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 2026-09-23:页面组合拆分与 Rust 大文件切目录

| 项 | 值 |
| --- | --- |
| 日期 | 2026-09-23 |
| 状态 | 已落地(文件边界;Session 控制面升级仍按 TopicDetail 刀法预备,未迁行为) |
| 范围 | iOS 高流量页目录拆分 + fire-core / fire-models / fire-rich-text / fire-uniffi-session 模块切分 |
| 参考 | [2026-09-22-ios-topic-detail-session.md](2026-09-22-ios-topic-detail-session.md) |

对照 TopicDetail 落地:先立 Host / Shell / Controller / Feed / State 目录,Swift store 暂不改行为。下一波 Session(`HomeFeedSession` / `ChatChannelSession` / `ComposerSession` / Notification runtime 收口)在边界稳定后再迁控制面。

## iOS 页面目录

| 面 | 新根 | 说明 |
| --- | --- | --- |
| Topic List Kit | `App/ListKit/TopicList/` | 从 Bookmarks 文件抽出共用 cell / metric / toast / palette |
| Composer | `App/Composer/` | Route/Validation/Markdown/Shell/Host + VC 扩展 |
| Home | `App/Home/` | Controller + Feed + Shell;scope/drawer 仍在 `Views/Home/` |
| Search | `App/Search/` | Controller + Feed + Header |
| Notifications | `App/Notifications/` | Inbox / History / Cells;presentation 仍在 `Views/Notifications/` |
| Chat Channel | `App/Chat/Channel/` | Load / Bus / Interactions / Table + message cell |
| Messages / Drafts / Profile cells | `Views/Messages/`、`Views/Drafts/`、`Views/Profile/Cells/` | 轻量拆;死 SwiftUI Profile/PublicProfile 已删 |

## Rust 模块目录

| 原文件 | 现目录 |
| --- | --- |
| `fire-core/src/core/network.rs` | `core/network/{mod,constants,client,traced,execute,request,csrf,challenge,heal,auth_signals,headers,body,tests}.rs` |
| `fire-core/src/diagnostics.rs` | `diagnostics/{models,store,listener,logs,bundle,tests}.rs` |
| `fire-models/src/cookie.rs` | `cookie/{canonical,snapshot,sweep,tests}.rs` |
| `fire-core/src/topic_payloads.rs` | `topic_payloads/{list,post,detail,poll,deser}.rs` |
| `fire-rich-text/src/lib.rs` | `map.rs` / `onebox.rs` / `images.rs` / `plain_text.rs` / `tests.rs` |
| `fire-uniffi-session/src/records.rs` | `records/{cookie,session,bootstrap,login,challenge,refresh,handlers,doh}.rs` |
| `fire-uniffi-session/src/lib.rs` handle | `handle/{cookies,challenge,login,refresh,doh,scope}.rs` |
| `fire-core/src/core/interactions.rs` | `interactions/{bookmarks,posts,replies,polls,votes,reactions,boosts,timings,...}.rs` |
| `fire-core/src/core/session.rs` | `session/{classify,challenge,cookies,bootstrap,login}.rs` |
| `fire-core/src/core/chat.rs` | `chat/{channels,messages,reactions,pins,threads,search}.rs` |
| `fire-core/src/core/notifications.rs` | `notifications/{fetch,runtime,read}.rs` |
| `topic_detail_project.rs` | `topic_detail/project/{row,chrome,checksum}.rs` |
| `topics/source/load.rs` | `topics/source/load/{initial,page,load_more}.rs` |
| hydrate AI summary | `topics/source/summary.rs` |

对外 crate 路径保持稳定(`mod` 目录替换单文件)。

## 下一波 Session(预备,未迁行为)

- `HomeFeedSession`:吃掉 `FireHomeFeedStore` 的 scope / merge / MB debounce / unread patch
- `ChatChannelSession`:每频道 open/close,对齐 TopicDetail
- Notification runtime 收口:Swift 分页并回 `FireNotificationRuntime`
- `ComposerSession`:draft / validation / 三类 submit / upload resolve
6 changes: 3 additions & 3 deletions docs/architecture/discourse-startup-implementation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

## Feasibility Assessment

Fully feasible。Rust 核心已有完整的 bootstrap 解析(`parsing.rs`)、session 管理(`core/session.rs`)、CSRF 刷新(`core/auth.rs`)、cookie 管理(`cookies.rs`)、MessageBus(`core/messagebus.rs`)、auth strike(`core/auth_strike.rs`)、probe(`core/auth.rs`)等能力。两端平台已有 WebView login coordinator 和 FFI 桥接。缺失部分是启动阶段编排(首页 HTML 请求与 UI 并行、PreheatGate 阻塞、AppStateRefresher 分批刷新)和 User 数据模型在 Rust 侧的完整定义。这些都是增量开发,无技术障碍。
Fully feasible。Rust 核心已有完整的 bootstrap 解析(`parsing.rs`)、session 管理(`core/session/`)、CSRF 刷新(`core/auth.rs`)、cookie 管理(`cookies.rs`)、MessageBus(`core/messagebus/`)、auth strike(`core/auth_strike.rs`)、probe(`core/auth.rs`)等能力。两端平台已有 WebView login coordinator 和 FFI 桥接。缺失部分是启动阶段编排(首页 HTML 请求与 UI 并行、PreheatGate 阻塞、AppStateRefresher 分批刷新)和 User 数据模型在 Rust 侧的完整定义。这些都是增量开发,无技术障碍。

## Current Surface Inventory

### Rust(需变更)

- `fire-core/src/core/mod.rs` — `FireCore` 主结构体,持有 session/network/diagnostics
- `fire-core/src/core/session.rs` — session 应用方法(merge/apply/sync/finalize)
- `fire-core/src/core/session/` — session 应用方法(merge/apply/sync/finalize;分 classify/challenge/cookies/bootstrap/login)
- `fire-core/src/core/auth.rs` — bootstrap 刷新、CSRF 刷新、probe、passive logout、strike
- `fire-core/src/core/network.rs` — 网络层 + 拦截器
- `fire-core/src/core/network/` — 网络层 + 拦截器
- `fire-core/src/parsing.rs` — HTML bootstrap 解析(parse_home_state)
- `fire-core/src/session_store.rs` — session 持久化
- `fire-models/src/session.rs` — BootstrapArtifacts、LoginPhase、SessionSnapshot
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/feedback-and-crash-reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Public vs private issues:

## Related paths

- `rust/crates/fire-core/src/diagnostics.rs`
- `rust/crates/fire-core/src/diagnostics/`
- `rust/crates/fire-uniffi-diagnostics/`
- `services/feedback-ingress/`
- `docs/release/test-feedback-template.md`
Expand Down
72 changes: 48 additions & 24 deletions docs/architecture/fire-native-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Rich text render instruction generation.

#### fire-core

Core orchestration engine. Owns session state, networking, API orchestration, and delegates to subsystems.
Core orchestration engine. Owns session state, networking, API orchestration, and delegates to subsystems. Large modules live as directories (`core/network/`, `core/session/`, `core/chat/`, `core/interactions/`, `core/notifications/`, `diagnostics/`, `topic_payloads/`); see [2026-09-23-page-and-rust-module-splits.md](2026-09-23-page-and-rust-module-splits.md).

- **Networking**: openwire client + optional DoH `DnsResolver` (user-configurable endpoint, default off) + transparent gzip/zlib/brotli/zstd response compression + request epoch guard + CSRF retry + auth signal/probe policy + Cloudflare challenge handler retry + logging
- **Session management**: Cookie sync, Bootstrap parsing, login state machine
Expand Down Expand Up @@ -284,39 +284,62 @@ native/ios-app/
FireAppViewModel.swift
FireProfileViewModel.swift

Screens/ # One directory per screen
App/ # One module directory per high-traffic screen (parallel to TopicDetail)
Home/
FireHomeView.swift # FireHomeViewController + UIKit filter cells on FireListViewController
FireTopicRow.swift # Legacy SwiftUI row used only by remaining transitional SwiftUI lists
Controller/FireHomeViewController.swift (+Actions / +Feed)
Feed/FireHomeFeedModels.swift
Feed/FireHomePaginationCoordinator.swift
Shell/FireHomeShellViews.swift
# Scope drawer / filtered lists remain under Views/Home/

TopicDetail/
FireTopicDetailViewController.swift
FireTopicDetailInteractionCoordinator.swift
FireTopicDetailSearchCoordinator.swift
FireTopicSearchBar.swift
FireTopicDetailFeedController.swift
FireTopicDetailFeedCellFactory.swift
FireTopicDetailRuntimeSnapshotBuilder.swift
FireTopicListMetricPresentation.swift
FirePostCellNode.swift
FirePostCellNode+Reactions.swift
FirePostCellNode+Actions.swift
FirePostCellNode+Body.swift
FirePostCellLayout.swift
Controller/FireTopicDetailViewController.swift
Controller/FireTopicDetailInteractionCoordinator.swift
Controller/FireTopicDetailSearchCoordinator.swift
Controller/FireTopicSearchBar.swift
Feed/FireTopicDetailFeedController.swift
Feed/FireTopicDetailFeedCellFactory.swift
Feed/FireTopicDetailRuntimeSnapshotBuilder.swift
Support/FireTopicListMetricPresentation.swift
# Texture post nodes remain under ListKit/TopicDetail/

Notifications/
FireNotificationsViewController.swift
FireNotificationCellNode.swift
FireNotificationHistoryViewController.swift
Feed/FireNotificationFeedModels.swift
Feed/FireNotificationListCell.swift
Feed/FireNotificationBannerCells.swift
# Presentation helpers remain under Views/Notifications/

Search/
FireSearchView.swift # FireSearchViewController + UIKit result cells on FireListViewController
Controller/FireSearchViewController.swift (+Actions / +Feed)
Feed/FireSearchFeedModels.swift
Feed/FireSearchCells.swift
Shell/FireSearchHeaderView.swift

Chat/
Channel/Controller/FireChatChannelViewController.swift (+Load / +Bus / +Interactions / +Table)
Channel/Feed/FireChatMessageCell.swift
# Channel list store/VC remain under Views/Chat/

ListKit/TopicList/ # Shared topic-row chrome (Home / Search / Bookmarks / Filtered)
FireTopicListTopicCell.swift
FireTopicListStateCell.swift
FireTopicListErrorBannerCell.swift
FireTopicListMetricView.swift

Profile/
FireProfileViewController.swift
FireProfileCellNode.swift

Composer/
FireComposerViewController.swift # UIKit native editor
Controller/FireComposerViewController.swift (+Chrome / +Render / +Draft / +Submit / +Mentions / +Editor / +Delegates)
State/ # Route, validation, category guidance, editor models
Markdown/ # Quote / insertion / toolbar
Shell/ # Palette, cards, banners, control factory
Host/FireComposerControllerHost.swift
Support/ # Draft helpers, SwiftUI text view wrapper
# Thin SwiftUI wrappers remain under Views/Composer/ (topic/post editors, tag picker)

Auth/
FireCaptchaLoginDialogController.swift # WKWebView hCaptcha + JS login sheet
Expand Down Expand Up @@ -1032,13 +1055,14 @@ Advantages:
- Bookmarks → UIKit `FireBookmarksViewController` on `FireListViewController`; the former SwiftUI production page has been removed
- Read History → UIKit `FireReadHistoryViewController` on `FireListViewController`; the former SwiftUI production page has been removed
- Notifications → UIKit `FireNotificationsViewController` and `FireNotificationHistoryViewController` on `FireListViewController`; the former SwiftUI production pages have been removed
- Drafts → UIKit `FireDraftsViewController` on `FireListViewController`; the former SwiftUI production page has been removed and draft continuation opens the UIKit Composer runtime
- Messages → UIKit `FirePrivateMessagesViewController` on `FireListViewController`; Profile keeps only a thin SwiftUI-to-UIKit host until Profile itself migrates
- Drafts → UIKit `FireDraftsViewController` on `FireListViewController` (`App/Views/Drafts/`); the former SwiftUI production page has been removed and draft continuation opens the UIKit Composer runtime
- Messages → UIKit `FirePrivateMessagesViewController` on `FireListViewController` (`App/Views/Messages/`); the former monolithic SwiftUI/host file has been split into ViewModel / Host / ViewController / Cells
- Search → UIKit `FireSearchViewController` on `FireListViewController`; the former SwiftUI production page and SwiftUI result rows have been removed while bookmark editing remains a tracked transitional SwiftUI presentation
- Login / Cloudflare auth → UIKit `FireOnboardingViewController` (unified launch/login page with validating→credential→loggingIn phases), `FireOnboardingCredentialFormView`, `FireExternalLoginMethod`, `FireCaptchaLoginDialogController`, `FireWebViewBrowserViewController` (optional auto-start of Discourse OAuth/Passkey buttons), and `FireCloudflareChallengeViewController`; the former separate `FireLoginViewController`, the standalone PreheatGate controllers (`FirePreheatGateViewController` / `FirePreheatGateWaitingViewController`), the monolithic login WebView controller, the SwiftUI auth screen, and the `UIViewRepresentable` login bridge have all been removed in favor of the single onboarding page
- Onboarding → UIKit `FireOnboardingViewController`; the former SwiftUI onboarding root has been removed, with Developer Tools remaining an explicit SwiftUI exception
- Composer → UIKit `FireComposerViewController`; the former SwiftUI `FireComposerView` page has been removed. Home, Messages, Drafts, Topic detail, and Public Profile open the UIKit runtime, with Public Profile using only a temporary SwiftUI-to-UIKit host until Profile itself migrates
- Profile → UIKit
- Composer → UIKit `FireComposerViewController`; the former SwiftUI `FireComposerView` page has been removed. Home, Messages, Drafts, Topic detail, and Public Profile open the UIKit runtime
- Profile → UIKit `FireProfileViewController` / `FirePublicProfileViewController`; dead SwiftUI `FireProfileView` / `FirePublicProfileView` have been removed
- Chat channel → UIKit `FireChatChannelViewController` under `App/Chat/Channel/` (Load / Bus / Interactions / Table extensions + `Feed/FireChatMessageCell`)
- SwiftUI remains only for WidgetKit, Developer Tools, and tracked transitional bridges

### Phase 5: Android Alignment (3-4 weeks)
Expand Down
Loading
Loading