Skip to content

Commit 644b58d

Browse files
committed
fix: resolve markdownlint MD012 blank spaces and enhance tests failure logging
1 parent 5fb652d commit 644b58d

4 files changed

Lines changed: 83 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Dependabot integration under `.github/dependabot.yml` tracking Rust cargo packages and GitHub Actions.
1111
* Custom structured issue templates (Bug Report, Feature Request, Plugin Submission) and a Pull Request template in `.github/`.
1212

13-
1413
### Fixed
1514
* Stale cache build errors by unlinking old host binaries if `pterm_hash.txt` has changed.
1615
* Registry trusted validation check by trimming white-spaces inside the compile-time `TRUSTED_PLUGIN_HASHES` comparison array.
@@ -33,8 +32,6 @@
3332

3433
## [0.1.0a] - 2026-07-04
3534

36-
This is the initial release of the **plug** framework, establishing a robust multitab desktop UI shell linked with a sandboxed WebAssembly execution engine.
37-
3835
### Added
3936
* **Native/FFI Interface**: C++ application shell linked to a Rust runtime staticlib (`tm_main`).
4037
* **WASM Plugin Runtime**: Built-in integration with the Wasmer 4.3 runtime using the Cranelift compiler.

plug.app/rt/handlers/ops/cmds/c_plug/check/mod.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ pub fn c_check(_args: *const i8) -> i32 {
7373
let mut ok = last_hr == 0;
7474
if !ok {
7575
// local fallback: copy registry from pluglists.json if download fail
76-
let local_registry = std::path::PathBuf::from("pluglists.json");
77-
if local_registry.exists() {
76+
if let Some(local_registry) = find_local_file("pluglists.json") {
7877
if let Ok(_) = fs::copy(&local_registry, temp_path) {
7978
ok = true;
8079
}
@@ -130,6 +129,32 @@ pub fn c_check(_args: *const i8) -> i32 {
130129
0
131130
}
132131

132+
fn find_local_file(filename: &str) -> Option<std::path::PathBuf> {
133+
// scan upwards from executable path to find target file
134+
if let Ok(exe) = std::env::current_exe() {
135+
let mut parent = exe.parent();
136+
while let Some(p) = parent {
137+
let path = p.join(filename);
138+
if path.exists() && path.is_file() {
139+
return Some(path);
140+
}
141+
parent = p.parent();
142+
}
143+
}
144+
// scan upwards from current directory
145+
if let Ok(cur) = std::env::current_dir() {
146+
let mut parent = Some(cur.as_path());
147+
while let Some(p) = parent {
148+
let path = p.join(filename);
149+
if path.exists() && path.is_file() {
150+
return Some(path);
151+
}
152+
parent = p.parent();
153+
}
154+
}
155+
None
156+
}
157+
133158
#[cfg(test)]
134159
mod tests {
135160
use super::*;

plug.app/rt/handlers/ops/cmds/c_plug/mod.rs

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ pub fn install_plugin_manually(clean_name: &str, session_hash: &str, registry_sh
9191
let mut downloaded_wasm = progress::download_with_progress(&url_wasm, tmp_wasm.to_str().unwrap(), silent);
9292
if !downloaded_wasm {
9393
// local fallback: copy plugin from local path if download fail
94-
let local_wasm = PathBuf::from("plugins").join(clean_name).join(clean_name);
95-
if local_wasm.exists() {
96-
if let Ok(_) = fs::copy(&local_wasm, &tmp_wasm) {
97-
downloaded_wasm = true;
98-
if !silent {
99-
print_info(&format!("local fallback: copy plugin from {}", local_wasm.display()));
94+
if let Some(plugins_dir) = find_local_plugins_dir() {
95+
let local_wasm = plugins_dir.join(clean_name).join(clean_name);
96+
if local_wasm.exists() {
97+
if let Ok(_) = fs::copy(&local_wasm, &tmp_wasm) {
98+
downloaded_wasm = true;
99+
if !silent {
100+
print_info(&format!("local fallback: copy plugin from {}", local_wasm.display()));
101+
}
100102
}
101103
}
102104
}
@@ -109,12 +111,14 @@ pub fn install_plugin_manually(clean_name: &str, session_hash: &str, registry_sh
109111
let mut downloaded_toml = progress::download_with_progress(&url_toml, tmp_toml.to_str().unwrap(), true);
110112
if !downloaded_toml {
111113
// local fallback: copy manifest if download fail
112-
let local_toml = PathBuf::from("plugins").join("plugin.toml");
113-
if local_toml.exists() {
114-
if let Ok(_) = fs::copy(&local_toml, &tmp_toml) {
115-
downloaded_toml = true;
116-
if !silent {
117-
print_info(&format!("local fallback: copy manifest from {}", local_toml.display()));
114+
if let Some(plugins_dir) = find_local_plugins_dir() {
115+
let local_toml = plugins_dir.join("plugin.toml");
116+
if local_toml.exists() {
117+
if let Ok(_) = fs::copy(&local_toml, &tmp_toml) {
118+
downloaded_toml = true;
119+
if !silent {
120+
print_info(&format!("local fallback: copy manifest from {}", local_toml.display()));
121+
}
118122
}
119123
}
120124
}
@@ -196,3 +200,29 @@ pub fn install_plugin_manually(clean_name: &str, session_hash: &str, registry_sh
196200

197201
if success { 0 } else { -1 }
198202
}
203+
204+
fn find_local_plugins_dir() -> Option<PathBuf> {
205+
// scan upwards from executable path to find plugins folder
206+
if let Ok(exe) = std::env::current_exe() {
207+
let mut parent = exe.parent();
208+
while let Some(p) = parent {
209+
let path = p.join("plugins");
210+
if path.exists() && path.is_dir() {
211+
return Some(path);
212+
}
213+
parent = p.parent();
214+
}
215+
}
216+
// scan upwards from current directory
217+
if let Ok(cur) = std::env::current_dir() {
218+
let mut parent = Some(cur.as_path());
219+
while let Some(p) = parent {
220+
let path = p.join("plugins");
221+
if path.exists() && path.is_dir() {
222+
return Some(path);
223+
}
224+
parent = p.parent();
225+
}
226+
}
227+
None
228+
}

tests/run.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,26 @@ def main():
357357
with ThreadPoolExecutor(max_workers=len(unit_tests)) as executor:
358358
futures = [executor.submit(run_test_script, ut, env_ctx) for ut in unit_tests if ut.exists()]
359359
for f in futures:
360-
results.append(f.result())
360+
res = f.result()
361+
results.append(res)
362+
status = "PASSED" if res["success"] else "FAILED"
363+
print(f"[TEST] {res['name']} {status}")
364+
if not res["success"]:
365+
print(f"--- STDOUT ({res['name']}) ---\n{res['stdout']}")
366+
print(f"--- STDERR ({res['name']}) ---\n{res['stderr']}")
361367

362368
# run integration and e2e test sequentially to prevent locking collisions
363369
print("[ORCHESTRATOR] Executing Integration and E2E Tests sequentially...")
364370
sequential_tests = integration_tests + e2e_tests
365371
for t in sequential_tests:
366372
if t.exists():
367-
results.append(run_test_script(t, env_ctx))
373+
res = run_test_script(t, env_ctx)
374+
results.append(res)
375+
status = "PASSED" if res["success"] else "FAILED"
376+
print(f"[TEST] {res['name']} {status}")
377+
if not res["success"]:
378+
print(f"--- STDOUT ({res['name']}) ---\n{res['stdout']}")
379+
print(f"--- STDERR ({res['name']}) ---\n{res['stderr']}")
368380

369381
# 4. generate reports
370382
results_xml = project_root / "tests" / ".artifacts" / "results.xml"

0 commit comments

Comments
 (0)