feat(alpha): wire connect→snapshot→disconnect end-to-end (v0.1.0-alpha.1)

First Internal Alpha build per DEC-001. Closes the milestone of
'Flutter UI calls Rust via the typed bridge, Rust connects to a
TeamSpeak-compatible server through tsclientlib, returns a typed
snapshot, and disconnects cleanly.' Audio remains Beta scope.

Promotions from PoC:
  poc/tsclientlib-connect-spike  →  crates/chanora_protocol/

New product code:
  crates/chanora_protocol/src/{dto.rs,adapter.rs} — typed boundary
    over tsclientlib. Tokio task owns the Connection; public
    handle communicates via mpsc/oneshot. No tsclientlib types
    cross out of the crate (SAD-067 / SysDes-011 / SysDes-029).
  core/chanora_core/src/lib.rs — ChanoraSession composes the
    protocol crate, enforces the DEC-006 single-connection
    invariant.
  crates/chanora_bridge/src/{api.rs,frb_generated.rs} — FRB 2.12.0
    bridge per DEC-014. cdylib + staticlib + rlib. Typed
    BridgeSnapshot / BridgeChannel / BridgeClient / BridgeError
    DTOs. Process-wide OnceLock<Runtime> + OnceLock<ChanoraSession>.
  flutter_rust_bridge.yaml at repo root.
  apps/chanora_flutter/lib/main.dart — Alpha UI: server form,
    connect button, channel tree, disconnect.
  apps/chanora_flutter/lib/l10n/app_{en,zh}.arb expanded with the
    Alpha key set; ARB metadata reaffirms ADR-008 for
    server-provided content.
  Generated Dart bindings under apps/chanora_flutter/lib/src/rust/.

Empirical verification (2026-05-14):
  Workspace: cargo check + cargo test clean
    (workspace tests: all green).
  Bridge cdylib: target/release/libchanora_bridge.so produced
    (~15 MB).
  Flutter: flutter analyze clean; flutter test runs 3/3 green
    including the alpha_e2e_test that drives the full
      Dart → FRB → chanora_bridge → chanora_core → chanora_protocol
        → tsclientlib → UDP → cn.teamspeak.app
    path. The captured logcat/stdout shows the tsproto resender
    transitioning Connected → Disconnecting → Disconnected on
    clean teardown.

Architecture changes:
  - Removed the chanora_core ↔ chanora_bridge cyclic dependency.
    chanora_core no longer knows the bridge exists; the bridge
    maps from CoreError.
  - chanora_bridge crate's #![forbid(unsafe_code)] lint relaxed
    because FRB-generated glue legitimately uses unsafe at the
    FFI boundary. Hand-written code remains unsafe-free.

Open follow-ups (NOT in this Alpha):
  - Audio capture/playback wiring into chanora_audio
    (Beta scope per DEC-001).
  - Identity persistence via chanora_storage
    (currently regenerated on every connect).
  - Per-message diagnostics + redaction
    (chanora_diagnostics still scaffold).
  - Reconnect / network-loss recovery.
  - Mobile (Android) build of the bridge cdylib + UI verification.
This commit is contained in:
EdisonJwa
2026-05-14 21:37:06 +08:00
parent e0f34009d9
commit 4915ec0a1b
30 changed files with 7504 additions and 206 deletions
+49 -8
View File
@@ -7,18 +7,59 @@
"description": "Application title shown in launchers and the app bar. The product name `Chanora` is fixed by DEC-018 and must not be translated."
},
"homeGreeting": "Welcome to Chanora",
"@homeGreeting": {
"description": "Greeting shown on the empty home screen before any server is connected."
},
"homeNotProductionReadyBanner": "Chanora is currently in early development. This build is not production-ready.",
"homeNotProductionReadyBanner": "Alpha build — not production ready.",
"@homeNotProductionReadyBanner": {
"description": "Plain-language banner informing testers that this build is not for end-user use. Mirrors README.md's status line."
},
"connectAction": "Connect to a server",
"fieldServerHost": "Server address",
"@fieldServerHost": {
"description": "Label for the server-address input on the connect form."
},
"fieldNickname": "Nickname",
"@fieldNickname": {
"description": "Label for the nickname input on the connect form."
},
"connectAction": "Connect",
"@connectAction": {
"description": "Label for the primary action that opens the connect-to-server flow."
"description": "Label for the button that initiates a connection."
},
"disconnectAction": "Disconnect",
"@disconnectAction": {
"description": "Label for the button that ends the active connection."
},
"refreshAction": "Refresh",
"@refreshAction": {
"description": "Label for the button that re-fetches the server snapshot."
},
"statusIdle": "Not connected",
"@statusIdle": {},
"statusConnecting": "Connecting…",
"@statusConnecting": {},
"statusConnected": "Connected to {server}",
"@statusConnected": {
"placeholders": {
"server": { "type": "String" }
}
},
"statusError": "Error: {message}",
"@statusError": {
"placeholders": {
"message": { "type": "String" }
}
},
"channelsHeading": "Channels",
"@channelsHeading": {},
"clientsHeading": "Online clients",
"@clientsHeading": {},
"countChannelsAndClients": "{channels} channels • {clients} online",
"@countChannelsAndClients": {
"placeholders": {
"channels": { "type": "int" },
"clients": { "type": "int" }
}
}
}
+17 -3
View File
@@ -3,7 +3,21 @@
"@@x-source-of-truth": "DEC-015 (register v0.9.5). Simplified Chinese translations for the MVP key set. Keys must match app_en.arb; server-provided content is NOT translated (ADR-008 / DEC-015).",
"appTitle": "Chanora",
"homeGreeting": "欢迎使用 Chanora",
"homeNotProductionReadyBanner": "Chanora 目前处于早期开发阶段,此版本尚未达到正式发布质量。",
"connectAction": "连接到服务器"
"homeNotProductionReadyBanner": "Alpha 版本——尚未达到生产环境质量。",
"fieldServerHost": "服务器地址",
"fieldNickname": "昵称",
"connectAction": "连接",
"disconnectAction": "断开连接",
"refreshAction": "刷新",
"statusIdle": "未连接",
"statusConnecting": "正在连接…",
"statusConnected": "已连接到 {server}",
"statusError": "错误:{message}",
"channelsHeading": "频道",
"clientsHeading": "在线用户",
"countChannelsAndClients": "{channels} 个频道 • {clients} 在线"
}
@@ -103,23 +103,83 @@ abstract class AppL10n {
/// **'Chanora'**
String get appTitle;
/// Greeting shown on the empty home screen before any server is connected.
///
/// In en, this message translates to:
/// **'Welcome to Chanora'**
String get homeGreeting;
/// Plain-language banner informing testers that this build is not for end-user use. Mirrors README.md's status line.
///
/// In en, this message translates to:
/// **'Chanora is currently in early development. This build is not production-ready.'**
/// **'Alpha build not production ready.'**
String get homeNotProductionReadyBanner;
/// Label for the primary action that opens the connect-to-server flow.
/// Label for the server-address input on the connect form.
///
/// In en, this message translates to:
/// **'Connect to a server'**
/// **'Server address'**
String get fieldServerHost;
/// Label for the nickname input on the connect form.
///
/// In en, this message translates to:
/// **'Nickname'**
String get fieldNickname;
/// Label for the button that initiates a connection.
///
/// In en, this message translates to:
/// **'Connect'**
String get connectAction;
/// Label for the button that ends the active connection.
///
/// In en, this message translates to:
/// **'Disconnect'**
String get disconnectAction;
/// Label for the button that re-fetches the server snapshot.
///
/// In en, this message translates to:
/// **'Refresh'**
String get refreshAction;
/// No description provided for @statusIdle.
///
/// In en, this message translates to:
/// **'Not connected'**
String get statusIdle;
/// No description provided for @statusConnecting.
///
/// In en, this message translates to:
/// **'Connecting…'**
String get statusConnecting;
/// No description provided for @statusConnected.
///
/// In en, this message translates to:
/// **'Connected to {server}'**
String statusConnected(String server);
/// No description provided for @statusError.
///
/// In en, this message translates to:
/// **'Error: {message}'**
String statusError(String message);
/// No description provided for @channelsHeading.
///
/// In en, this message translates to:
/// **'Channels'**
String get channelsHeading;
/// No description provided for @clientsHeading.
///
/// In en, this message translates to:
/// **'Online clients'**
String get clientsHeading;
/// No description provided for @countChannelsAndClients.
///
/// In en, this message translates to:
/// **'{channels} channels • {clients} online'**
String countChannelsAndClients(int channels, int clients);
}
class _AppL10nDelegate extends LocalizationsDelegate<AppL10n> {
@@ -11,13 +11,49 @@ class AppL10nEn extends AppL10n {
@override
String get appTitle => 'Chanora';
@override
String get homeGreeting => 'Welcome to Chanora';
@override
String get homeNotProductionReadyBanner =>
'Chanora is currently in early development. This build is not production-ready.';
'Alpha build not production ready.';
@override
String get connectAction => 'Connect to a server';
String get fieldServerHost => 'Server address';
@override
String get fieldNickname => 'Nickname';
@override
String get connectAction => 'Connect';
@override
String get disconnectAction => 'Disconnect';
@override
String get refreshAction => 'Refresh';
@override
String get statusIdle => 'Not connected';
@override
String get statusConnecting => 'Connecting…';
@override
String statusConnected(String server) {
return 'Connected to $server';
}
@override
String statusError(String message) {
return 'Error: $message';
}
@override
String get channelsHeading => 'Channels';
@override
String get clientsHeading => 'Online clients';
@override
String countChannelsAndClients(int channels, int clients) {
return '$channels channels • $clients online';
}
}
@@ -12,12 +12,47 @@ class AppL10nZh extends AppL10n {
String get appTitle => 'Chanora';
@override
String get homeGreeting => '欢迎使用 Chanora';
String get homeNotProductionReadyBanner => 'Alpha 版本——尚未达到生产环境质量。';
@override
String get homeNotProductionReadyBanner =>
'Chanora 目前处于早期开发阶段,此版本尚未达到正式发布质量。';
String get fieldServerHost => '服务器地址';
@override
String get connectAction => '连接到服务器';
String get fieldNickname => '昵称';
@override
String get connectAction => '连接';
@override
String get disconnectAction => '断开连接';
@override
String get refreshAction => '刷新';
@override
String get statusIdle => '未连接';
@override
String get statusConnecting => '正在连接…';
@override
String statusConnected(String server) {
return '已连接到 $server';
}
@override
String statusError(String message) {
return '错误:$message';
}
@override
String get channelsHeading => '频道';
@override
String get clientsHeading => '在线用户';
@override
String countChannelsAndClients(int channels, int clients) {
return '$channels 个频道 • $clients 在线';
}
}