From 0517f06925b1b4e670b046553ba99529f61d0a53 Mon Sep 17 00:00:00 2001 From: udo Date: Sat, 18 Jul 2026 06:46:21 +0000 Subject: [PATCH] Deduplicate component resolution probes --- docs/wasm-runtime-architecture.md | 6 ++++-- src/wasm/worker.cpp | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/wasm-runtime-architecture.md b/docs/wasm-runtime-architecture.md index b594bbc..27368f0 100644 --- a/docs/wasm-runtime-architecture.md +++ b/docs/wasm-runtime-architecture.md @@ -522,8 +522,10 @@ header free-functions are `inline`. The wasm backend exposes only declarations the caller after a repeated parent invocation. Resolved component paths are canonical absolute paths: equivalent spellings containing `.` or `..` must share one source, compile, artifact, and module-cache identity. The compiler - independently enforces the same canonical identity, and persisted failures - are reused only when their recorded source path matches the current request. + independently enforces the same canonical identity. Within one resolution, + identical entry/site bases and identical raw/`.uce` candidate spellings are + probed only once while first-match order is preserved. Persisted failures are + reused only when their recorded source path matches the current request. `scripts/test_nested_component_props.sh` passes a large prop tree through an outer component, invokes 300 nested components, and verifies both inner and caller props are restored. Its warm-request ceiling guards the request-scope diff --git a/src/wasm/worker.cpp b/src/wasm/worker.cpp index 8446835..2a9555b 100644 --- a/src/wasm/worker.cpp +++ b/src/wasm/worker.cpp @@ -2244,17 +2244,22 @@ private: if(current_dir != "" && current_dir != entry_dir) bases.push_back(current_dir + "/"); } - bases.push_back(worker.cfg.site_root + "/"); + String site_base = worker.cfg.site_root + "/"; + if(std::find(bases.begin(), bases.end(), site_base) == bases.end()) + bases.push_back(site_base); + String normalized_file_name = normalize_component_path(file_name); for(auto& base : bases) { std::vector candidates; candidates.push_back(base + file_name); - candidates.push_back(base + normalize_component_path(file_name)); + if(normalized_file_name != file_name) + candidates.push_back(base + normalized_file_name); if(file_name.rfind("components/", 0) != 0 && base != "") { candidates.push_back(base + "components/" + file_name); - candidates.push_back(base + "components/" + normalize_component_path(file_name)); + if(normalized_file_name != file_name) + candidates.push_back(base + "components/" + normalized_file_name); } for(auto& candidate : candidates) {