Skip to content

Commit 5a1b63a

Browse files
refactor(Track): Enhance dispatcher robustness and error logging
- Updated Tauri IPC imports to reflect latest API structure in `protocol.rs` - Replaced `ResponseBuilder::new()` with `ResponseBuilder::builder()` pattern for HTTP responses - Added detailed debug logging throughout command/RPC dispatch flow in `track.rs` - Improved error handling with explicit error propagation and JSON error string wrapping - Restructured parameter parsing logic with clearer type checking and error messages These changes strengthen the reliability of Mountain's dispatcher component when handling requests from Sky (UI) and Cocoon (extension host), critical for maintaining stable IPC communication (Vine layer). Enhanced logging aids in diagnosing extension host integration issues during Path A MVP development.
1 parent 5306dfe commit 5a1b63a

3 files changed

Lines changed: 90 additions & 36 deletions

File tree

Source/Library.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,60 @@ fn main() { Binary::Fn::Fn(); }
88
pub mod Binary;
99

1010
// NEW:
11-
pub mod app_state;
11+
// pub mod app_state;
1212

13-
pub mod environment;
13+
// pub mod environment;
1414

15-
pub mod handlers {
16-
pub mod commands;
15+
// pub mod handlers {
16+
// pub mod commands;
1717

18-
pub mod config;
18+
// pub mod config;
1919

20-
pub mod diagnostics;
20+
// pub mod diagnostics;
2121

22-
pub mod documents;
22+
// pub mod documents;
2323

24-
pub mod enablement;
24+
// pub mod enablement;
2525

26-
pub mod native_fs;
26+
// pub mod native_fs;
2727

28-
pub mod output;
28+
// pub mod output;
2929

30-
pub mod process_mgmt;
30+
// pub mod process_mgmt;
3131

32-
pub mod protocol;
32+
// pub mod protocol;
3333

34-
pub mod proxy;
34+
// pub mod proxy;
3535

36-
pub mod registry;
36+
// pub mod registry;
3737

38-
pub mod secrets;
38+
// pub mod secrets;
3939

40-
pub mod storage;
40+
// pub mod storage;
4141

42-
pub mod terminal;
42+
// pub mod terminal;
4343

44-
pub mod ui;
44+
// pub mod ui;
4545

46-
pub mod workspace;
46+
// pub mod workspace;
4747

48-
pub mod workspace_fs_api;
48+
// pub mod workspace_fs_api;
4949

50-
pub mod error_utils;
50+
// pub mod error_utils;
5151

52-
pub mod extension_status;
52+
// pub mod extension_status;
5353

54-
pub mod sky_ui_responses;
55-
}
54+
// pub mod sky_ui_responses;
55+
// }
5656

57-
pub mod Entry;
57+
// pub mod Entry;
5858

59-
pub mod mist;
59+
// pub mod mist;
6060

61-
pub mod track;
61+
// pub mod track;
6262

63-
pub mod rpc;
63+
// pub mod rpc;
6464

65-
pub mod runtime;
65+
// pub mod runtime;
6666

67-
pub mod vine;
67+
// pub mod vine;

Source/handlers/protocol.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ use tauri::{
4242

4343
Runtime,
4444

45+
http::{Response as ResponseBuilder, StatusCode},
4546
// Renamed to avoid conflict
46-
api::ipc::{Request, Response as TauriResponse},
47-
48-
http::{ResponseBuilder, StatusCode},
47+
ipc::{Request, Response as TauriResponse},
4948
};
5049
use url::Url;
5150

@@ -271,7 +270,7 @@ pub fn handle_vscode_protocol<R:Runtime>(
271270
});
272271

273272
// Successfully dispatched an action (or attempted to), return 200 OK to OS.
274-
ResponseBuilder::new().status(StatusCode::OK).body(Vec::new())
273+
ResponseBuilder::builder().status(StatusCode::OK).body(Vec::new())
275274
} else {
276275
// This is an RPC error string
277276
let err_msg_json = effect_to_run_result.unwrap_err();
@@ -293,7 +292,7 @@ pub fn handle_vscode_protocol<R:Runtime>(
293292
StatusCode::NOT_FOUND
294293
};
295294

296-
ResponseBuilder::new().status(status_code).body(err_msg_json.into_bytes())
295+
ResponseBuilder::builder().status(status_code).body(err_msg_json.into_bytes())
297296
}
298297
},
299298

@@ -305,7 +304,7 @@ pub fn handle_vscode_protocol<R:Runtime>(
305304

306305
let response_body = error_utils::rpc_error_string(err_msg, Some("EBADURI_PARSE"));
307306

308-
ResponseBuilder::new()
307+
ResponseBuilder::builder()
309308
.status(StatusCode::BAD_REQUEST)
310309
.body(response_body.into_bytes())
311310
},

0 commit comments

Comments
 (0)