Skip to content

Commit de4491e

Browse files
author
Mohammod Al Amin Ashik
committed
updates tests
1 parent 31e3266 commit de4491e

139 files changed

Lines changed: 6889 additions & 4326 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ on:
66
pull_request:
77
branches: [main]
88

9+
# Cancel in-progress runs when a new commit is pushed to the same PR.
10+
# PR: same group per PR so new push cancels previous run. Push to main: unique group so no cancel.
911
concurrency:
10-
group: ${{ github.workflow }}-${{ github.ref }}
11-
cancel-in-progress: true
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
13+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1214

1315
env:
1416
CARGO_TERM_COLOR: always
1517
RUST_BACKTRACE: 1
1618
# Cache keys for better hit rates
1719
RUST_CACHE_KEY: v1
1820
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.cache/ms-playwright
21+
# Linux: pkg-config must find glib-2.0.pc (set before any cargo step; only used on Linux)
22+
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
1923

2024
jobs:
2125
# ─────────────────────────────────────────────────────────────
@@ -28,12 +32,13 @@ jobs:
2832
- uses: dtolnay/rust-toolchain@stable
2933
with:
3034
components: rustfmt, clippy
31-
- uses: Swatinem/rust-cache@v2
3235

3336
- name: Install Linux deps
3437
run: |
3538
sudo apt-get update
36-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
39+
sudo apt-get install -y pkg-config libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
40+
41+
- uses: Swatinem/rust-cache@v2
3742

3843
- name: Format check
3944
run: cargo fmt --all --check
@@ -85,16 +90,17 @@ jobs:
8590
- uses: dtolnay/rust-toolchain@stable
8691
with:
8792
targets: ${{ matrix.target }}
88-
- uses: Swatinem/rust-cache@v2
89-
with:
90-
key: ${{ matrix.target }}
9193

92-
# Linux dependencies for Tauri
94+
# Linux dependencies for Tauri (before rust-cache so cargo can find glib)
9395
- name: Install Linux deps
9496
if: matrix.os == 'ubuntu-latest'
9597
run: |
9698
sudo apt-get update
97-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
99+
sudo apt-get install -y pkg-config libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
100+
101+
- uses: Swatinem/rust-cache@v2
102+
with:
103+
key: ${{ matrix.target }}
98104

99105
# Install cargo-nextest
100106
- name: Install nextest
@@ -134,6 +140,13 @@ jobs:
134140
- uses: dtolnay/rust-toolchain@stable
135141
with:
136142
targets: ${{ matrix.target }}
143+
144+
- name: Install Linux deps
145+
if: matrix.os == 'ubuntu-latest'
146+
run: |
147+
sudo apt-get update
148+
sudo apt-get install -y pkg-config libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
149+
137150
- uses: Swatinem/rust-cache@v2
138151
with:
139152
key: ${{ matrix.target }}-build
@@ -143,12 +156,6 @@ jobs:
143156
node-version: 20
144157
cache: 'pnpm'
145158

146-
- name: Install Linux deps
147-
if: matrix.os == 'ubuntu-latest'
148-
run: |
149-
sudo apt-get update
150-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev
151-
152159
- run: pnpm install --frozen-lockfile
153160
- run: pnpm build
154161
env:
@@ -216,9 +223,6 @@ jobs:
216223
steps:
217224
- uses: actions/checkout@v4
218225
- uses: dtolnay/rust-toolchain@stable
219-
- uses: Swatinem/rust-cache@v2
220-
with:
221-
key: ${{ matrix.os }}-e2e
222226
- uses: pnpm/action-setup@v4
223227
- uses: actions/setup-node@v4
224228
with:
@@ -229,7 +233,11 @@ jobs:
229233
if: matrix.os == 'ubuntu-latest'
230234
run: |
231235
sudo apt-get update
232-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev webkit2gtk-driver xvfb
236+
sudo apt-get install -y pkg-config libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev webkit2gtk-driver xvfb
237+
238+
- uses: Swatinem/rust-cache@v2
239+
with:
240+
key: ${{ matrix.os }}-e2e
233241

234242
# Cache tauri-driver binary
235243
- name: Cache tauri-driver

.github/workflows/e2e-tauri-comment.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
issue_comment:
88
types: [created]
99

10+
env:
11+
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
12+
1013
jobs:
1114
e2e-tauri:
1215
# Only run when comment on a PR contains /e2e-tauri
@@ -44,6 +47,13 @@ jobs:
4447
ref: ${{ steps.pr.outputs.sha }}
4548

4649
- uses: dtolnay/rust-toolchain@stable
50+
51+
- name: Install Linux deps
52+
if: matrix.os == 'ubuntu-latest'
53+
run: |
54+
sudo apt-get update
55+
sudo apt-get install -y pkg-config libglib2.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev webkit2gtk-driver xvfb
56+
4757
- uses: Swatinem/rust-cache@v2
4858
with:
4959
key: ${{ matrix.os }}-e2e-comment
@@ -54,12 +64,6 @@ jobs:
5464
node-version: 20
5565
cache: 'pnpm'
5666

57-
- name: Install Linux deps
58-
if: matrix.os == 'ubuntu-latest'
59-
run: |
60-
sudo apt-get update
61-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libsecret-1-dev webkit2gtk-driver xvfb
62-
6367
- name: Cache tauri-driver
6468
uses: actions/cache@v4
6569
id: tauri-driver-cache

apps/desktop/src-tauri/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ fn main() {
1212
}
1313
}
1414
}
15-
15+
1616
// Tell Cargo to re-run this script if tauri.conf.json changes
1717
println!("cargo:rerun-if-changed=tauri.conf.json");
18-
18+
1919
tauri_build::build()
2020
}

apps/desktop/src-tauri/src/commands/client.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use tauri::State;
1010
use tokio::sync::RwLock;
1111
use uuid::Uuid;
1212

13-
use crate::state::AppState;
1413
use crate::commands::gateway::GatewayAppState;
14+
use crate::state::AppState;
1515

1616
/// Response for client listing
1717
#[derive(Debug, Serialize)]
@@ -28,7 +28,9 @@ pub struct ClientResponse {
2828
impl From<Client> for ClientResponse {
2929
fn from(c: Client) -> Self {
3030
let (mode, locked_id) = match &c.connection_mode {
31-
ConnectionMode::Locked { space_id } => ("locked".to_string(), Some(space_id.to_string())),
31+
ConnectionMode::Locked { space_id } => {
32+
("locked".to_string(), Some(space_id.to_string()))
33+
}
3234
ConnectionMode::FollowActive => ("follow_active".to_string(), None),
3335
ConnectionMode::AskOnChange { .. } => ("ask_on_change".to_string(), None),
3436
};
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Commands for managing client-specific custom feature sets
22
3-
use tauri::State;
43
use crate::state::AppState;
54
use mcpmux_core::{FeatureSet, FeatureSetType};
5+
use tauri::State;
66

77
/// Find or create a custom feature set for a specific client in a space
88
/// This ensures only one custom feature set exists per client per space
@@ -13,20 +13,20 @@ pub async fn find_or_create_client_custom_feature_set(
1313
space_id: String,
1414
) -> Result<FeatureSet, String> {
1515
let custom_set_name = format!("{} - Custom", client_name);
16-
16+
1717
// First, try to find existing custom feature set
1818
let existing_sets = state
1919
.feature_set_repository
2020
.list_by_space(&space_id)
2121
.await
2222
.map_err(|e| format!("Failed to list feature sets: {}", e))?;
23-
23+
2424
// Look for existing custom feature set with this name
25-
if let Some(existing) = existing_sets.iter().find(|fs|
26-
fs.name == custom_set_name &&
27-
fs.feature_set_type == FeatureSetType::Custom &&
28-
!fs.is_deleted
29-
) {
25+
if let Some(existing) = existing_sets.iter().find(|fs| {
26+
fs.name == custom_set_name
27+
&& fs.feature_set_type == FeatureSetType::Custom
28+
&& !fs.is_deleted
29+
}) {
3030
// Load members
3131
return state
3232
.feature_set_repository
@@ -35,18 +35,17 @@ pub async fn find_or_create_client_custom_feature_set(
3535
.map_err(|e| format!("Failed to load feature set: {}", e))?
3636
.ok_or_else(|| "Feature set not found".to_string());
3737
}
38-
38+
3939
// No existing set found, create a new one
4040
let new_set = FeatureSet::new_custom(&custom_set_name, &space_id)
4141
.with_description(format!("Custom features for {}", client_name))
4242
.with_icon("⚙️");
43-
43+
4444
state
4545
.feature_set_repository
4646
.create(&new_set)
4747
.await
4848
.map_err(|e| format!("Failed to create custom feature set: {}", e))?;
49-
49+
5050
Ok(new_set)
5151
}
52-

apps/desktop/src-tauri/src/commands/config_export.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
//!
33
//! IPC commands for generating MCP configuration files for clients.
44
5-
use mcpmux_core::{ConfigExporter, ConfigFormat, ResolvedTransport, ResolvedServer, TransportConfig};
5+
use mcpmux_core::{
6+
ConfigExporter, ConfigFormat, ResolvedServer, ResolvedTransport, TransportConfig,
7+
};
68
use serde::{Deserialize, Serialize};
79
use std::collections::HashMap;
810
use std::path::PathBuf;
@@ -78,27 +80,29 @@ async fn build_resolved_servers(
7880
if let Some(entry) = inst.get_definition() {
7981
// Build resolved transport from registry transport + input values
8082
let transport = match &entry.transport {
81-
TransportConfig::Stdio { command, args, env, .. } => {
83+
TransportConfig::Stdio {
84+
command, args, env, ..
85+
} => {
8286
// Resolve placeholders in command
8387
let resolved_command = resolve_placeholders(command, &inst.input_values);
84-
88+
8589
// Resolve placeholders in args
8690
let mut resolved_args: Vec<String> = args
8791
.iter()
8892
.map(|arg| resolve_placeholders(arg, &inst.input_values))
8993
.collect();
90-
94+
9195
// Append user's extra args
9296
resolved_args.extend(inst.args_append.clone());
9397

9498
// Build env from registry + input values + env_overrides
9599
let mut resolved_env = HashMap::new();
96-
100+
97101
// 1. Start with registry env
98102
for (k, v) in env {
99103
resolved_env.insert(k.clone(), resolve_placeholders(v, &inst.input_values));
100104
}
101-
105+
102106
// 2. Add input values (for api_key type servers)
103107
if !mask_credentials {
104108
resolved_env.extend(inst.input_values.clone());
@@ -107,7 +111,7 @@ async fn build_resolved_servers(
107111
resolved_env.insert(k.clone(), "***MASKED***".to_string());
108112
}
109113
}
110-
114+
111115
// 3. Apply user's env overrides
112116
resolved_env.extend(inst.env_overrides.clone());
113117

@@ -119,16 +123,16 @@ async fn build_resolved_servers(
119123
}
120124
TransportConfig::Http { url, headers, .. } => {
121125
let resolved_url = resolve_placeholders(url, &inst.input_values);
122-
126+
123127
// Resolve headers from registry
124128
let mut resolved_headers: HashMap<String, String> = headers
125129
.iter()
126130
.map(|(k, v)| (k.clone(), resolve_placeholders(v, &inst.input_values)))
127131
.collect();
128-
132+
129133
// Add user's extra headers
130134
resolved_headers.extend(inst.extra_headers.clone());
131-
135+
132136
ResolvedTransport::Http {
133137
url: resolved_url,
134138
headers: resolved_headers,

apps/desktop/src-tauri/src/commands/feature_members.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use tauri::State;
88
use tokio::sync::RwLock;
99
use uuid::Uuid as StdUuid;
1010

11-
use crate::state::AppState;
1211
use crate::commands::gateway::GatewayAppState;
12+
use crate::state::AppState;
1313

1414
/// Add an individual feature (tool/prompt/resource) to a feature set
1515
#[tauri::command]
@@ -21,7 +21,7 @@ pub async fn add_feature_to_set(
2121
mode: String,
2222
) -> Result<(), String> {
2323
let app_state = &*state;
24-
24+
2525
let mode = match mode.as_str() {
2626
"include" => MemberMode::Include,
2727
"exclude" => MemberMode::Exclude,
@@ -33,12 +33,12 @@ pub async fn add_feature_to_set(
3333
.add_feature_member(&feature_set_id, &feature_id, mode)
3434
.await
3535
.map_err(|e| format!("Failed to add feature to set: {}", e))?;
36-
36+
3737
// Emit domain event if gateway is running
3838
let gw_state = gateway_state.read().await;
3939
if let Some(ref gw) = gw_state.gateway_state {
4040
let gw = gw.read().await;
41-
41+
4242
// Get feature set to access space_id
4343
if let Ok(Some(fs)) = app_state.feature_set_repository.get(&feature_set_id).await {
4444
if let Some(space_id_str) = fs.space_id {
@@ -72,12 +72,12 @@ pub async fn remove_feature_from_set(
7272
.remove_feature_member(&feature_set_id, &feature_id)
7373
.await
7474
.map_err(|e| format!("Failed to remove feature from set: {}", e))?;
75-
75+
7676
// Emit domain event if gateway is running
7777
let gw_state = gateway_state.read().await;
7878
if let Some(ref gw) = gw_state.gateway_state {
7979
let gw = gw.read().await;
80-
80+
8181
// Get feature set to access space_id
8282
if let Ok(Some(fs)) = app_state.feature_set_repository.get(&feature_set_id).await {
8383
if let Some(space_id_str) = fs.space_id {
@@ -112,4 +112,3 @@ pub async fn get_feature_set_members(
112112

113113
Ok(members)
114114
}
115-

0 commit comments

Comments
 (0)